File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88from sentry_sdk .integrations ._wsgi_common import RequestExtractor
99from sentry_sdk .integrations .wsgi import SentryWsgiMiddleware
1010from sentry_sdk .scope import should_send_default_pii
11- from sentry_sdk .tracing import SOURCE_FOR_STYLE
11+ from sentry_sdk .traces import SOURCE_FOR_STYLE as SEGMENT_SOURCE_FOR_STYLE
12+ from sentry_sdk .tracing import SOURCE_FOR_STYLE as TRANSACTION_SOURCE_FOR_STYLE
13+ from sentry_sdk .tracing_utils import has_span_streaming_enabled
1214from sentry_sdk .utils import (
1315 capture_internal_exceptions ,
1416 ensure_integration_enabled ,
@@ -157,9 +159,17 @@ def _set_transaction_name_and_source(
157159 "route_name" : request .matched_route .name ,
158160 "route_pattern" : request .matched_route .pattern ,
159161 }
162+ is_span_streaming_enabled = has_span_streaming_enabled (
163+ sentry_sdk .get_client ().options
164+ )
165+ source = (
166+ SEGMENT_SOURCE_FOR_STYLE [transaction_style ]
167+ if is_span_streaming_enabled
168+ else TRANSACTION_SOURCE_FOR_STYLE [transaction_style ]
169+ )
160170 scope .set_transaction_name (
161171 name_for_style [transaction_style ],
162- source = SOURCE_FOR_STYLE [ transaction_style ] ,
172+ source = source ,
163173 )
164174 except Exception :
165175 pass
You can’t perform that action at this time.
0 commit comments