@@ -14,7 +14,7 @@ import {
1414import type { SpanAttributes , TransactionSource } from '@sentry/types' ;
1515import { getSanitizedUrlString , parseUrl , stripUrlQueryAndFragment } from '@sentry/utils' ;
1616
17- import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core' ;
17+ import { SEMANTIC_ATTRIBUTE_SENTRY_OP , SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core' ;
1818import { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '../semanticAttributes' ;
1919import type { AbstractSpan } from '../types' ;
2020import { getSpanKind } from './getSpanKind' ;
@@ -167,10 +167,18 @@ export function descriptionForHttpMethod(
167167 // this infers that somebody manually started this span, in which case we don't want to overwrite the name
168168 const isClientOrServerKind = kind === SpanKind . CLIENT || kind === SpanKind . SERVER ;
169169
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+
170178 return {
171179 op : opParts . join ( '.' ) ,
172- description : isClientOrServerKind ? description : name ,
173- source : isClientOrServerKind ? source : 'custom' ,
180+ description : useInferredDescription ? description : name ,
181+ source : useInferredDescription ? source : 'custom' ,
174182 data,
175183 } ;
176184}
0 commit comments