From 60a66e878356b349eb4ba5f09bf28020607f8f57 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Tue, 12 Nov 2024 13:00:24 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=90(backend)=20adapt=20Sentry=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We add SENTRY_ENV var, to be able to distinguish errors between different environments in Sentry (staging / preprod / prod). --- env.d/development/common.dist | 3 +++ src/backend/impress/settings.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/env.d/development/common.dist b/env.d/development/common.dist index 97b8e08a..a0232130 100644 --- a/env.d/development/common.dist +++ b/env.d/development/common.dist @@ -44,3 +44,6 @@ OIDC_AUTH_REQUEST_EXTRA_PARAMS={"acr_values": "eidas1"} AI_BASE_URL=https://openaiendpoint.com AI_API_KEY=password AI_MODEL=llama + +# Sentry +SENTRY_ENV=development diff --git a/src/backend/impress/settings.py b/src/backend/impress/settings.py index 93c70ac9..cbdde169 100755 --- a/src/backend/impress/settings.py +++ b/src/backend/impress/settings.py @@ -372,7 +372,8 @@ class Base(Configuration): CORS_ALLOWED_ORIGIN_REGEXES = values.ListValue([]) # Sentry - SENTRY_DSN = values.Value(None, environ_name="SENTRY_DSN") + SENTRY_DSN = values.Value(None, environ_name="SENTRY_DSN", environ_prefix=None) + SENTRY_ENV = values.Value(None, environ_name="SENTRY_ENV", environ_prefix=None) # Easy thumbnails THUMBNAIL_EXTENSION = "webp" @@ -524,7 +525,7 @@ class Base(Configuration): if cls.SENTRY_DSN is not None: sentry_sdk.init( dsn=cls.SENTRY_DSN, - environment=cls.__name__.lower(), + environment=cls.SENTRY_ENV or cls.__name__.lower(), release=get_release(), integrations=[DjangoIntegration()], )