diff --git a/daiv/daiv/settings/components/sentry.py b/daiv/daiv/settings/components/sentry.py index bf2aca4e..8828f396 100644 --- a/daiv/daiv/settings/components/sentry.py +++ b/daiv/daiv/settings/components/sentry.py @@ -8,13 +8,13 @@ SENTRY_DSN = get_docker_secret("SENTRY_DSN") SENTRY_DEBUG = config("SENTRY_DEBUG", cast=bool, default=False) -SENTRY_ENABLE_TRACING = config("SENTRY_ENABLE_TRACING", cast=bool, default=False) +SENTRY_ENABLE_LOGS = config("SENTRY_ENABLE_LOGS", cast=bool, default=False) +SENTRY_TRACES_SAMPLE_RATE = config("SENTRY_TRACES_SAMPLE_RATE", cast=float, default=0.0) +SENTRY_PROFILES_SAMPLE_RATE = config("SENTRY_PROFILES_SAMPLE_RATE", cast=float, default=0.0) +SENTRY_SEND_DEFAULT_PII = config("SENTRY_SEND_DEFAULT_PII", cast=bool, default=False) if SENTRY_DSN: import sentry_sdk - from sentry_sdk.integrations.django import DjangoIntegration - from sentry_sdk.integrations.logging import LoggingIntegration - from sentry_sdk.integrations.redis import RedisIntegration sentry_sdk.init( ignore_errors=[DisallowedHost, KeyboardInterrupt], @@ -22,10 +22,11 @@ release=__version__, environment=ENVIRONMENT, debug=SENTRY_DEBUG, - enable_tracing=SENTRY_ENABLE_TRACING, - profiles_sample_rate=1.0 if SENTRY_ENABLE_TRACING else 0.0, + enable_logs=SENTRY_ENABLE_LOGS, + traces_sample_rate=SENTRY_TRACES_SAMPLE_RATE, + profiles_sample_rate=SENTRY_PROFILES_SAMPLE_RATE, + send_default_pii=SENTRY_SEND_DEFAULT_PII, server_name=config("NODE_HOSTNAME", default=None), - integrations=[DjangoIntegration(), LoggingIntegration(), RedisIntegration()], ) if SERVICE_NAME := config("SERVICE_NAME", default=None): diff --git a/docs/configuration/env-config.md b/docs/configuration/env-config.md index 7519fdc5..52b7622a 100644 --- a/docs/configuration/env-config.md +++ b/docs/configuration/env-config.md @@ -58,7 +58,10 @@ Variables marked with: |-------------------------|------------------------------------|:--------------:|-----------------| | `SENTRY_DSN` :material-lock: | Sentry DSN | *(none)* | | | `SENTRY_DEBUG` | Enable Sentry debug mode | `False` | `True` | -| `SENTRY_ENABLE_TRACING` | Enable Sentry tracing | `False` | `True` | +| `SENTRY_ENABLE_LOGS` | Enable Sentry logs | `False` | `True` | +| `SENTRY_TRACES_SAMPLE_RATE` | Sentry traces sample rate | `0.0` | `1.0` | +| `SENTRY_PROFILES_SAMPLE_RATE` | Sentry profiles sample rate | `0.0` | `1.0` | +| `SENTRY_SEND_DEFAULT_PII` | Enable Sentry default PII | `False` | `True` | | `NODE_HOSTNAME` | Node hostname for Sentry | *(none)* | | | `SERVICE_NAME` | Service name for Sentry | *(none)* | |