Skip to content

Commit 63bb45f

Browse files
committed
always infer from auto spans
1 parent 2513518 commit 63bb45f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/opentelemetry/src/utils/parseSpanDescription.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import type { SpanAttributes, TransactionSource } from '@sentry/types';
1515
import { 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';
1818
import { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '../semanticAttributes';
1919
import type { AbstractSpan } from '../types';
2020
import { 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

Comments
 (0)