From f539ecb87d241542d5c5f81043984ecad378803c Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Sun, 24 Apr 2022 15:30:52 +0300 Subject: [PATCH] Fix --- poetry.lock | 53 +++++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 1 + src/core/app.py | 8 +++++++ src/core/config.py | 2 ++ 4 files changed, 63 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index fd0543d..86b89cd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -303,6 +303,36 @@ idna = {version = "*", optional = true, markers = "extra == \"idna2008\""} [package.extras] 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]] name = "sniffio" version = "1.2.0" @@ -365,6 +395,19 @@ category = "main" optional = false python-versions = ">=3.6" +[[package]] +name = "urllib3" +version = "1.26.9" +description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" + +[package.extras] +brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] +secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] + [[package]] name = "uvicorn" version = "0.16.0" @@ -397,7 +440,7 @@ test = ["aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,< [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "ce72f050cdda896b5b9d8bc1fb5d22ccb2ba1cef62c5b366ab30bd5144994c76" +content-hash = "8597db74bd792ba6f40164f253684d29abfaaf5318f15242f38fb2e3620884a2" [metadata.files] aiosqlite = [ @@ -710,6 +753,10 @@ rfc3986 = [ {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, {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"}, +] sniffio = [ {file = "sniffio-1.2.0-py3-none-any.whl", hash = "sha256:471b71698eac1c2112a40ce2752bb2f4a4814c22a54a3eed3676bc0f5ca9f663"}, {file = "sniffio-1.2.0.tar.gz", hash = "sha256:c4666eecec1d3f50960c6bdf61ab7bc350648da6c126e3cf6898d8cd4ddcd3de"}, @@ -759,6 +806,10 @@ typing-extensions = [ {file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"}, {file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"}, ] +urllib3 = [ + {file = "urllib3-1.26.9-py2.py3-none-any.whl", hash = "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14"}, + {file = "urllib3-1.26.9.tar.gz", hash = "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"}, +] uvicorn = [ {file = "uvicorn-0.16.0-py3-none-any.whl", hash = "sha256:d8c839231f270adaa6d338d525e2652a0b4a5f4c2430b5c4ef6ae4d11776b0d2"}, {file = "uvicorn-0.16.0.tar.gz", hash = "sha256:eacb66afa65e0648fcbce5e746b135d09722231ffffc61883d4fac2b62fbea8d"}, diff --git a/pyproject.toml b/pyproject.toml index 404dd6c..6a503a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ uvicorn = {extras = ["standart"], version = "^0.16.0"} httpx = "^0.22.0" uvloop = "^0.16.0" gunicorn = "^20.1.0" +sentry-sdk = "^1.5.10" [tool.poetry.dev-dependencies] diff --git a/src/core/app.py b/src/core/app.py index dc09780..6aec677 100644 --- a/src/core/app.py +++ b/src/core/app.py @@ -1,9 +1,17 @@ from fastapi import FastAPI +import sentry_sdk + from app.views import router +from core.config import env_config from core.db import database +sentry_sdk.init( + env_config.SENTRY_DSN, +) + + def start_app() -> FastAPI: app = FastAPI() diff --git a/src/core/config.py b/src/core/config.py index 56ae79a..93aa519 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -10,5 +10,7 @@ class EnvConfig(BaseSettings): POSTGRES_PORT: int POSTGRES_DB: str + SENTRY_DSN: str + env_config = EnvConfig()