Skip to content
Snippets Groups Projects
Verified Commit e1ccbedd authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Inject trace ID into HTML to link JavaScript and Python traces

parent 6c3ab3fa
No related branches found
No related tags found
1 merge request!745Resolve "Integrate Sentry for performance and error tracing"
Pipeline #38102 failed
......@@ -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">
......
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment