@@ -14,7 +14,7 @@ import {
14
14
import type { SpanAttributes , TransactionSource } from '@sentry/types' ;
15
15
import { getSanitizedUrlString , parseUrl , stripUrlQueryAndFragment } from '@sentry/utils' ;
16
16
17
- import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core' ;
17
+ import { SEMANTIC_ATTRIBUTE_SENTRY_OP , SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core' ;
18
18
import { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '../semanticAttributes' ;
19
19
import type { AbstractSpan } from '../types' ;
20
20
import { getSpanKind } from './getSpanKind' ;
@@ -167,10 +167,18 @@ export function descriptionForHttpMethod(
167
167
// this infers that somebody manually started this span, in which case we don't want to overwrite the name
168
168
const isClientOrServerKind = kind === SpanKind . CLIENT || kind === SpanKind . SERVER ;
169
169
170
+ // If the span is an auto-span (=it comes from one of our instrumentations),
171
+ // we always want to infer the name
172
+ // this is necessary because some of the auto-instrumentation we use uses kind=INTERNAL
173
+ const origin = attributes [ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ] || 'manual' ;
174
+ const isManualSpan = ! `${ origin } ` . startsWith ( 'auto' ) ;
175
+
176
+ const useInferredDescription = isClientOrServerKind || ! isManualSpan ;
177
+
170
178
return {
171
179
op : opParts . join ( '.' ) ,
172
- description : isClientOrServerKind ? description : name ,
173
- source : isClientOrServerKind ? source : 'custom' ,
180
+ description : useInferredDescription ? description : name ,
181
+ source : useInferredDescription ? source : 'custom' ,
174
182
data,
175
183
} ;
176
184
}
0 commit comments