Skip to content

feat(nitro): Turn on Nitro's tracing channels from the Vite and Rollup plugins - #26809

Closed
sentry-junior[bot] wants to merge 8 commits into
developfrom
feat/nitro-orchestrion-prepare-response
Closed

sentry-junior[bot] wants to merge 8 commits into
developfrom
feat/nitro-orchestrion-prepare-response

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What

A Nitro app with only @sentry/node and its Vite or Rollup plugin now gets the parameterized route, Server-Timing and the h3 handler, middleware, srvx and cache spans, without @sentry/nitro. The plugins turn on Nitro's tracingChannel option, and the nitroIntegration subscribers that @sentry/nitro already uses do the rest.

This also adds the node-nitro-3 e2e app: Vite and the Nitro CLI, dev and prod, plus a variant where the user sets tracingChannel: true themselves. The app uses the setup #24900 now recommends: Sentry.init() in a Nitro plugin and --import @sentry/node/import, so in dev only Nitro's worker has a client.

Why

Step 2 of #24900. The native channels need no orchestrion targets in h3's build chunks, and they fire in nitro dev even though h3 stays external there.

  • Vite: the orchestrion plugin has a nitro property, which Nitro's Vite plugin installs as a Nitro module. That covers vite build, vite dev and nitro build with a Vite config.
  • Rollup: Nitro installs no modules from rollupConfig.plugins, so buildStart takes the instance from globalThis.__nitro_instances__. That global is not public API; the e2e app's Nitro CLI variants catch a change.
  • Both run after Nitro resolved the option, so they do what Nitro's resolver does (src/config/resolvers/tracing.ts in nitrojs/nitro). They change nothing when the option is set, so a user's false and the value @sentry/nitro sets stay.

Open decisions:

via @mydea.

--

View Session [Sentry]

…esponse`

Without Nitro's `tracingChannel` option, h3 publishes no `h3.request`
events, so an app with only `@sentry/node` and its bundler plugin got
no parameterized route and no `Server-Timing` headers. Orchestrion now
injects a channel into h3's `prepareResponse`, and `nitroIntegration`
sets both from it.

Adds the `nitro-3-orchestrion` e2e app, which uses only `@sentry/node`
and its Vite or Rollup plugin.

Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 73c7b27 (PR test merge using develop at a1fd756)

Against: a1fd756 (develop) · base run #67894

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.54 kB - -
@sentry/browser - with treeshaking flags 28.73 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.6 kB - -
@sentry/browser (incl. Tracing) 53.67 kB - -
@sentry/browser (incl. Tracing Core) 40.59 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 53.67 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.46 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 98.43 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 111.4 kB - -
@sentry/browser (incl. Feedback) 48.4 kB - -
@sentry/browser (incl. sendFeedback) 31.11 kB - -
@sentry/browser (incl. FeedbackAsync) 36.17 kB - -
@sentry/browser (incl. Metrics) 31.86 kB - -
@sentry/browser (incl. Logs) 32.13 kB - -
@sentry/browser (incl. Metrics & Logs) 32.8 kB - -
@sentry/react 32.56 kB - -
@sentry/react (incl. Tracing) 56.38 kB - -
@sentry/vue 38.75 kB - -
@sentry/vue (incl. Tracing) 56.68 kB - -
@sentry/svelte 30.57 kB - -
@sentry/effect (client) 42.22 kB - -
@sentry/effect (client, incl. Tracing) 54.97 kB - -
@sentry/effect (client, incl. Tracing, Logs, Metrics) 66.31 kB - -
@sentry/remix (Remix 3 client bundle) 59.39 kB - -
CDN Bundle 32.54 kB - -
CDN Bundle (incl. Tracing) 54.15 kB - -
CDN Bundle (incl. Logs, Metrics) 35.27 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 56.63 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76.22 kB - -
CDN Bundle (incl. Tracing, Replay) 91.94 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 94.47 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 97.39 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.86 kB - -
CDN Bundle - uncompressed 94.92 kB - -
CDN Bundle (incl. Tracing) - uncompressed 160.25 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 103.26 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 167.88 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 233.61 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 280.65 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 288.28 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.58 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 300.2 kB - -
@sentry/nextjs (client) 60.09 kB - -
@sentry/sveltekit (client) 55.03 kB - -
@sentry/core/server 45.83 kB - -
@sentry/core/browser 14.46 kB - -
@sentry/node 156.93 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.45 kB - -
@sentry/node - without tracing 89.81 kB -0.01% -2 B 🔽
@sentry/node - without channel injection 145.9 kB +0.01% +2 B 🔺
@sentry/aws-serverless 100.44 kB -0.01% -3 B 🔽
@sentry/cloudflare (withSentry) - minified 211.93 kB - -
@sentry/cloudflare (withSentry) 491.77 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 214.88 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 237.17 kB - -

View base workflow run

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 3 not successful, 80 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E node-express-send-to-sentry (static trace lifecycle) Test (optional) Failing after 3m Details
❌ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Failing after 1m Details
❌ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Failing after 1m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 43s Details
✅ CI: Optional E2E Tests / E2E nuxt-4-sourcemaps (Vite server) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E express-5 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 57s Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E express-5 (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E node-eve (content off) Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 25s Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (no upload) Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E hono-5 (bun) Test (optional) Successful in 50s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 50s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E express-5 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E fastify-5 (bun) Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E hono-5 (deno) Test (optional) Successful in 57s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps enabled by Sentry) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E fastify-5 (deno) Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 (MCP SDK OpenTelemetry) Test (optional) Successful in 28s Details
✅ CI: Optional E2E Tests / E2E node-eve (0.x) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Successful in 53s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E hono-5 Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 59s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E hono-5 (cloudflare) Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 24s Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 29s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 27s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E solid-2-ssr (cloudflare) Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (delete all) Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (no upload) Test (optional) Successful in 27s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (delete all) Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (manual upload) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (no upload) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E vinext-cf-workers (workers cache) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (manual upload) Test (optional) Successful in 31s Details

`getTraceData()` returns nothing for a client without a DSN, so the
Server-Timing tests had no headers to check.

Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
Nitro's caching route rules run `prepareResponse` for the response they
store, so the trace of the request that rendered it was replayed to every
later visitor. Skip Server-Timing for the `cache`, `isr` and `prerender`
route rules and for responses a shared cache may store.

eve apps now get route names through orchestrion, so its orchestrion
variant expects them.
The app tests a Nitro app that uses only `@sentry/node`, so the name
now says so.
sentry-junior Bot and others added 2 commits November 25, 2026 07:58
eve's agent paths are static routes, so the orchestrion variant can
expect the span name `POST <path>` instead of a pattern. The
`node-nitro-3` endpoint is now `/api/test-static`, since it isn't
about transactions.
…p plugins

Route names, Server-Timing and the h3 handler and middleware spans now come
from Nitro's native tracing channels, which the plugins turn on when the
option is unset. This replaces the orchestrion target on h3's
`prepareResponse`.

Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
@sentry-junior sentry-junior Bot changed the title feat(nitro): Set route names and Server-Timing through h3's prepareResponse feat(nitro): Turn on Nitro's tracing channels from the Vite and Rollup plugins Nov 25, 2026
Comment on lines +28 to +29
"h3": "latest",
"nitro": "latest",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should these two not also be dependencies (instead of dev dependencies)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

also let's make these ^3.0.0 or something like this instead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, they're runtime deps. Moved h3 and nitro to dependencies in 75ec498c.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

h3 is now ^2.0.8. For nitro, ^3.0.0 matches no published version: there's no stable 3.0.0 yet, every Nitro 3 release is a prerelease (3.0.261103-rc is latest), and a caret range without a prerelease tag skips prereleases. So the install would fail. I used ^3.0.261103-rc instead. By semver rules, a prerelease caret only matches prereleases with the same 3.0.261103 version, so in practice this pins 3.0.261103-rc until a stable 3.x ships. The tradeoff: CI no longer picks up new Nitro RCs on its own, which is where the __nitro_instances__ global and the resolver could change. If you'd rather keep tracking new RCs until 3.0.0 is out, latest is the only option for now. Done in 75ec498c.

The app preloads `@sentry/node/import` and calls `Sentry.init()` from a
Nitro plugin instead of preloading an `instrument.mjs`. Only Nitro's
worker gets a client then, so in dev the tests no longer have to skip a
segment span from the dev server.

Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
…de-nitro-3

Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
@sentry-junior

sentry-junior Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Closing: #24900 now plans a dedicated Nitro module (@sentry/{node,bun,deno,cloudflare}/nitro, in @sentry/server-utils). The work restarts in new PRs under that plan.

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