You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a72b2d8
Browse filesBrowse the repository at this point in the historyBrowse files
**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.
<!-- junior-request-attribution:start -->
via **Francesco Gringl-Novy**.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AD0CA8FXFXAS%3A1793366214.663899 -->
--
[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AD0CA8FXFXAS%3A1793366214.663899)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0CA8FXFXAS%3A1793366214.663899/?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 <francesco.novy@sentry.io>
0 commit comments