Skip to content

feat(nuxt): Add spans for useFetch and useAsyncData - #26952

Open
s1gr1d wants to merge 1 commit into
sig/nuxt-tracing-channel-optionfrom
sig/nuxt-data-spans
Open

s1gr1d wants to merge 1 commit into
sig/nuxt-tracing-channel-optionfrom
sig/nuxt-data-spans

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

⚠️ First merge: #26940

What

On Nuxt >= 4.7, each data composable call on the server (useFetch, useAsyncData and the lazy variants) now has a span, as a child of the renderPage span. When useFetch calls an API route of the app on the server, the spans of that route are children of this span.

  • The span has the op function and the origin auto.function.nuxt.data.
  • The span name is the composable name that Nuxt sends. A production build of Nuxt sends it only for useLazyAsyncData, so all other calls have the name useAsyncData.
  • With span streaming, a key that the app sets is the span description. A key that Nuxt makes is not.
  • A handler that rejects gives the span an error status from the HTTP status code. The SDK captures no error, because Nuxt gives the error to the app.

Why

A trace did not show how long a page waits for its data on the server. Nuxt publishes these calls on its nuxt.data tracing channel, which the module turns on since #26940.

The key is not in the span name, because it can have request data, for example an id.

Each data composable call on the server (`useFetch`, `useAsyncData`
and the lazy variants) now has a span, as a child of the render span.
The spans come from the `nuxt.data` tracing channel of Nuxt.

A production build of Nuxt sends the composable name only for
`useLazyAsyncData`, so all other spans have the name `useAsyncData`.
With span streaming, a key that the app sets is the span description.
@s1gr1d
s1gr1d marked this pull request as ready for review November 27, 2026 14:14
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 557bd9e (PR test merge using sig/nuxt-tracing-channel-option at 9ec5dc9)

Against: cf84d81 (sig/nuxt-tracing-channel-option) · base run #68198

⚠️ Baseline mismatch: 2 sig/nuxt-tracing-channel-option commit(s) in the PR build are missing from the baseline. Their size changes also affect this comparison. Compare commits. Re-run once sig/nuxt-tracing-channel-option's baseline build for 9ec5dc9 finishes.

Path Size % Change Change
@sentry/browser 30.55 kB - -
@sentry/browser - with treeshaking flags 28.74 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.61 kB - -
@sentry/browser (incl. Tracing) 53.68 kB - -
@sentry/browser (incl. Tracing Core) 40.6 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 53.68 kB - -
@sentry/browser (incl. Tracing, Profiling) 56.57 kB - -
@sentry/browser (incl. Tracing, Replay) 93.6 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 82.4 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 98.46 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 111.41 kB - -
@sentry/browser (incl. Feedback) 48.41 kB - -
@sentry/browser (incl. sendFeedback) 31.12 kB - -
@sentry/browser (incl. FeedbackAsync) 36.18 kB - -
@sentry/browser (incl. Metrics) 31.87 kB - -
@sentry/browser (incl. Logs) 32.15 kB - -
@sentry/browser (incl. Metrics & Logs) 32.81 kB - -
@sentry/react 32.58 kB - -
@sentry/react (incl. Tracing) 56.42 kB - -
@sentry/vue 38.76 kB - -
@sentry/vue (incl. Tracing) 56.69 kB - -
@sentry/svelte 30.58 kB - -
@sentry/effect (client) 42.23 kB - -
@sentry/effect (client, incl. Tracing) 54.97 kB - -
@sentry/effect (client, incl. Tracing, Logs, Metrics) 66.32 kB - -
@sentry/remix (Remix 3 client bundle) 59.41 kB - -
CDN Bundle 32.39 kB - -
CDN Bundle (incl. Tracing) 54.05 kB - -
CDN Bundle (incl. Logs, Metrics) 35.14 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 56.52 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76.1 kB - -
CDN Bundle (incl. Tracing, Replay) 91.85 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 94.38 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 97.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.8 kB - -
CDN Bundle - uncompressed 94.58 kB - -
CDN Bundle (incl. Tracing) - uncompressed 159.87 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.92 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 167.49 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 233.32 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 280.3 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 287.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.24 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 299.85 kB - -
@sentry/nextjs (client) 60.09 kB - -
@sentry/sveltekit (client) 55.03 kB - -
@sentry/core/server 45.84 kB - -
@sentry/core/browser 14.48 kB - -
@sentry/node 157.6 kB -0.01% -3 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.45 kB - -
@sentry/node - without tracing 89.84 kB -0.01% -1 B 🔽
@sentry/node - without channel injection 146.57 kB -0.01% -1 B 🔽
@sentry/aws-serverless 100.5 kB - -
@sentry/cloudflare (withSentry) - minified 211.97 kB - -
@sentry/cloudflare (withSentry) 491.78 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 214.92 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 237.22 kB - -

View base workflow run

@github-actions

Copy link
Copy Markdown
Contributor

Optional E2E tests

All optional checks were successful. 14 successful. See the run.

Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (cloudflare) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps enabled by Sentry) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (bun) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-4-sourcemaps (Vite server) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 1m Details

@s1gr1d
s1gr1d added this pull request to stack #26943 November 27, 2026 17:13

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.

1 participant