@@ -70,6 +70,14 @@ export function captureSpan(span: Span, client: Client): SerializedStreamedSpanW
7070 ? applyBeforeSendSpanCallback ( spanJSON , beforeSendSpan )
7171 : spanJSON ;
7272
73+ // Backfill span data from OTel semantic conventions when not explicitly set.
74+ // OTel-originated spans don't have sentry.op, description, etc. — the non-streamed path
75+ // infers these in the SentrySpanExporter, but streamed spans skip the exporter entirely.
76+ // Access `kind` via duck-typing — OTel span objects have this property but it's not on Sentry's Span type.
77+ // This must run before the sentry.span.source backfill below, so that inferred sentry.source is picked up.
78+ const spanKind = ( span as { kind ?: number } ) . kind ;
79+ inferSpanDataFromOtelAttributes ( processedSpan , spanKind ) ;
80+
7381 // Backfill sentry.span.source from sentry.source. Only `sentry.span.source` is respected by Sentry.
7482 // TODO(v11): Remove this backfill once we renamed SEMANTIC_ATTRIBUTE_SENTRY_SOURCE to sentry.span.source
7583 const spanNameSource = processedSpan . attributes ?. [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] ;
@@ -81,13 +89,6 @@ export function captureSpan(span: Span, client: Client): SerializedStreamedSpanW
8189 } ) ;
8290 }
8391
84- // Backfill span data from OTel semantic conventions when not explicitly set.
85- // OTel-originated spans don't have sentry.op, description, etc. — the non-streamed path
86- // infers these in the SentrySpanExporter, but streamed spans skip the exporter entirely.
87- // Access `kind` via duck-typing — OTel span objects have this property but it's not on Sentry's Span type.
88- const spanKind = ( span as { kind ?: number } ) . kind ;
89- inferSpanDataFromOtelAttributes ( processedSpan , spanKind ) ;
90-
9192 return {
9293 ...streamedSpanJsonToSerializedSpan ( processedSpan ) ,
9394 _segmentSpan : segmentSpan ,
0 commit comments