diff --git a/aleksis/core/templates/core/base.html b/aleksis/core/templates/core/base.html index c7d07f2de69ee383a1f9b538344b6827961d33a7..65e16804897cdabfff3d992cc48bcef3dcc5102d 100644 --- a/aleksis/core/templates/core/base.html +++ b/aleksis/core/templates/core/base.html @@ -36,6 +36,9 @@ type="text/javascript"></script> {% if SENTRY_ENABLED %} + {% if SENTRY_TRACE_ID %} + <meta name="sentry-trace" content="{{ SENTRY_TRACE_ID }}" /> + {% endif %} {% include_js "Sentry" %} {{ SENTRY_SETTINGS|json_script:"sentry_settings" }} <script type="text/javascript"> diff --git a/aleksis/core/util/core_helpers.py b/aleksis/core/util/core_helpers.py index 72b4f90a2b642490f1e2123dcb24a9b1d41182d7..b9fb898abb7822684583dc2ba8ba8f6bd5b60eb0 100644 --- a/aleksis/core/util/core_helpers.py +++ b/aleksis/core/util/core_helpers.py @@ -218,6 +218,11 @@ def custom_information_processor(request: HttpRequest) -> dict: if settings.SENTRY_ENABLED: context["SENTRY_SETTINGS"] = settings.SENTRY_SETTINGS + import sentry_sdk + span = sentry_sdk.Hub.current.scope.span + if span is not None: + context["SENTRY_TRACE_ID"] = span.to_traceparent() + return context def now_tomorrow() -> datetime: