Last active
July 21, 2021 19:37
-
-
Save axolx/3fe964f719fd833f454e596c561c511f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/services/web/src/website/settings/base.py b/services/web/src/website/settings/base.py | |
index 25bb9c96..47edb55b 100644 | |
--- a/services/web/src/website/settings/base.py | |
+++ b/services/web/src/website/settings/base.py | |
@@ -569,9 +569,21 @@ if os.getenv("SENTRY_DSN"): | |
return None | |
return event | |
+ # Set up Sentry distributed tracing | |
+ # see https://docs.sentry.io/platforms/python/performance/ | |
+ sentry_traces_sample_rates = {"test": 0.5, "stage": 0.5, "prod": 0.1} | |
+ | |
+ try: | |
+ sentry_traces_sample_rate = sentry_traces_sample_rates[ | |
+ os.environ["ENVIRONMENT_TYPE"] | |
+ ] | |
+ except KeyError: | |
+ sentry_traces_sample_rate = 0 | |
+ | |
sentry_sdk.init( | |
dsn=os.environ["SENTRY_DSN"], | |
send_default_pii=True, | |
integrations=[DjangoIntegration()], | |
before_send=sentry_before_send, | |
+ traces_sample_rate=sentry_traces_sample_rate, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment