Skip to content

Commit cde1dd1

Browse files
committed
address CR comment
1 parent b25afd0 commit cde1dd1

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

sentry_sdk/integrations/pyramid.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
from sentry_sdk.integrations._wsgi_common import RequestExtractor
99
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
1010
from 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
1214
from 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

0 commit comments

Comments
 (0)