From c7477bcc06d501963f6677c0d9cfeb24b10f023e Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Tue, 8 Sep 2026 23:20:36 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(backend)=20allow=20configuring=20trac?= =?UTF-8?q?e=20sampling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a configuration knob for the trace sampling rate, so we can enable tracing on middleware and cache spans when debugging slow requests in production. Sampling is set to 0 by default, so tracing stays fully off unless explicitly enabled. --- src/backend/meet/settings.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/backend/meet/settings.py b/src/backend/meet/settings.py index d434a554..ed8c65ad 100755 --- a/src/backend/meet/settings.py +++ b/src/backend/meet/settings.py @@ -469,6 +469,9 @@ class Base(Configuration): # Sentry SENTRY_DSN = values.Value(None, environ_name="SENTRY_DSN") + SENTRY_TRACES_SAMPLE_RATE = values.FloatValue( + 0.0, environ_name="SENTRY_TRACES_SAMPLE_RATE", environ_prefix=None + ) # Easy thumbnails THUMBNAIL_EXTENSION = "webp" @@ -1211,7 +1214,14 @@ class Base(Configuration): dsn=cls.SENTRY_DSN, environment=cls.__name__.lower(), # build, test, development, production release=get_release(), - integrations=[DjangoIntegration()], + traces_sample_rate=cls.SENTRY_TRACES_SAMPLE_RATE, + integrations=[ + DjangoIntegration( + transaction_style="url", + middleware_spans=True, + cache_spans=True, + ) + ], ) sentry_sdk.set_tag("application", "backend")