Browse Source

fix(sentry): disable error reporting in development, enable only in production

- Remove sentry_sdk import and sentry_sdk.init() from base.py so that
  development (develop.py) and test (test.py) environments no longer
  send errors to Sentry
- Add sentry_sdk.init() exclusively to production.py with environment=production
  so production errors are correctly tagged and dev noise is eliminated
- Add traces_sample_rate comment placeholder for future performance monitoring
master
Mohsen Taba 2 weeks ago
parent
commit
cd554e4fb9
  1. 6
      config/settings/base.py
  2. 12
      config/settings/production.py

6
config/settings/base.py

@ -16,7 +16,6 @@ from django.urls import reverse_lazy
import environ
from django.utils.translation import gettext_lazy as _
import sentry_sdk
env = environ.Env(
@ -826,10 +825,7 @@ UNFOLD_STUDIO_PERMISSION = lambda request: request.user.is_authenticated
PLAUSIBLE_DOMAIN = env("PLAUSIBLE_DOMAIN")
sentry_sdk.init(
dsn="https://31aaeeb3a42f9a8c1b26272a0cb8ad3e@o4507991743725568.ingest.us.sentry.io/4511127356768256",
send_default_pii=True,
)
# Sentry is configured only in production.py – not here.
INTERNAL_WEBHOOK_SECRET = env('INTERNAL_WEBHOOK_SECRET', default='super-secret-key-12345')

12
config/settings/production.py

@ -1,10 +1,20 @@
# import sentry_sdk
import sentry_sdk
from .base import *
from celery.schedules import crontab
DEBUG = False
# -----------------------------------------------------------------------
# Sentry – only active in production (not in develop/test environments)
# -----------------------------------------------------------------------
sentry_sdk.init(
dsn="https://31aaeeb3a42f9a8c1b26272a0cb8ad3e@o4507991743725568.ingest.us.sentry.io/4511127356768256",
send_default_pii=True,
environment="production",
# traces_sample_rate=0.2, # uncomment to enable performance tracing
)
#It is currently active
CORS_ALLOW_ALL_ORIGINS = True

Loading…
Cancel
Save