3131 SOURCE_FOR_STYLE as SEGMENT_SOURCE_FOR_STYLE ,
3232)
3333from sentry_sdk .traces import (
34- SegmentSource ,
34+ SegmentNameSource ,
3535 StreamedSpan ,
3636)
3737from sentry_sdk .tracing import (
@@ -246,7 +246,7 @@ async def _run_app(
246246 if span_streaming :
247247 segment : "Optional[StreamedSpan]" = None
248248 attributes : "Attributes" = {
249- "sentry.span .source" : getattr (
249+ "sentry.segment.name .source" : getattr (
250250 transaction_source , "value" , transaction_source
251251 ),
252252 "sentry.origin" : self .span_origin ,
@@ -384,11 +384,13 @@ async def _sentry_wrapped_send(
384384 already_set = (
385385 span is not None
386386 and span .name != _DEFAULT_TRANSACTION_NAME
387- and span .get_attributes ().get ("sentry.span.source" )
387+ and span .get_attributes ().get (
388+ "sentry.segment.name.source"
389+ )
388390 in [
389- SegmentSource .COMPONENT .value ,
390- SegmentSource .ROUTE .value ,
391- SegmentSource .CUSTOM .value ,
391+ SegmentNameSource .COMPONENT .value ,
392+ SegmentNameSource .ROUTE .value ,
393+ SegmentNameSource .CUSTOM .value ,
392394 ]
393395 )
394396 with capture_internal_exceptions ():
@@ -399,7 +401,9 @@ async def _sentry_wrapped_send(
399401 )
400402 )
401403 span .name = name
402- span .set_attribute ("sentry.span.source" , source )
404+ span .set_attribute (
405+ "sentry.segment.name.source" , source
406+ )
403407 finally :
404408 _asgi_middleware_applied .set (False )
405409
@@ -514,7 +518,7 @@ def _get_segment_name_and_source(
514518 asgi_scope = asgi_scope , root_path_in_path = self .root_path_in_path
515519 ),
516520 )
517- source = SegmentSource .URL .value
521+ source = SegmentNameSource .URL .value
518522
519523 elif segment_style == "url" :
520524 # FastAPI includes the route object in the scope to let Sentry extract the
@@ -533,11 +537,11 @@ def _get_segment_name_and_source(
533537 asgi_scope = asgi_scope , root_path_in_path = self .root_path_in_path
534538 ),
535539 )
536- source = SegmentSource .URL .value
540+ source = SegmentNameSource .URL .value
537541
538542 if name is None :
539543 name = _DEFAULT_TRANSACTION_NAME
540- source = SegmentSource .ROUTE .value
544+ source = SegmentNameSource .ROUTE .value
541545 return name , source
542546
543547 return name , source
0 commit comments