-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nuxt): Instrument server cache API #17886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
size-limit report 📦
|
64e5814
to
42ef2c7
Compare
09e73ad
to
4f26f70
Compare
* Checks if the cache entry is a response cache entry. | ||
*/ | ||
function isResponseCacheEntry(key: string, _: CacheEntry): _ is CacheEntry<ResponseCacheEntry & { status: number }> { | ||
return key.startsWith('nitro:handlers:'); |
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.
Should this be checked with CACHED_FN_HANDLERS_RE
here as well?
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.
Not here no, we want to be able to distinguish between cachedFunction
and cachedEventHandler
cached entries here, the regex detects if it is either.
The reason for the distinction is we want to apply more checks if it is a cached response entry since Nitro employs more checks in that case that would determine the cache validity.
ab3ecc1
to
d943f7d
Compare
1c23b89
to
f2ad9e7
Compare
759c029
to
65dae94
Compare
d943f7d
to
83bb4e8
Compare
65dae94
to
c844c9e
Compare
83bb4e8
to
f5cd0ca
Compare
17482e2
to
65277c7
Compare
83e35f8
to
d621605
Compare
65277c7
to
604de80
Compare
604de80
to
f1dd874
Compare
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
Adds Nitro/Nuxt Cache API 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 thecache
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
andcachedFunction
calls which are the main ways to use the Cache API.This PR depends on the storage PR #17858.