Skip to content

feat(nitro): Report a single http.server span per request - #25295

Open
mydea wants to merge 1 commit into
feat/nitro-anchor-both-on-h3from
feat/nitro-single-http-server-span
Open

mydea wants to merge 1 commit into
feat/nitro-anchor-both-on-h3from
feat/nitro-single-http-server-span

Conversation

@mydea

@mydea mydea commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

A Nitro request currently produces three nested http.server spans: the runtime's own (Node http, Bun.serve, Deno.serve, Cloudflare's request wrapper), then one from srvx's srvx.request channel, then one from h3's h3.request route channel. The nested two add nothing the root does not already carry: srvx only duplicates the URL and header attributes (with a wrong server.port, the configured 0 rather than the bound port), and h3's route and params were already being copied onto the root.

Now the root is the only http.server span:

  • srvx creates or enriches, like the Hono integration: it skips its span when the root is already an http.server span, and only creates the root otherwise (e.g. @sentry/node on Bun, where no runtime instrumentation creates one). server.port now reports the bound port in that case.
  • h3 route handlers get a handler span instead, the same op the Express integration uses for request handlers, so the time spent in the handler itself stays visible.
  • Middleware spans (h3 and srvx) are unchanged and now sit directly under the root.

This is a visible change for existing @sentry/nitro users: the auto.http.nitro.srvx and auto.http.nitro.h3 http.server spans go away, so queries or alerts on them need to move to the root span or the handler span.

🤖 Generated with Claude Code

The srvx and h3 tracing channels each opened another http.server span below
the one the runtime already creates, duplicating its attributes. srvx now
only creates the root span when the runtime has not, and the h3 route
handler gets a handler span that times the handler itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mydea
mydea added this pull request to stack #24913 October 12, 2026 14:08

@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 1 potential issue.

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 45ba173. Configure here.

parent_span_id: segment?.span_id,
status: 'ok',
attributes: expect.objectContaining({
'sentry.op': { type: 'string', value: 'http.server' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tests use raw span attribute strings

Low Severity

New assertions compare span ops and attributes to string literals such as handler, http.server, sentry.op, sentry.origin, and http.route. This was flagged because the review guidelines require test assertions on span attributes and ops to use the @sentry/conventions constants.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 45ba173. Configure here.

@github-actions

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 29.82 kB - -
@sentry/browser - with treeshaking flags 27.95 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.86 kB - -
@sentry/browser (incl. Tracing) 51.88 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.9 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.83 kB - -
@sentry/browser (incl. Tracing, Replay) 91.63 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.49 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.34 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.32 kB - -
@sentry/browser (incl. Feedback) 47.34 kB - -
@sentry/browser (incl. sendFeedback) 34.87 kB - -
@sentry/browser (incl. FeedbackAsync) 39.98 kB - -
@sentry/browser (incl. Metrics) 30.84 kB - -
@sentry/browser (incl. Logs) 31.13 kB - -
@sentry/browser (incl. Metrics & Logs) 31.77 kB - -
@sentry/react 31.65 kB - -
@sentry/react (incl. Tracing) 54.21 kB - -
@sentry/vue 37.89 kB - -
@sentry/vue (incl. Tracing) 54.81 kB - -
@sentry/svelte 29.84 kB - -
@sentry/remix (Remix 3 client bundle) 56.91 kB - -
CDN Bundle 31.55 kB - -
CDN Bundle (incl. Tracing) 52.41 kB - -
CDN Bundle (incl. Logs, Metrics) 33.75 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.34 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.67 kB - -
CDN Bundle (incl. Tracing, Replay) 90.06 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.18 kB - -
CDN Bundle - uncompressed 92.91 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.53 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.45 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.48 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.48 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.7 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 281.63 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.4 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.33 kB - -
@sentry/nextjs (client) 56.62 kB - -
@sentry/sveltekit (client) 52.27 kB - -
@sentry/core/server 40.92 kB - -
@sentry/core/browser 13.74 kB - -
@sentry/node 153.7 kB +1.2% +1.82 kB 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.79 kB +0.03% +20 B 🔺
@sentry/node - without tracing 94.74 kB +0.32% +294 B 🔺
@sentry/node - without channel injection 131.87 kB +1.38% +1.78 kB 🔺
@sentry/aws-serverless 102.89 kB +0.27% +274 B 🔺
@sentry/cloudflare (withSentry) - minified 210.28 kB +0.04% +79 B 🔺
@sentry/cloudflare (withSentry) 521.29 kB +0.03% +142 B 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 227.95 kB +0.04% +79 B 🔺

View base workflow run

@mydea
mydea marked this pull request as ready for review October 13, 2026 07:44
@mydea
mydea requested a review from a team as a code owner October 13, 2026 07:44
@mydea
mydea requested review from andreiborza and isaacs and removed request for a team October 13, 2026 07:44

This branch has not been deployed

No deployments
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.

2 participants