|
15 | 15 | from typing import Any
|
16 | 16 |
|
17 | 17 | # Sentry init and config:
|
18 |
| -# - Specify the DSN via the env var of `SENTRY_DSN`. |
| 18 | +# - If you want to use Sentry, specify the DSN via the env var of `SENTRY_DSN`. |
19 | 19 | # - Useful defaults for a development environment are set below. They can be
|
20 | 20 | # changed by modifying env vars.
|
21 |
| -sentry_sdk.init( |
22 |
| - traces_sample_rate=os.environ.get('SENTRY_TRACES_SAMPLE_RATE', 1.0), |
23 |
| - profiles_sample_rate=os.environ.get('SENTRY_PROFILES_SAMPLE_RATE', 1.0), |
24 |
| - environment=os.environ.get('SENTRY_ENVIRONMENT', 'development'), |
25 |
| - debug=os.environ.get('SENTRY_DEBUG', 'True'), |
26 |
| - attach_stacktrace=os.environ.get('SENTRY_ATTACH_STACKTRACE', 'True') |
27 |
| -) |
| 21 | +from sentry_sdk.integrations.django import DjangoIntegration |
| 22 | +from sentry_sdk.integrations.redis import RedisIntegration |
| 23 | + |
| 24 | +SENTRY_DSN = os.environ.get('SENTRY_DSN') |
| 25 | +if SENTRY_DSN: |
| 26 | + sentry_sdk.init( |
| 27 | + dsn=SENTRY_DSN, |
| 28 | + integrations=[DjangoIntegration(), RedisIntegration(max_data_size=0)], |
| 29 | + traces_sample_rate=os.environ.get('SENTRY_TRACES_SAMPLE_RATE', 1.0), |
| 30 | + profiles_sample_rate=os.environ.get('SENTRY_PROFILES_SAMPLE_RATE', 1.0), |
| 31 | + environment=os.environ.get('SENTRY_ENVIRONMENT', 'development'), |
| 32 | + debug=os.environ.get('SENTRY_DEBUG', 'True'), |
| 33 | + attach_stacktrace=os.environ.get('SENTRY_ATTACH_STACKTRACE', 'True') |
| 34 | + ) |
28 | 35 |
|
29 | 36 |
|
30 | 37 | # Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
0 commit comments