Skip to content

Commit

Permalink
Add filter for main already-caught pika errors
Browse files Browse the repository at this point in the history
These are already caught by Dramatiq, and retried
  • Loading branch information
mrchrisadams committed Jul 1, 2024
1 parent 9c61825 commit ae64817
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions greenweb/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
)


Expand Down

0 comments on commit ae64817

Please sign in to comment.