request insights: derive request history and fetch data (2/5) (#93975)
## What
Builds the bounded request history store on top of local spans and fetch
metrics. Request Insights now keeps the last 100 requests, dedupes fetch
records, and preserves raw span details for later verbose consumers.
Stack:
1. request insights: record local framework spans (1/5)
2. request insights: derive request history and fetch data (2/5) ←
current
3. request insights: expose dev snapshots to tools and HMR (3/5)
4. request insights: add agent diagnosis access (4/5)
5. request insights: add DevTools request panel (5/5)
## Review Focus
- The request insight schema shared by server, tools, and DevTools.
- Fetch cache/status mapping from existing `AppRender.fetch` spans.
- Dedupe between completed fetch spans and direct fetch metrics.
## Proof In This PR
- `pnpm jest packages/next/src/server/lib/trace/request-insights.test.ts
packages/next/src/server/lib/patch-fetch.test.ts --runInBand`
- `pnpm --filter=next types`
## Deferred Coverage
- Browser/HMR transport, CLI/MCP access, and the visual panel are later
PRs.
<!-- NEXT_JS_LLM_PR -->
---------
Co-authored-by:
Tim Neutkens <tim@timneutkens.nl>
Showing
Please
register
or
sign in
to comment