Skip to content

feat: Emit low-cardinality http.server span names in framework SDKs - #23597

Draft
chargome wants to merge 1 commit into
charlygomez/js-3412-http-span-names-corefrom
charlygomez/js-3412-http-span-names-frameworks
Draft

feat: Emit low-cardinality http.server span names in framework SDKs#23597
chargome wants to merge 1 commit into
charlygomez/js-3412-http-span-names-corefrom
charlygomez/js-3412-http-span-names-frameworks

Conversation

@chargome

Copy link
Copy Markdown
Member

Applies the same span-streaming gate across the runtime and framework SDKs so no integration keeps a raw URL in an http.server span name; routed requests are unchanged. Stacked on #23596.
Worth a closer look: remix reads its own span name back, sveltekit also renames SvelteKit's native root span, and nextjs renames in a spanStart hook because Next.js creates that span. Refs #23527

@chargome chargome self-assigned this Aug 25, 2026
@linear-code

linear-code Bot commented Aug 25, 2026

Copy link
Copy Markdown

JS-3412

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 28.57 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 48.58 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.6 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.51 kB - -
@sentry/browser (incl. Tracing, Replay) 88.04 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.44 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.75 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.44 kB - -
@sentry/browser (incl. Feedback) 45.81 kB - -
@sentry/browser (incl. sendFeedback) 33.36 kB - -
@sentry/browser (incl. FeedbackAsync) 38.46 kB - -
@sentry/browser (incl. Metrics) 29.51 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.43 kB - -
@sentry/react 30.31 kB - -
@sentry/react (incl. Tracing) 50.79 kB - -
@sentry/vue 35.69 kB - -
@sentry/vue (incl. Tracing) 50.82 kB - -
@sentry/svelte 28.59 kB - -
CDN Bundle 30.36 kB - -
CDN Bundle (incl. Tracing) 49.07 kB - -
CDN Bundle (incl. Logs, Metrics) 32.56 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.95 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.98 kB - -
CDN Bundle (incl. Tracing, Replay) 86.56 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.44 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.25 kB - -
CDN Bundle - uncompressed 89.97 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.69 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.26 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.38 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.36 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.12 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.79 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.81 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.48 kB - -
@sentry/nextjs (client) 53.33 kB - -
@sentry/sveltekit (client) 49.03 kB - -
@sentry/core/server 65.17 kB +0.14% +85 B 🔺
@sentry/core/browser 52.38 kB - -
@sentry/node 121.54 kB +0.05% +58 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.19 kB - -
@sentry/node - without tracing 87.62 kB +0.03% +19 B 🔺
@sentry/aws-serverless 95.82 kB +0.08% +75 B 🔺
@sentry/cloudflare (withSentry) - minified 199.57 kB +0.04% +74 B 🔺
@sentry/cloudflare (withSentry) 495.71 kB +0.06% +257 B 🔺

View base workflow run

@chargome
chargome force-pushed the charlygomez/js-3412-http-span-names-frameworks branch from 80e4f09 to ef8061b Compare August 26, 2026 07:20
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ef8061b. Configure here.

name:
attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === 'route' || !client || !hasSpanStreamingEnabled(client)
? `${request.method} ${routeName}`
: request.method?.toUpperCase() || HTTP_SPAN_NAME_FALLBACK,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Route source check uses removed attribute

High Severity

The streaming name gate checks SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, which is no longer set. Route metadata is written to SENTRY_SEGMENT_NAME_SOURCE instead, so the route branch never matches. With span streaming on, parameterized Bun and Nitro http.server spans collapse to just the method, and Cloudflare/Deno drop the low-cardinality GET / name.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ef8061b. Configure here.

Comment thread packages/nextjs/src/edge/index.ts Outdated
// to `${method} ${route}` once Next.js reports a route.
if (isRootSpan && spanAttributes?.[ATTR_NEXT_SPAN_TYPE] === 'BaseServer.handleRequest') {
const client = getClient();
if (client && hasSpanStreamingEnabled(client)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoidable getClient in Next.js hooks

Low Severity

This is more an “is this necessary” check than a hard violation: the new spanStart rename calls getClient() even though a client is already in scope. On the edge path vercelEdgeInit returns that client, and on the server path handleOnSpanStart is registered on the same instance. A current-client lookup can pick the wrong client in a multi-client setup and skip or mis-apply the streaming rename.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit ef8061b. Configure here.

expect.any(Function),
);
});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feat PR lacks integration or E2E tests

Low Severity

This is a feat PR, but the new coverage is only unit tests (Astro, Cloudflare, React Router, SvelteKit). Framework span naming depends on real request/route lifecycle, so at least one integration or E2E test would lock in that routed http.server spans stay parameterized and unrouted ones fall back when streaming is on. Several touched packages (Bun, Deno, Elysia, Next.js, Nitro, Remix) have no new tests at all.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit ef8061b. Configure here.

@chargome
chargome force-pushed the charlygomez/js-3412-http-span-names-frameworks branch 2 times, most recently from 865560a to 9b5e334 Compare August 26, 2026 08:06
@chargome
chargome force-pushed the charlygomez/js-3412-http-span-names-frameworks branch from 9b5e334 to 330935b Compare August 26, 2026 08:11
@chargome
chargome force-pushed the charlygomez/js-3412-http-span-names-frameworks branch from 330935b to 2d61e3b Compare August 26, 2026 09:14
Applies the same span-streaming gate to the runtime and framework SDKs so no integration keeps a raw
URL in an http.server span name. Requests that resolve to a route are unchanged.

Three sites differ from the rest and are worth a closer look: remix reads its own span name back,
sveltekit also renames SvelteKit's native root span, and nextjs renames in a `spanStart` hook because
Next.js — not the SDK — creates that span.

Refs #23527
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chargome
chargome force-pushed the charlygomez/js-3412-http-span-names-frameworks branch from 2d61e3b to b37ecb0 Compare August 26, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant