diff --git a/greenweb/settings/production.py b/greenweb/settings/production.py index 474f71cb..dcf28536 100644 --- a/greenweb/settings/production.py +++ b/greenweb/settings/production.py @@ -58,6 +58,23 @@ # https://docs.sentry.io/platforms/python/guides/django/performance/ sentry_sample_rate = os.environ.get("SENTRY_SAMPLE_RATE", 0) # noqa + +def filter_sentry(event, hint): + """ + Filter out noisy errors from pika, the underlying + rabbitmq library that we know are caught by Dramatiq and retried + """ + + if 'logger' in event and event['logger'] in [ + 'pika.adapters.blocking_connection', + 'pika.adapters.base_connection', + 'pika.adapters.utils.io_services_utils' + ]: + return None + + return event + + if SENTRY_DSN: sentry_sdk.init( # set our identifying credentials @@ -72,6 +89,7 @@ # to see who is having a bad day, so we can contact them and # at least apologise about the broken site send_default_pii=True, + before_send=filter_sentry, )