From 283c77c6271e0b742e935bc42548d04a40e20f70 Mon Sep 17 00:00:00 2001 From: Marie PUPO JEAMMET Date: Wed, 4 Sep 2024 18:00:39 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=88(monitoring)=20configure=20sentry?= =?UTF-8?q?=20dsn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit configure sentry dsn to monitor errors in sentry --- CHANGELOG.md | 4 ++++ src/backend/people/settings.py | 5 +++++ src/backend/pyproject.toml | 2 +- src/helm/env.d/dev/values.desk.yaml.gotmpl | 1 + src/helm/env.d/preprod/values.desk.yaml.gotmpl | 1 + src/helm/env.d/production/values.desk.yaml.gotmpl | 1 + src/helm/env.d/staging/values.desk.yaml.gotmpl | 2 +- 7 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 245bc3945..eebd18e7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to ## [Unreleased] +### Added + +- 📈(monitoring) configure sentry monitoring #378 + ### Fixed - 🐛(dimail) improve handling of dimail errors on failed mailbox creation #377 diff --git a/src/backend/people/settings.py b/src/backend/people/settings.py index 2a29190a9..8ba2f46cc 100755 --- a/src/backend/people/settings.py +++ b/src/backend/people/settings.py @@ -473,6 +473,7 @@ def post_setup(cls): environment=cls.__name__.lower(), release=get_release(), integrations=[DjangoIntegration()], + traces_sample_rate=1.0, ) with sentry_sdk.configure_scope() as scope: scope.set_extra("application", "backend") @@ -654,6 +655,10 @@ class Production(Base): }, }, } + SENTRY_DSN = values.Value( + "https://b72746c73d669421e7a8ccd3fab0fad2@sentry.incubateur.net/171", + environ_name="SENTRY_DSN", + ) class Feature(Production): diff --git a/src/backend/pyproject.toml b/src/backend/pyproject.toml index 8bef09380..cb4daee79 100644 --- a/src/backend/pyproject.toml +++ b/src/backend/pyproject.toml @@ -49,7 +49,7 @@ dependencies = [ "PyJWT==2.9.0", "joserfc==1.0.0", "requests==2.32.3", - "sentry-sdk==2.13.0", + "sentry-sdk[django]==2.13.0", "url-normalize==1.4.3", "whitenoise==6.7.0", "mozilla-django-oidc==4.0.1", diff --git a/src/helm/env.d/dev/values.desk.yaml.gotmpl b/src/helm/env.d/dev/values.desk.yaml.gotmpl index 6b4587ca3..85b000d74 100644 --- a/src/helm/env.d/dev/values.desk.yaml.gotmpl +++ b/src/helm/env.d/dev/values.desk.yaml.gotmpl @@ -51,6 +51,7 @@ backend: POSTGRES_PASSWORD: pass REDIS_URL: redis://default:pass@redis-master:6379/1 MAIL_PROVISIONING_API_URL: "http://host.docker.internal:8000" + SENTRY_DSN: "https://b72746c73d669421e7a8ccd3fab0fad2@sentry.incubateur.net/171" command: - "gunicorn" - "-c" diff --git a/src/helm/env.d/preprod/values.desk.yaml.gotmpl b/src/helm/env.d/preprod/values.desk.yaml.gotmpl index 8d2148422..f2b8ea206 100644 --- a/src/helm/env.d/preprod/values.desk.yaml.gotmpl +++ b/src/helm/env.d/preprod/values.desk.yaml.gotmpl @@ -86,6 +86,7 @@ backend: key: url MAIL_PROVISIONING_API_URL: "https://api.dev.ox.numerique.gouv.fr" FEATURE_TEAMS: False + SENTRY_DSN: "https://b72746c73d669421e7a8ccd3fab0fad2@sentry.incubateur.net/171" createsuperuser: command: diff --git a/src/helm/env.d/production/values.desk.yaml.gotmpl b/src/helm/env.d/production/values.desk.yaml.gotmpl index 76e270ff2..7d0f9b7b2 100644 --- a/src/helm/env.d/production/values.desk.yaml.gotmpl +++ b/src/helm/env.d/production/values.desk.yaml.gotmpl @@ -86,6 +86,7 @@ backend: key: url MAIL_PROVISIONING_API_URL: "https://api.dev.ox.numerique.gouv.fr" FEATURE_TEAMS: False + SENTRY_DSN: "https://b72746c73d669421e7a8ccd3fab0fad2@sentry.incubateur.net/171" createsuperuser: command: diff --git a/src/helm/env.d/staging/values.desk.yaml.gotmpl b/src/helm/env.d/staging/values.desk.yaml.gotmpl index 9a15563e9..2f7d39268 100644 --- a/src/helm/env.d/staging/values.desk.yaml.gotmpl +++ b/src/helm/env.d/staging/values.desk.yaml.gotmpl @@ -99,7 +99,7 @@ backend: name: redis.redis.libre.sh key: url MAIL_PROVISIONING_API_URL: "https://api.dev.ox.numerique.gouv.fr" - + SENTRY_DSN: "https://b72746c73d669421e7a8ccd3fab0fad2@sentry.incubateur.net/171" createsuperuser: command: