feat(nextjs): Add `cache_origin` span links to `use cache` hit spans (#24821)
A `"use cache"` hit tells you nothing about where the value came from. This PR connects the two traces: a `cache.get` hit span now carries a span link (`sentry.link.type: 'cache_origin'`) to the `cache.put` span of the request that filled the entry. This covers cached functions, components, and layouts that Next reads through its cache handlers at request time. That's `"use cache"` in route handlers and in dynamically rendered pages. Successful cache fills are remembered in a bounded per-process `LRUMap`. When the cache origin is unknown, the hit span gets no link. Closes https://github.com/getsentry/sentry-javascript/issues/24294 Linear: https://linear.app/getsentry/issue/JS-3656/link-cache-hits-to-the-trace-that-filled-the-cache-entry
S
Sigrid committed
1e5b1bf1ea231733e85e88372e5c827afbb16c3a
Parent: c4034d4
Committed by GitHub <noreply@github.com>
on 10/1/2026, 12:08:41 PM