From 2df152fefe183d9157cbcd6f1f9b173c8fd3245e Mon Sep 17 00:00:00 2001 From: Adimanv Date: Tue, 24 Sep 2024 18:45:36 +0530 Subject: [PATCH 1/8] Sentry update to the code --- pyproject.toml | 1 + src/india_api/cmd/main.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index eb38519..d933166 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ test = [ "pytest >= 8.0.0", "pytest-cov >= 4.1.0", "testcontainers == 3.7.1", + sentry-sdk = "^2.1.1", ] lint = [ "mypy >= 1.7.1", diff --git a/src/india_api/cmd/main.py b/src/india_api/cmd/main.py index d46577c..3b5e69e 100644 --- a/src/india_api/cmd/main.py +++ b/src/india_api/cmd/main.py @@ -1,6 +1,7 @@ """The main entrypoint to the application.""" import uvicorn +import sentry_sdk from india_api import internal from india_api.internal.config import Config @@ -9,6 +10,16 @@ cfg = Config() +sentry_sdk.init( + dsn=os.getenv("SENTRY_DSN"), + environment=os.getenv("ENVIRONMENT", "local"), + traces_sample_rate=1 +) + +sentry_sdk.set_tag("app_name", "india_api") +sentry_sdk.set_tag("version", india_api.__version__) + + match cfg.SOURCE: case "indiadb": if cfg.DB_URL == "" or cfg.DB_URL is None: From 1ee4f066792377e2370dc29526a6c9e658a5f2a1 Mon Sep 17 00:00:00 2001 From: Adimanv Date: Tue, 24 Sep 2024 18:50:48 +0530 Subject: [PATCH 2/8] updates to pyroject --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d933166..37dff4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,8 @@ dependencies = [ "pytz >= 2023.3", "structlog >= 23.2.0", "uvicorn >= 0.24.0", - "numpy==1.26.4" + "numpy==1.26.4", + "sentry-sdk == ^2.1.1", ] [project.optional-dependencies] @@ -34,7 +35,6 @@ test = [ "pytest >= 8.0.0", "pytest-cov >= 4.1.0", "testcontainers == 3.7.1", - sentry-sdk = "^2.1.1", ] lint = [ "mypy >= 1.7.1", From 01cbd1706be6194a57f5a71225720f0825d30922 Mon Sep 17 00:00:00 2001 From: Adimanv Date: Tue, 24 Sep 2024 18:56:19 +0530 Subject: [PATCH 3/8] pyproject update --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 37dff4c..8eaf964 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ dependencies = [ "structlog >= 23.2.0", "uvicorn >= 0.24.0", "numpy==1.26.4", - "sentry-sdk == ^2.1.1", + "sentry-sdk == 2.1.1", ] [project.optional-dependencies] From b23927b4ce9773d11d84a723986e83e047f84f9e Mon Sep 17 00:00:00 2001 From: Adimanv Date: Tue, 24 Sep 2024 19:23:22 +0530 Subject: [PATCH 4/8] version update --- src/india_api/cmd/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/india_api/cmd/main.py b/src/india_api/cmd/main.py index 3b5e69e..7511810 100644 --- a/src/india_api/cmd/main.py +++ b/src/india_api/cmd/main.py @@ -6,7 +6,7 @@ from india_api import internal from india_api.internal.config import Config from india_api.internal.service import get_db_client, server - +__version__ = "0.1.37" cfg = Config() @@ -17,7 +17,7 @@ ) sentry_sdk.set_tag("app_name", "india_api") -sentry_sdk.set_tag("version", india_api.__version__) +sentry_sdk.set_tag("version",__version__) match cfg.SOURCE: From bfdd1dce53e5bb44f799175919b238c6ee23a737 Mon Sep 17 00:00:00 2001 From: Adimanv Date: Tue, 24 Sep 2024 20:59:34 +0530 Subject: [PATCH 5/8] version change --- src/india_api/cmd/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/india_api/cmd/main.py b/src/india_api/cmd/main.py index 7511810..1c3aa94 100644 --- a/src/india_api/cmd/main.py +++ b/src/india_api/cmd/main.py @@ -2,11 +2,12 @@ import uvicorn import sentry_sdk +import version from india_api import internal from india_api.internal.config import Config from india_api.internal.service import get_db_client, server -__version__ = "0.1.37" += cfg = Config() @@ -17,7 +18,7 @@ ) sentry_sdk.set_tag("app_name", "india_api") -sentry_sdk.set_tag("version",__version__) +sentry_sdk.set_tag("version",version.__version__) match cfg.SOURCE: From 22657fe7a63b703806d644b4462765ec93ce92d4 Mon Sep 17 00:00:00 2001 From: Adimanv Date: Tue, 24 Sep 2024 21:00:10 +0530 Subject: [PATCH 6/8] minor change --- src/india_api/cmd/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/india_api/cmd/main.py b/src/india_api/cmd/main.py index 1c3aa94..f21e718 100644 --- a/src/india_api/cmd/main.py +++ b/src/india_api/cmd/main.py @@ -2,12 +2,12 @@ import uvicorn import sentry_sdk -import version +import version from india_api import internal from india_api.internal.config import Config from india_api.internal.service import get_db_client, server -= + cfg = Config() From f44f6708b315ef0dce8b807bc244d5a3239751ea Mon Sep 17 00:00:00 2001 From: Adimanv Date: Wed, 25 Sep 2024 11:54:00 +0530 Subject: [PATCH 7/8] changes to the import --- src/india_api/cmd/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/india_api/cmd/main.py b/src/india_api/cmd/main.py index f21e718..140ee17 100644 --- a/src/india_api/cmd/main.py +++ b/src/india_api/cmd/main.py @@ -2,11 +2,10 @@ import uvicorn import sentry_sdk -import version from india_api import internal from india_api.internal.config import Config -from india_api.internal.service import get_db_client, server +from india_api.internal.service import get_db_client, server, version cfg = Config() From 7c3891daefbc66d5eee147bc4fac8bddc188f7c7 Mon Sep 17 00:00:00 2001 From: Adimanv Date: Wed, 25 Sep 2024 13:09:04 +0530 Subject: [PATCH 8/8] minor change --- src/india_api/cmd/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/india_api/cmd/main.py b/src/india_api/cmd/main.py index 140ee17..bba3536 100644 --- a/src/india_api/cmd/main.py +++ b/src/india_api/cmd/main.py @@ -17,7 +17,7 @@ ) sentry_sdk.set_tag("app_name", "india_api") -sentry_sdk.set_tag("version",version.__version__) +sentry_sdk.set_tag("version",version) match cfg.SOURCE: