From 54e5be81e275abaa8421043362fc324d41acd54d Mon Sep 17 00:00:00 2001 From: Quentin BEY Date: Fri, 25 Oct 2024 13:18:57 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=87(backend)=20remove=20Sentry=20dupli?= =?UTF-8?q?cated=20warning/errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `DockerflowMiddleware` job is to add logs, sadly the Sentry LoggingIntegration also catch these logs (at level WARNING and above) which results in an extra alert for the same purpose (the exception + the logger.error). see https://github.com/mozilla-services/Dockerflow/blob/main/docs/mozlog.md The fix is to ask Sentry to ignore this specific loggger (`request.summary`). --- CHANGELOG.md | 3 +++ src/backend/people/settings.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e0bafd..9af55cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,10 @@ and this project adheres to ## [Unreleased] +### Fixed + - 🔧(sentry) restore default integrations +- 🔇(backend) remove Sentry duplicated warning/errors - 👷(ci) add sharding e2e tests #467 ## [1.4.1] - 2024-10-23 diff --git a/src/backend/people/settings.py b/src/backend/people/settings.py index 1d1bbbf..05e551f 100755 --- a/src/backend/people/settings.py +++ b/src/backend/people/settings.py @@ -18,6 +18,7 @@ from django.utils.translation import gettext_lazy as _ import sentry_sdk from configurations import Configuration, values from sentry_sdk.integrations.django import DjangoIntegration +from sentry_sdk.integrations.logging import ignore_logger # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -492,6 +493,9 @@ class Base(Configuration): with sentry_sdk.configure_scope() as scope: scope.set_extra("application", "backend") + # Ignore the logs added by the DockerflowMiddleware + ignore_logger("request.summary") + class Build(Base): """Settings used when the application is built.