Commit 72c1d07 1 parent 335387f commit 72c1d07 Copy full SHA for 72c1d07
File tree 2 files changed +14
-6
lines changed
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 2
2
Django settings for benefits project.
3
3
"""
4
4
import os
5
+ from benefits import VERSION
5
6
import benefits .logging
6
7
import sentry_sdk
7
8
from sentry_sdk .integrations .django import DjangoIntegration
@@ -233,18 +234,17 @@ def _filter_empty(ls):
233
234
if SENTRY_DSN :
234
235
print ("Enabling Sentry…" )
235
236
237
+ SENTRY_ENVIRONMENT = os .environ .get ("SENTRY_ENVIRONMENT" , "local" )
238
+
239
+ # https://docs.sentry.io/platforms/python/configuration/
236
240
sentry_sdk .init (
237
241
dsn = SENTRY_DSN ,
238
242
integrations = [
239
243
DjangoIntegration (),
240
244
],
241
- # Set traces_sample_rate to 1.0 to capture 100%
242
- # of transactions for performance monitoring.
243
- # We recommend adjusting this value in production.
244
245
traces_sample_rate = 1.0 ,
245
- # If you wish to associate users to errors (assuming you are using
246
- # django.contrib.auth) you may enable sending PII data.
247
- send_default_pii = True ,
246
+ environment = SENTRY_ENVIRONMENT ,
247
+ release = VERSION ,
248
248
)
249
249
else :
250
250
print ("SENTRY_DSN not set, so won't send events" )
Original file line number Diff line number Diff line change @@ -181,3 +181,11 @@ Enables [log collection](../../deployment/troubleshooting/#logs). Set the value
181
181
[Data Source Name (DSN)](https://docs.sentry.io/product/sentry-basics/dsn-explainer/)
182
182
183
183
Enables [ sending events to Sentry] ( ../../deployment/troubleshooting/#error-monitoring ) .
184
+
185
+ ### ` SENTRY_ENVIRONMENT `
186
+
187
+ !!! tldr "Sentry docs"
188
+
189
+ [`environment` config value](https://docs.sentry.io/platforms/python/configuration/options/#environment)
190
+
191
+ Segments errors by which deployment they occur in. This defaults to ` local ` , and can be set to match one of the [ environment names] ( ../../deployment/infrastructure/#environments ) .
You can’t perform that action at this time.
0 commit comments