Skip to content

Commit

Permalink
Fix mozilla#13613: Have Sentry ignore common but non-actionable errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pmac committed Aug 29, 2023
1 parent f450ecc commit 7202584
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bedrock/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,16 +1131,24 @@ def get_default_gateway_linux():

# SENTRY CONFIG
SENTRY_DSN = config("SENTRY_DSN", default="")

# Data scrubbing before Sentry
# https://github.com/laiyongtao/sentry-processor
SENSITIVE_FIELDS_TO_MASK_ENTIRELY = [
"email",
# "token", # token is on the default blocklist, which we also use via `with_default_keys`
]
SENTRY_IGNORE_ERRORS = (
BrokenPipeError,
ConnectionResetError,
)


def before_send(event, hint):
if "exc_info" in hint:
exc_type, exc_value, tb = hint["exc_info"]
if isinstance(exc_value, SENTRY_IGNORE_ERRORS):
return None

processor = DesensitizationProcessor(
with_default_keys=True,
sensitive_keys=SENSITIVE_FIELDS_TO_MASK_ENTIRELY,
Expand Down

0 comments on commit 7202584

Please sign in to comment.