Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter for main already-caught pika errors #606

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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