mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Sentry: Add trace tokens
This commit is contained in:
@@ -351,6 +351,7 @@ application. If you want to use sentry, you need to set a DSN in the configurati
|
|||||||
[sentry]
|
[sentry]
|
||||||
dsn=https://<key>:<secret>@sentry.io/<project>
|
dsn=https://<key>:<secret>@sentry.io/<project>
|
||||||
traces_sample_rate=0.5
|
traces_sample_rate=0.5
|
||||||
|
traces_sample_token=xyz
|
||||||
|
|
||||||
``dsn``
|
``dsn``
|
||||||
You will be given this value by your sentry installation.
|
You will be given this value by your sentry installation.
|
||||||
@@ -358,6 +359,9 @@ application. If you want to use sentry, you need to set a DSN in the configurati
|
|||||||
``traces_sample_rate``
|
``traces_sample_rate``
|
||||||
Sample rate for performance monitoring.
|
Sample rate for performance monitoring.
|
||||||
|
|
||||||
|
``traces_sample_token``
|
||||||
|
If this token is found in a query string, a trace will always be sampled.
|
||||||
|
|
||||||
|
|
||||||
Caching
|
Caching
|
||||||
-------
|
-------
|
||||||
|
|||||||
@@ -712,6 +712,14 @@ if config.has_option('sentry', 'dsn') and not any(c in sys.argv for c in ('shell
|
|||||||
|
|
||||||
from .sentry import PretixSentryIntegration, setup_custom_filters
|
from .sentry import PretixSentryIntegration, setup_custom_filters
|
||||||
|
|
||||||
|
SENTRY_TOKEN = config.get('sentry', 'traces_sample_token', fallback='')
|
||||||
|
|
||||||
|
def traces_sampler(sampling_context):
|
||||||
|
qs = sampling_context.get('wsgi_environ', {}).get('QUERY_STRING', '')
|
||||||
|
if SENTRY_TOKEN and SENTRY_TOKEN in qs:
|
||||||
|
return 1.0
|
||||||
|
return config.getfloat('sentry', 'traces_sample_rate', fallback=0.0)
|
||||||
|
|
||||||
SENTRY_ENABLED = True
|
SENTRY_ENABLED = True
|
||||||
sentry_sdk.init(
|
sentry_sdk.init(
|
||||||
dsn=config.get('sentry', 'dsn'),
|
dsn=config.get('sentry', 'dsn'),
|
||||||
@@ -723,7 +731,7 @@ if config.has_option('sentry', 'dsn') and not any(c in sys.argv for c in ('shell
|
|||||||
event_level=logging.CRITICAL
|
event_level=logging.CRITICAL
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
traces_sample_rate=config.getfloat('sentry', 'traces_sample_rate', fallback=0.0),
|
traces_sampler=traces_sampler,
|
||||||
environment=urlparse(SITE_URL).netloc,
|
environment=urlparse(SITE_URL).netloc,
|
||||||
release=__version__,
|
release=__version__,
|
||||||
send_default_pii=False,
|
send_default_pii=False,
|
||||||
|
|||||||
Reference in New Issue
Block a user