GeezerVison is showing github.com — feat(nuxt): Instrument Nitro v3 cache storage by sentry-junior[bot] · Pull Request #25951 · getsentry/sentry-javascript
Conversation
Why: Starting with the RC, Nitro v3 runs defineCachedFunction / defineCachedHandler (and cache route rules) on an ocache storage. That storage only goes through KV storage when the kv cache driver is set, so with the default memory driver (and with fs) our KV driver instrumentation never sees cache reads or writes, and no cache.* spans are produced. Nitro doesn't offer a tracing channel for its cache, and the storage instance is private to Nitro's runtime. It is created in the build-time #nitro/virtual/cache module, though, so a bundler transform wraps that module's createCacheStorage export and the storage gets patched in place. It has to be patched in place because ocache also reads binary and maxEntryBytes from the storage object. The kv driver is skipped because the existing KV instrumentation already covers it. cache.hit comes from the stored entry: it must have a value, be unexpired, and not be marked stale. This PR also undoes the kv workaround in the nuxt-5 E2E app, so the default driver is what gets tested.
How to review: Start with cacheStorageInstrumentationPlugin in vite/storageConfig.ts, then instrumentCacheStorage in runtime/utils/instrumentStorage.ts. The span wrapper is now shared with the KV driver instrumentation, and KV behavior is unchanged.
Unsure about: The transform matches the exact export const createCacheStorage = line that Nitro generates. If Nitro changes that template, the transform does nothing (no crash), but cache spans would disappear again. Is that acceptable, or should we push upstream for a tracing channel or hook in Nitro/ocache? Note this is stacked on #25949.
via Francesco Gringl-Novy.
--
View Session [Sentry]
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
size-limit report 📦
Compared: cc59724 (PR test merge using develop at 60f2958)
Against: 60f2958 (develop) · base run #65933
✅ Baseline matches: this diff contains only this PR's changes.
| Path |
Size |
% Change |
Change |
| @sentry/browser |
30.04 kB |
- |
- |
| @sentry/browser - with treeshaking flags |
28.23 kB |
- |
- |
| @sentry/browser - with treeshaking flags tracing without tracing |
28.12 kB |
- |
- |
| @sentry/browser (incl. Tracing) |
52.2 kB |
- |
- |
| @sentry/browser (incl. Tracing + Span Streaming) |
52.2 kB |
- |
- |
| @sentry/browser (incl. Tracing, Profiling) |
55.17 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay) |
92.73 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay) - with treeshaking flags |
81.52 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay with Canvas) |
97.08 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay, Feedback) |
110.51 kB |
- |
- |
| @sentry/browser (incl. Feedback) |
47.66 kB |
- |
- |
| @sentry/browser (incl. sendFeedback) |
30.62 kB |
- |
- |
| @sentry/browser (incl. FeedbackAsync) |
35.62 kB |
- |
- |
| @sentry/browser (incl. Metrics) |
31.36 kB |
- |
- |
| @sentry/browser (incl. Logs) |
31.64 kB |
- |
- |
| @sentry/browser (incl. Metrics & Logs) |
32.3 kB |
- |
- |
| @sentry/react |
32.04 kB |
- |
- |
| @sentry/react (incl. Tracing) |
54.86 kB |
- |
- |
| @sentry/vue |
38.21 kB |
- |
- |
| @sentry/vue (incl. Tracing) |
55.14 kB |
- |
- |
| @sentry/svelte |
30.05 kB |
- |
- |
| @sentry/remix (Remix 3 client bundle) |
57.96 kB |
- |
- |
| CDN Bundle |
31.79 kB |
- |
- |
| CDN Bundle (incl. Tracing) |
52.58 kB |
- |
- |
| CDN Bundle (incl. Logs, Metrics) |
34.58 kB |
- |
- |
| CDN Bundle (incl. Tracing, Logs, Metrics) |
55.14 kB |
- |
- |
| CDN Bundle (incl. Replay, Logs, Metrics) |
75.61 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay) |
90.63 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Logs, Metrics) |
93.25 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback) |
96 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) |
98.6 kB |
- |
- |
| CDN Bundle - uncompressed |
92.69 kB |
- |
- |
| CDN Bundle (incl. Tracing) - uncompressed |
155.13 kB |
- |
- |
| CDN Bundle (incl. Logs, Metrics) - uncompressed |
101.03 kB |
- |
- |
| CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed |
162.76 kB |
- |
- |
| CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed |
231.11 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay) - uncompressed |
275.27 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed |
282.9 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed |
287.07 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed |
294.69 kB |
- |
- |
| @sentry/nextjs (client) |
58.23 kB |
- |
- |
| @sentry/sveltekit (client) |
53.26 kB |
- |
- |
| @sentry/core/server |
44.53 kB |
- |
- |
| @sentry/core/browser |
13.99 kB |
- |
- |
| @sentry/node |
149.49 kB |
-0.01% |
-4 B 🔽 |
| @sentry/node/import (ESM hook with diagnostics-channel injection) |
83.3 kB |
- |
- |
| @sentry/node - without tracing |
88.39 kB |
-0.01% |
-6 B 🔽 |
| @sentry/node - without channel injection |
138.45 kB |
-0.01% |
-2 B 🔽 |
| @sentry/aws-serverless |
97.3 kB |
-0.01% |
-7 B 🔽 |
| @sentry/cloudflare (withSentry) - minified |
204.35 kB |
- |
- |
| @sentry/cloudflare (withSentry) |
474.32 kB |
- |
- |
| @sentry/nextjs/cloudflare (withSentry) - minified |
229.66 kB |
- |
- |
View base workflow run
|
sentry-junior[bot] reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Optional E2E tests
All optional checks were successful. 7 successful. See the run.
Successful checks
|
Check |
Status |
|
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) |
Successful in 35s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5 Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) |
Successful in 27s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) |
Successful in 39s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) |
Successful in 36s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5 (tunnel-dev) Test (optional) |
Successful in 1m |
Details |
|
sentry-junior[bot] reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 2 potential issues.

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b919c0d. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the approach is a bit risky since it matches user code. I know we have precedents for that.
But I think I can PR tracing channels to ocache upstream since Nitro's ecosystem doesn't mind it.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
I think the approach is a bit risky since it matches user code. I know we have precedents for that.But I think I can PR tracing channels to ocache upstream since Nitro's ecosystem doesn't mind it.
yeah that would be nicer! should we still merge this like this or would you prefer to postpone this/do this differently for now @logaretm ?
|
sentry-junior[bot] reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
let's merge it, i think the tracing channel solution will take sometime to get merged, and when it does we can rip this one out as long as nitro remains in rc.
|
sentry-junior[bot] reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…se the deployment is missing a file (#26272)
**Why:** Follow-up to #26271. When `Module.register()` fails with
`ERR_MODULE_NOT_FOUND`, the always-on warning used to just repeat Node's
"Cannot find module …". That reads like an SDK bug, when the real cause
is that a build tracer didn't ship all of
`@sentry/server-runtime-injection`. The warning now says so. I checked
on Node 22 that `error.code` survives the trip back from the loader
thread. The warning still fires once per process: issue #26121 asks for
it to be quiet, but staying silent would hide that channel integrations
aren't recording anything (see #25677).
**How to review:** It's a single branch in the `catch` block of
`registerDiagnosticsChannelInjection()`, plus one unit test.
Refs #26121
<!-- junior-request-attribution:start -->
via **Francesco Gringl-Novy**.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AD0CA8FXFXAS%3A1794383205.954799 -->
--
[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AD0CA8FXFXAS%3A1794383205.954799)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0CA8FXFXAS%3A1794383205.954799/?project=4510944073809921)
<!-- junior-session-footer:end -->
---------
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Francesco Gringl-Novy <[email protected]>
Nitro v3 keeps cached functions and handlers in an ocache storage that
only goes through KV storage with the `kv` cache driver, so the default
`memory` and the `fs` drivers produced no cache spans. Wrap the
storage that the `#nitro/virtual/cache` module creates at build time.
Co-Authored-By: Francesco Gringl-Novy <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|