From daae78370ad37e9a7b7b41a253611c869808b903 Mon Sep 17 00:00:00 2001 From: Martin Sonnberger Date: Thu, 6 Aug 2026 14:30:16 +0200 Subject: [PATCH] feat(opentelemetry)!: Drop `.prefetch` suffix from inferred HTTP span ops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Row 3 of JS-3105: OTel inference fabricated the unregistered `http.client.prefetch` / `http.server.prefetch` ops. Prefetch is request data, not an operation category, and is already recorded on the span as `sentry.http.prefetch` — so the op now only encodes the request direction (`http.client` / `http.server`, or `http` when the kind is unknown), using the registered `@sentry/conventions` op constants. part of #22446 Co-Authored-By: Claude Opus 4.8 --- .../src/utils/parseSpanDescription.ts | 26 +++++++------------ .../test/utils/parseSpanDescription.test.ts | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/packages/opentelemetry/src/utils/parseSpanDescription.ts b/packages/opentelemetry/src/utils/parseSpanDescription.ts index 9cc6c64385f1..b6edf9244ddd 100644 --- a/packages/opentelemetry/src/utils/parseSpanDescription.ts +++ b/packages/opentelemetry/src/utils/parseSpanDescription.ts @@ -21,7 +21,9 @@ import { MESSAGING_QUEUE_PUBLISH_SPAN_OP, MESSAGING_QUEUE_RECEIVE_SPAN_OP, MESSAGING_QUEUE_SPAN_OP, + WEB_SERVER_HTTP_CLIENT_SPAN_OP, WEB_SERVER_HTTP_SERVER_SPAN_OP, + WEB_SERVER_HTTP_SPAN_OP, } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; import { @@ -163,27 +165,19 @@ function descriptionForDbSystem(attributes: Attributes): SpanDescription { /** Only exported for tests. */ export function descriptionForHttpMethod(attributes: Attributes): SpanDescription { - const opParts = ['http']; const kind = attributes[SENTRY_KIND]; - switch (kind) { - case 'client': - opParts.push('client'); - break; - case 'server': - opParts.push('server'); - break; - } - - // Spans for HTTP requests we have determined to be prefetch requests will have a `.prefetch` postfix in the op - if (attributes['sentry.http.prefetch']) { - opParts.push('prefetch'); - } + const op = + kind === 'client' + ? WEB_SERVER_HTTP_CLIENT_SPAN_OP + : kind === 'server' + ? WEB_SERVER_HTTP_SERVER_SPAN_OP + : WEB_SERVER_HTTP_SPAN_OP; const { urlPath, url, query, fragment } = getSanitizedUrl(attributes); if (!urlPath) { - return { op: opParts.join('.') }; + return { op }; } const data: Record = {}; @@ -201,7 +195,7 @@ export function descriptionForHttpMethod(attributes: Attributes): SpanDescriptio } return { - op: opParts.join('.'), + op, data, }; } diff --git a/packages/opentelemetry/test/utils/parseSpanDescription.test.ts b/packages/opentelemetry/test/utils/parseSpanDescription.test.ts index 09c6f0cccfb6..935c01795726 100644 --- a/packages/opentelemetry/test/utils/parseSpanDescription.test.ts +++ b/packages/opentelemetry/test/utils/parseSpanDescription.test.ts @@ -327,7 +327,7 @@ describe('descriptionForHttpMethod', () => { [SENTRY_KIND]: 'client' as const, }, { - op: 'http.client.prefetch', + op: 'http.client', data: { 'url.full': 'https://www.example.com/my-path', },