Skip to content

Commit

Permalink
✨(dashboard) add Sentry sampling rate configuration for traces and pr…
Browse files Browse the repository at this point in the history
…ofiles

Introduce environment variables `DASHBOARD_SENTRY_TRACES_SAMPLE_RATE` and `DASHBOARD_SENTRY_PROFILES_SAMPLE_RATE` to manage sampling rates for Sentry traces and profiles.
  • Loading branch information
ssorin committed Jan 6, 2025
1 parent 4d8f78d commit 3733333
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion env.d/dashboard
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ DASHBOARD_SECRET_KEY=the_secret_key
DASHBOARD_DB_NAME=qualicharge-dashboard
DASHBOARD_DATABASE_URL=psql://qualicharge:pass@postgresql:5432/qualicharge-dashboard

# tools
# Third-party integrations
DASHBOARD_SENTRY_DSN=
DASHBOARD_SENTRY_TRACES_SAMPLE_RATE=1.0
DASHBOARD_SENTRY_PROFILES_SAMPLE_RATE=1.0

# superuser
DJANGO_SUPERUSER_PASSWORD=admin
DJANGO_SUPERUSER_USERNAME=admin
[email protected]

9 changes: 8 additions & 1 deletion src/dashboard/dashboard/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
DASHBOARD_DEBUG=(bool, False),
DASHBOARD_ALLOWED_HOSTS=(list, ["localhost"]),
DASHBOARD_SENTRY_DSN=(str, ""),
DASHBOARD_SENTRY_TRACES_SAMPLE_RATE=(float, 1.0),
DASHBOARD_SENTRY_PROFILES_SAMPLE_RATE=(float, 1.0),
)
env.prefix = "DASHBOARD_"

Expand Down Expand Up @@ -168,7 +170,12 @@
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
traces_sample_rate=1.0,
traces_sample_rate=env.float("SENTRY_TRACES_SAMPLE_RATE"),
# To set a uniform sample rate
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production
profiles_sample_rate=env.float("SENTRY_PROFILES_SAMPLE_RATE"),
# If you wish to associate users to errors (assuming you are using
# django.contrib.auth) you may enable sending PII data.
send_default_pii=True,
Expand Down

0 comments on commit 3733333

Please sign in to comment.