From 4a326a0d698d5ebf444146c7bb63a5b9da979f4f Mon Sep 17 00:00:00 2001 From: Adimanv Date: Mon, 23 Sep 2024 12:32:21 +0530 Subject: [PATCH 1/2] Sentry update to the code --- gspconsumer/app.py | 9 +++++++++ requirements.txt | 1 + 2 files changed, 10 insertions(+) diff --git a/gspconsumer/app.py b/gspconsumer/app.py index e2ca202..7424308 100644 --- a/gspconsumer/app.py +++ b/gspconsumer/app.py @@ -10,6 +10,7 @@ import os from datetime import datetime, timedelta, timezone from typing import List, Optional +import sentry_sdk import click import pandas as pd @@ -30,6 +31,14 @@ ) logger = logging.getLogger(__name__) +sentry_sdk.init( + dsn=os.getenv("SENTRY_DSN"), + environment=os.getenv("ENVIRONMENT", "local"), + traces_sample_rate=1 +) + +sentry_sdk.set_tag("app_name", "GSP_consumer") +sentry_sdk.set_tag("version", gspconsumer.__version__) @click.command() @click.option( diff --git a/requirements.txt b/requirements.txt index 0374f5e..b7cae9a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,6 @@ pyyaml urllib3 requests nowcasting_datamodel==1.5.46 +sentry-sdk==2.13.0 #git+https://github.com/SheffieldSolar/PV_Live-API#pvlive_api click From e076ba5a5c90ae901572d710ba1839b3fdc2fbc9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 07:05:20 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- gspconsumer/app.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gspconsumer/app.py b/gspconsumer/app.py index 7424308..d885131 100644 --- a/gspconsumer/app.py +++ b/gspconsumer/app.py @@ -10,10 +10,10 @@ import os from datetime import datetime, timedelta, timezone from typing import List, Optional -import sentry_sdk import click import pandas as pd +import sentry_sdk from nowcasting_datamodel.connection import DatabaseConnection from nowcasting_datamodel.models.base import Base_Forecast from nowcasting_datamodel.models.gsp import GSPYield, GSPYieldSQL, LocationSQL @@ -32,14 +32,13 @@ logger = logging.getLogger(__name__) sentry_sdk.init( - dsn=os.getenv("SENTRY_DSN"), - environment=os.getenv("ENVIRONMENT", "local"), - traces_sample_rate=1 + dsn=os.getenv("SENTRY_DSN"), environment=os.getenv("ENVIRONMENT", "local"), traces_sample_rate=1 ) sentry_sdk.set_tag("app_name", "GSP_consumer") sentry_sdk.set_tag("version", gspconsumer.__version__) + @click.command() @click.option( "--db-url",