numerique-gouv / people

Teams management application
MIT License
13 stars 1 forks source link

🔧(sentry) restore default integrations #488

Closed mjeammet closed 4 weeks ago

mjeammet commented 4 weeks ago

Purpose

a previous commit turned sentry's default_integrations to false to remove duplicates on monitored issues. Thing is, duplicates were appearing because we actually logged + raised the issue where only one of these methods is necessary. Better restore Sentry's default parameters and try to clean our code of duplicate logging

Proposal

qbey commented 4 weeks ago

@mjeammet I've finally understood what the problem is (thanks to @NathanVss 's help).

We use the DockerflowMiddleware whose job is precisely to add a log for each request. So we there is an exception, we catch it and the middleware also adds a log : twice in Sentry.

I think the proper solution is to ignore the request.summary logger with:

from sentry_sdk.integrations.logging import ignore_logger

#...

sentry_sdk.init(
    # ...
)

# Ignore the logs added by the DockerflowMiddleware
ignore_logger("request.summary")

With that, we won't have duplicated logs anymore and we will be able to keep the default integrations :)