mirror of
https://github.com/flibusta-apps/meilie_updater.git
synced 2025-12-06 07:05:37 +01:00
Add sentry
This commit is contained in:
36
poetry.lock
generated
36
poetry.lock
generated
@@ -349,6 +349,36 @@ idna = {version = "*", optional = true, markers = "extra == \"idna2008\""}
|
|||||||
[package.extras]
|
[package.extras]
|
||||||
idna2008 = ["idna"]
|
idna2008 = ["idna"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sentry-sdk"
|
||||||
|
version = "1.5.10"
|
||||||
|
description = "Python client for Sentry (https://sentry.io)"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
certifi = "*"
|
||||||
|
urllib3 = ">=1.10.0"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
aiohttp = ["aiohttp (>=3.5)"]
|
||||||
|
beam = ["apache-beam (>=2.12)"]
|
||||||
|
bottle = ["bottle (>=0.12.13)"]
|
||||||
|
celery = ["celery (>=3)"]
|
||||||
|
chalice = ["chalice (>=1.16.0)"]
|
||||||
|
django = ["django (>=1.8)"]
|
||||||
|
falcon = ["falcon (>=1.4)"]
|
||||||
|
flask = ["flask (>=0.11)", "blinker (>=1.1)"]
|
||||||
|
httpx = ["httpx (>=0.16.0)"]
|
||||||
|
pure_eval = ["pure-eval", "executing", "asttokens"]
|
||||||
|
pyspark = ["pyspark (>=2.4.4)"]
|
||||||
|
quart = ["quart (>=0.16.1)", "blinker (>=1.1)"]
|
||||||
|
rq = ["rq (>=0.6)"]
|
||||||
|
sanic = ["sanic (>=0.8)"]
|
||||||
|
sqlalchemy = ["sqlalchemy (>=1.2)"]
|
||||||
|
tornado = ["tornado (>=5)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "six"
|
name = "six"
|
||||||
version = "1.16.0"
|
version = "1.16.0"
|
||||||
@@ -458,7 +488,7 @@ testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)",
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = "^3.9"
|
python-versions = "^3.9"
|
||||||
content-hash = "ffd93f8b1f721e72d72a7368fdd17a52c3083afaaaf85777c663f3162199a99e"
|
content-hash = "9faf19232e7ce4a3e03a8c5d1c5bd3ce3e1a096b095b9ec528016d7919143e99"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
aioredis = [
|
aioredis = [
|
||||||
@@ -704,6 +734,10 @@ rfc3986 = [
|
|||||||
{file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"},
|
{file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"},
|
||||||
{file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"},
|
{file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"},
|
||||||
]
|
]
|
||||||
|
sentry-sdk = [
|
||||||
|
{file = "sentry-sdk-1.5.10.tar.gz", hash = "sha256:0a9eb20a84f4c17c08c57488d59fdad18669db71ebecb28fb0721423a33535f9"},
|
||||||
|
{file = "sentry_sdk-1.5.10-py2.py3-none-any.whl", hash = "sha256:972c8fe9318a415b5cf35f687f568321472ef94b36806407c370ce9c88a67f2e"},
|
||||||
|
]
|
||||||
six = [
|
six = [
|
||||||
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
|
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
|
||||||
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
|
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ uvicorn = {extras = ["standart"], version = "^0.17.1"}
|
|||||||
httpx = "^0.22.0"
|
httpx = "^0.22.0"
|
||||||
uvloop = "^0.16.0"
|
uvloop = "^0.16.0"
|
||||||
gunicorn = "^20.1.0"
|
gunicorn = "^20.1.0"
|
||||||
|
sentry-sdk = "^1.5.10"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
pre-commit = "^2.17.0"
|
pre-commit = "^2.17.0"
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ DEFAULT_RANKING_RULES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
async def update_books(ctx) -> bool:
|
async def update_books(ctx) -> bool: # NOSONAR
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
meili = get_meilisearch_client()
|
meili = get_meilisearch_client()
|
||||||
@@ -61,7 +61,7 @@ async def update_books(ctx) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def update_authors(ctx) -> bool:
|
async def update_authors(ctx) -> bool: # NOSONAR
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
meili = get_meilisearch_client()
|
meili = get_meilisearch_client()
|
||||||
@@ -98,14 +98,14 @@ async def update_authors(ctx) -> bool:
|
|||||||
|
|
||||||
index.update_searchable_attributes(["first_name", "last_name", "middle_name"])
|
index.update_searchable_attributes(["first_name", "last_name", "middle_name"])
|
||||||
index.update_filterable_attributes(["author_langs", "translator_langs"])
|
index.update_filterable_attributes(["author_langs", "translator_langs"])
|
||||||
index.update_ranking_rules([*DEFAULT_RANKING_RULES, "books_count:desc"])
|
index.update_ranking_rules([*DEFAULT_RANKING_RULES, "books_count:desc"]) # NOSONAR
|
||||||
|
|
||||||
await postgres.close()
|
await postgres.close()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def update_sequences(ctx) -> bool:
|
async def update_sequences(ctx) -> bool: # NOSONAR
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
meili = get_meilisearch_client()
|
meili = get_meilisearch_client()
|
||||||
@@ -143,7 +143,7 @@ async def update_sequences(ctx) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def update_genres(ctx) -> bool:
|
async def update_genres(ctx) -> bool: # NOSONAR
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
meili = get_meilisearch_client()
|
meili = get_meilisearch_client()
|
||||||
@@ -183,7 +183,7 @@ async def update_genres(ctx) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def update(ctx: dict, *args, **kwargs) -> bool:
|
async def update(ctx: dict, *args, **kwargs) -> bool: # NOSONAR
|
||||||
arq_pool: ArqRedis = ctx["arc_pool"]
|
arq_pool: ArqRedis = ctx["arc_pool"]
|
||||||
|
|
||||||
await arq_pool.enqueue_job("update_books")
|
await arq_pool.enqueue_job("update_books")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from fastapi import FastAPI
|
|||||||
|
|
||||||
from app.views import router
|
from app.views import router
|
||||||
from core.arq_pool import get_arq_pool
|
from core.arq_pool import get_arq_pool
|
||||||
|
import core.sentry # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
def start_app() -> FastAPI:
|
def start_app() -> FastAPI:
|
||||||
|
|||||||
@@ -17,5 +17,7 @@ class EnvConfig(BaseSettings):
|
|||||||
MEILI_HOST: str
|
MEILI_HOST: str
|
||||||
MEILI_MASTER_KEY: str
|
MEILI_MASTER_KEY: str
|
||||||
|
|
||||||
|
SENTRY_SDN: str
|
||||||
|
|
||||||
|
|
||||||
env_config = EnvConfig()
|
env_config = EnvConfig()
|
||||||
|
|||||||
8
src/core/sentry.py
Normal file
8
src/core/sentry.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import sentry_sdk
|
||||||
|
|
||||||
|
from core.config import env_config
|
||||||
|
|
||||||
|
|
||||||
|
sentry_sdk.init(
|
||||||
|
env_config.SENTRY_SDN,
|
||||||
|
)
|
||||||
@@ -8,6 +8,7 @@ from app.services import (
|
|||||||
update_genres,
|
update_genres,
|
||||||
)
|
)
|
||||||
from core.arq_pool import get_redis_settings, get_arq_pool
|
from core.arq_pool import get_redis_settings, get_arq_pool
|
||||||
|
import core.sentry # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
async def startup(ctx):
|
async def startup(ctx):
|
||||||
|
|||||||
Reference in New Issue
Block a user