Skip to content

Commit

Permalink
Updated flask to use trace_propagation_meta
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Jun 27, 2023
1 parent 96c8d65 commit 97b1cc8
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions sentry_sdk/integrations/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sentry_sdk.integrations._wsgi_common import RequestExtractor
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
from sentry_sdk.scope import Scope
from sentry_sdk.tracing import SENTRY_TRACE_HEADER_NAME, SOURCE_FOR_STYLE
from sentry_sdk.tracing import SOURCE_FOR_STYLE
from sentry_sdk.utils import (
capture_internal_exceptions,
event_from_exception,
Expand Down Expand Up @@ -93,22 +93,11 @@ def sentry_patched_wsgi_app(self, environ, start_response):

def _add_sentry_trace(sender, template, context, **extra):
# type: (Flask, Any, Dict[str, Any], **Any) -> None

if "sentry_trace" in context:
return

sentry_span = Hub.current.scope.span
context["sentry_trace"] = (
Markup(
'<meta name="%s" content="%s" />'
% (
SENTRY_TRACE_HEADER_NAME,
sentry_span.to_traceparent(),
)
)
if sentry_span
else ""
)
hub = Hub.current
context["sentry_trace"] = Markup(hub.trace_propagation_meta())


def _set_transaction_name_and_source(scope, transaction_style, request):
Expand Down

0 comments on commit 97b1cc8

Please sign in to comment.