Skip to content
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: 17 additions & 1 deletion backend/pennmobile/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sentry_sdk
from sentry_sdk.integrations.celery import CeleryIntegration
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.types import Event, Hint

from pennmobile.settings.base import * # noqa: F401, F403
from pennmobile.settings.base import DOMAINS, REDIS_URL
Expand All @@ -21,7 +22,22 @@

# Sentry settings
SENTRY_URL = os.environ.get("SENTRY_URL", "")
sentry_sdk.init(dsn=SENTRY_URL, integrations=[CeleryIntegration(), DjangoIntegration()])


def before_send(event: Event, hint: Hint | None) -> Event | None:
logentry = event.get("logentry")
if isinstance(logentry, dict):
message = logentry.get("message")
if isinstance(message, str) and "Wharton: Error 403 when reserving data" in message:
return None
return event


sentry_sdk.init(
dsn=SENTRY_URL,
integrations=[CeleryIntegration(), DjangoIntegration()],
before_send=before_send,
)

# DLA settings
PLATFORM_ACCOUNTS = {"ADMIN_PERMISSION": "penn_mobile_admin"}
Expand Down
Loading