Skip to content

Commit

Permalink
feat: do not use same Sentry sample rate for debug and prod
Browse files Browse the repository at this point in the history
  • Loading branch information
bolinocroustibat committed Jul 12, 2024
1 parent 1aff828 commit 056d103
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions udata/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def init_app(app: UDataApp):
for exception in IGNORED_EXCEPTIONS:
exceptions.add(exception)

sentry_sample_rate: float = 0.1
if app.config.get('DEBUG'):
sentry_sample_rate = 1.0

sentry_sdk.init(
dsn=app.config['SENTRY_PUBLIC_DSN'],
integrations=[FlaskIntegration(), CeleryIntegration()],
Expand All @@ -70,11 +74,11 @@ def init_app(app: UDataApp):
environment=app.config['SITE_ID'],
# 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,
# Sentry recommends adjusting this value in production.
traces_sample_rate=sentry_sample_rate,
# Experimental profiling
_experiments={
'profiles_sample_rate': 1.0,
'profiles_sample_rate': sentry_sample_rate,
},
)

Expand Down

0 comments on commit 056d103

Please sign in to comment.