2929from sentry_sdk .scope import Scope , should_send_default_pii
3030from sentry_sdk .sessions import track_session
3131from sentry_sdk .traces import (
32- SOURCE_FOR_STYLE as SEGMENT_SOURCE_FOR_STYLE ,
33- )
34- from sentry_sdk .traces import (
32+ SOURCE_FOR_STYLE ,
3533 SegmentNameSource ,
3634 Span ,
3735)
38- from sentry_sdk .tracing import (
39- SOURCE_FOR_STYLE ,
40- TransactionSource ,
41- )
4236from sentry_sdk .utils import (
4337 _get_installed_modules ,
4438 capture_internal_exceptions ,
@@ -354,9 +348,9 @@ def event_processor(
354348 and transaction != _DEFAULT_TRANSACTION_NAME
355349 and transaction_source
356350 in [
357- TransactionSource .COMPONENT ,
358- TransactionSource .ROUTE ,
359- TransactionSource .CUSTOM ,
351+ SegmentNameSource .COMPONENT ,
352+ SegmentNameSource .ROUTE ,
353+ SegmentNameSource .CUSTOM ,
360354 ]
361355 )
362356 if not already_set :
@@ -397,7 +391,7 @@ def _get_transaction_name_and_source(
397391 asgi_scope = asgi_scope , root_path_in_path = self .root_path_in_path
398392 ),
399393 )
400- source = TransactionSource .URL
394+ source = SegmentNameSource .URL
401395
402396 elif transaction_style == "url" :
403397 # FastAPI includes the route object in the scope to let Sentry extract the
@@ -416,11 +410,11 @@ def _get_transaction_name_and_source(
416410 asgi_scope = asgi_scope , root_path_in_path = self .root_path_in_path
417411 ),
418412 )
419- source = TransactionSource .URL
413+ source = SegmentNameSource .URL
420414
421415 if name is None :
422416 name = _DEFAULT_TRANSACTION_NAME
423- source = TransactionSource .ROUTE
417+ source = SegmentNameSource .ROUTE
424418 return name , source
425419
426420 return name , source
@@ -429,7 +423,7 @@ def _get_segment_name_and_source(
429423 self : "SentryAsgiMiddleware" , segment_style : str , asgi_scope : "Any"
430424 ) -> "Tuple[str, str]" :
431425 name = None
432- source = SEGMENT_SOURCE_FOR_STYLE [segment_style ].value
426+ source = SOURCE_FOR_STYLE [segment_style ].value
433427 ty = asgi_scope .get ("type" )
434428
435429 if segment_style == "endpoint" :
0 commit comments