feat(nuxt): Instrument storage API#17858
Merged
Conversation
07cb542 to
24a5470
Compare
a6dc41f to
fe203a5
Compare
911b7fe to
abe38de
Compare
64e5814 to
42ef2c7
Compare
Contributor
size-limit report 📦
|
s1gr1d
reviewed
Oct 9, 2025
Contributor
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
83bb4e8 to
f5cd0ca
Compare
83e35f8 to
d621605
Compare
s1gr1d
reviewed
Oct 16, 2025
Comment on lines
+125
to
+127
| if (CACHE_HIT_METHODS.has(methodName)) { | ||
| span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_HIT, !isEmptyValue(result)); | ||
| } |
Member
There was a problem hiding this comment.
I'm not sure if we should always treat data retrieval as a cache hit 🤔 This also adds this attribute even though it's not specifically set up as a Nitro cache, right?
Member
Author
There was a problem hiding this comment.
I figured KVs as a low latency storage are being used primarily as a cache, I don't think we can infer the user intention here.
Given that it can expire via TTL, I thought to treat it as cache.
I don't have a strong opinion, what do you think?
s1gr1d
approved these changes
Oct 16, 2025
Member
s1gr1d
left a comment
There was a problem hiding this comment.
In general, all good to go. Just some comments
logaretm
added a commit
that referenced
this pull request
Oct 17, 2025
Adds [Nitro/Nuxt Cache API](https://nitro.build/guide/cache) instrumentation by building upon the storage instrumentation in #17858 since both use `unstorage` under the hood. #### How it works Nitro injects the cache storage on either `cache:` or the root mount depending on user configuration, also in production the `cache` storage is placed on the root mount unless the user configures it explicitly to redis or something else. We instrument both mount drivers to cover other cache use cases. --- I made sure to add e2e tests as well for `cachedEventListner` and `cachedFunction` calls which are the main ways to use the Cache API. This PR depends on the storage PR #17858. --------- Co-authored-by: Sigrid Huemer <32902192+s1gr1d@users.noreply.github.com>
logaretm
added a commit
that referenced
this pull request
Oct 17, 2025
This pull request introduces automatic instrumentation for database queries in Nuxt applications in server side handlers using Sentry. #### Implementation Details - Instruments database `.sql`, `.prepare` and `.exec` calls. - Adds breadcrumbs and spans following cloudflare's D1 implementation. This relies on the work done in #17858 and #17886
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
This PR adds automatic instrumentation for Nuxt's storage layer (powered by unstorage), enabling performance monitoring for cache and key-value storage operations in Nuxt/Nitro applications.
Storage operations will now automatically create performance spans with detailed attributes for observability in Sentry.
What's New
nuxt.config.tsvianitro.storagegetItem,setItem,hasItem,removeItemgetItemRaw,setItemRawgetItems,setItemsgetKeys,clearget,set,has,del,removeImplementation Details
Span Attributes:
sentry.op:cache.{operation}(e.g.,cache.get_item,cache.set_item)sentry.origin:auto.cache.nuxtcache.key: Full key including mount prefixcache.hit:truefor successful get/has operationsdb.operation.name: Original method namedb.collection.name: Storage mount pointdb.system.name: Driver name (e.g.,memory,fs,redis)Files Changed:
packages/nuxt/src/runtime/plugins/storage.server.ts- Runtime instrumentation pluginpackages/nuxt/src/vite/storageConfig.ts- Build-time configurationpackages/nuxt/src/module.ts- Module integration