Repository navigation
fix(nuxt): Avoid duplicate spans when Nitro tracing channels are on - #26928
Merged
Merged
Conversation
On Nitro v3, a user who sets Nuxt's `tracingChannel` option got two spans for each server middleware and each storage call, and a `Server-Timing` header. The default `nitroIntegration` made a span from the channel, and the Nuxt SDK made its own span for the same operation. The Nuxt server `init` now swaps the default Nitro integration for one without middleware spans, storage spans and `Server-Timing`. For this, `nitroIntegration` gets a `middleware` option. The SDK spans stay, because Nitro v2 has no channels and h3 does not tell which middleware ran.
Contributor
size-limit report 📦Compared: 1197db8 (PR test merge using develop at 6e0b633) Against: 6e0b633 (develop) · base run #68162 ✅ Baseline matches: this diff contains only this PR's changes.
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 8 not successful, 57 successful. See the run.
Successful checks
|
`spanToJSON` returns `StreamedSpanJSON`. The tests typed the spans as `SpanJSON`, so the type check of the Nuxt unit tests failed in CI.
s1gr1d
marked this pull request as ready for review
November 26, 2026 14:30
javascript-sdk-gitflow
Bot
requested review from
andreiborza,
isaacs and
timfish
November 26, 2026 14:31
logaretm
approved these changes
Nov 26, 2026
This was referenced Nov 27, 2026
51 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
With Nuxt's
tracingChanneloption on (Nitro v3), each server middleware and each storage call now gets one span instead of two. The response also has noServer-Timingheader.nitroIntegrationhas a new optionmiddleware. Withfalse, it makes no span for h3 middleware.@sentry/nuxtnow usesnitroIntegration({ middleware: false, storage: false, serverTiming: false }).Why
The Nuxt SDK has its own spans for server middleware and storage, and it sends the trace to the browser with
<meta>tags. The defaultnitroIntegrationmade a second span from the Nitro channels for the same operation.We keep the SDK spans and not the channel spans, because Nitro v2 has no channels and the h3 channel does not tell which middleware ran.
The
handlerspan of the h3 channel stays, because the SDK has no span for it. With the channel on, it is the parent of the storage, cache and db spans.Follow-up of #26885.