Skip to content

request insights: derive request history and fetch data (2/5)#93975

Merged
timneutkens merged 5 commits into
request-insights/local-span-recorderfrom
request-insights/request-history
Jul 12, 2026
Merged

request insights: derive request history and fetch data (2/5)#93975
timneutkens merged 5 commits into
request-insights/local-span-recorderfrom
request-insights/request-history

Conversation

@feedthejim

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: 6e9860e

@feedthejim feedthejim force-pushed the request-insights/request-history branch from aa67146 to d704eca Compare May 21, 2026 03:40
@timneutkens timneutkens force-pushed the request-insights/local-span-recorder branch from 09e3816 to c8779dc Compare June 18, 2026 18:10
@timneutkens timneutkens force-pushed the request-insights/request-history branch from d704eca to c869f76 Compare June 18, 2026 18:10
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Stats from current PR

🔴 1 regression, 1 improvement

Metric Canary PR Change Trend
node_modules Size 514 MB 516 MB 🔴 +1.17 MB (+0%) ▁▁▁▁▁
Webpack Build Time (cached) 25.106s 24.592s 🟢 514ms (-2%) █▃▃▃▁
📊 All Metrics
📖 Metrics Glossary

Dev Server Metrics:

  • Listen = TCP port starts accepting connections
  • First Request = HTTP server returns successful response
  • Cold = Fresh build (no cache)
  • Warm = With cached build artifacts

Build Metrics:

  • Fresh = Clean build (no .next directory)
  • Cached = With existing .next directory

Change Thresholds:

  • Time: Changes < 50ms AND < 10%, OR < 2% are insignificant
  • Size: Changes < 1KB AND < 1% are insignificant
  • All other changes are flagged to catch regressions

⚡ Dev Server

Metric Canary PR Change Trend
Cold (Listen) 813ms 812ms ▁▁▁▁▂
Cold (Ready in log) 785ms 786ms ▁▁▁▁▁
Cold (First Request) 1.321s 1.329s ▁▁▁▁▁
Warm (Listen) 813ms 813ms ▁▁▁▁▁
Warm (Ready in log) 780ms 783ms ▁▁▁▁▁
Warm (First Request) 1.309s 1.306s ▁▁▁▁▁
📦 Dev Server (Webpack) (Legacy)

📦 Dev Server (Webpack)

Metric Canary PR Change Trend
Cold (Listen) 768ms 809ms ██▁█▁
Cold (Ready in log) 767ms 767ms ▇▅▃▆▁
Cold (First Request) 3.355s 3.312s ▇▅▃▅▁
Warm (Listen) 761ms 761ms ████▁
Warm (Ready in log) 767ms 766ms ▇▄▄▃▁
Warm (First Request) 3.395s 3.331s █▂▂▄▁

⚡ Production Builds

Metric Canary PR Change Trend
Fresh Build 5.147s 5.386s ▁▁▁▁▁
Cached Build 5.455s 5.505s ▁▁▁▁▂
📦 Production Builds (Webpack) (Legacy)

📦 Production Builds (Webpack)

Metric Canary PR Change Trend
Fresh Build 24.573s 24.539s ▅▁▃▂▁
Cached Build 25.106s 24.592s 🟢 514ms (-2%) █▃▃▃▁
node_modules Size 514 MB 516 MB 🔴 +1.17 MB (+0%) ▁▁▁▁▁
📦 Bundle Sizes

Bundle Sizes

⚡ Turbopack

Client

Main Bundles
Canary PR Change
00ef4gy8b5wxj.js gzip 157 B N/A -
03gmyxr7dukvs.js gzip 10.3 kB N/A -
040t1q17lo593.js gzip 8.77 kB N/A -
05js0p06ql0ws.js gzip 162 B N/A -
0bb0vtp8dwsez.js gzip 450 B N/A -
0cz1d0mv5g_q7.js gzip 39.4 kB 39.4 kB
0ga6rcwbclepx.js gzip 158 B N/A -
0l0sr6gau5xjn.js gzip 3.53 kB N/A -
0nxqz3q165m2l.js gzip 220 B N/A -
0qr-1tnb7_hg5.js gzip 5.72 kB N/A -
0su3oj-wd_f24.js gzip 157 B N/A -
0uilzvklme4ea.js gzip 8.76 kB N/A -
0v-to2419kft6.js gzip 71.1 kB N/A -
0z0y83mfx-l-h.js gzip 10 kB N/A -
15ok8ydf274z0.js gzip 10.6 kB N/A -
16cqqcigykfea.js gzip 13.6 kB N/A -
17h18zxt1915l.js gzip 1.46 kB N/A -
1b6ps5k3qbc9v.js gzip 168 B N/A -
1elt1qium-r2m.css gzip 115 B 115 B
1fq1h7dxad4cv.js gzip 9.44 kB N/A -
1fym-adbk_69_.js gzip 13.1 kB N/A -
1g80-jfls9qyr.js gzip 13.2 kB N/A -
1gav7nfh4y8ln.js gzip 8.76 kB N/A -
22sajk3amu-ua.js gzip 45 kB N/A -
2c0gxmllklfeh.js gzip 155 B N/A -
2cm1e61lu646w.js gzip 155 B N/A -
2jicr0hpcz3x7.js gzip 154 B N/A -
2rypqffktcxqh.js gzip 8.69 kB N/A -
2te199gvbth0p.js gzip 154 B N/A -
2uqsizxtehgqf.js gzip 8.79 kB N/A -
2vzktdqwbijqc.js gzip 8.74 kB N/A -
2zh5c22cnhvwf.js gzip 155 B N/A -
304gh1b2mfj2-.js gzip 65.5 kB N/A -
35dyc4njdvspw.js gzip 156 B N/A -
39ubradsr4gzy.js gzip 158 B N/A -
3c244akvx_-be.js gzip 8.74 kB N/A -
3dmlemitx3ef3.js gzip 2.29 kB N/A -
3pq0q6ik66hi5.js gzip 162 B N/A -
3y193x4n8cq9d.js gzip 7.4 kB N/A -
4237vdj6eyslt.js gzip 8.7 kB N/A -
turbopack-06..2zci.js gzip 3.85 kB N/A -
turbopack-0l..vj57.js gzip 3.85 kB N/A -
turbopack-0y..khhu.js gzip 3.85 kB N/A -
turbopack-17..dk51.js gzip 3.83 kB N/A -
turbopack-1o..q_rp.js gzip 3.85 kB N/A -
turbopack-1t..txle.js gzip 3.85 kB N/A -
turbopack-1u..7swf.js gzip 3.85 kB N/A -
turbopack-1y..8r0a.js gzip 3.85 kB N/A -
turbopack-28..1rro.js gzip 3.85 kB N/A -
turbopack-29..--ev.js gzip 3.85 kB N/A -
turbopack-3-..e5qa.js gzip 3.85 kB N/A -
turbopack-31..np11.js gzip 3.85 kB N/A -
turbopack-3l..a73s.js gzip 3.86 kB N/A -
turbopack-3z..yq_9.js gzip 3.85 kB N/A -
00tc16j5-eos9.js gzip N/A 1.46 kB -
0130eu77j0h59.js gzip N/A 155 B -
04joe4zmayj76.js gzip N/A 159 B -
05efbq2jv23b5.js gzip N/A 155 B -
05tax4x1rfda4.js gzip N/A 7.4 kB -
0ci8x4-0ug8pc.js gzip N/A 71.1 kB -
0d9rpn6i4_zpx.js gzip N/A 160 B -
0gaw1gmpwuwkn.js gzip N/A 8.8 kB -
12zyjjmq4oad1.js gzip N/A 5.72 kB -
1hefztyduchdh.js gzip N/A 156 B -
1k9cc4-gpa2cx.js gzip N/A 13.1 kB -
1n59uogejo81s.js gzip N/A 10.3 kB -
1npei3hlexdv3.js gzip N/A 9.99 kB -
1ssuiwj_rnpc5.js gzip N/A 8.77 kB -
1zfs8m9y4a5zq.js gzip N/A 152 B -
2-phc9obd3nyd.js gzip N/A 8.77 kB -
24utq57r3l1cw.js gzip N/A 8.7 kB -
2d_vc-5g35ich.js gzip N/A 155 B -
2fhjq6ek3srmr.js gzip N/A 8.69 kB -
2g0t7upz_v-hf.js gzip N/A 10.6 kB -
2ia9qqy99aie9.js gzip N/A 13.6 kB -
2m58iubo3_2om.js gzip N/A 65.5 kB -
2oza28kdqvoay.js gzip N/A 8.74 kB -
2x7r100b7ytej.js gzip N/A 168 B -
2zh8-mmhujy8o.js gzip N/A 2.29 kB -
2znh0hgl912gx.js gzip N/A 155 B -
30h_m0irj-q6p.js gzip N/A 221 B -
359s3sl8kxyzu.js gzip N/A 156 B -
37ejbfx1u9lpo.js gzip N/A 8.75 kB -
38c63ct4i1cy7.js gzip N/A 449 B -
395ew4vducf52.js gzip N/A 154 B -
3bov4yvn0_jo5.js gzip N/A 157 B -
3hd1us4ordyc9.js gzip N/A 13.2 kB -
3jimpal3lvz5e.js gzip N/A 9.44 kB -
3ns42zoevxrsp.js gzip N/A 45 kB -
3su6a4l8jbfth.js gzip N/A 3.53 kB -
3wb4pe4z4-aim.js gzip N/A 8.77 kB -
41z0m_6bo_9ke.js gzip N/A 155 B -
turbopack-05..tq1r.js gzip N/A 3.85 kB -
turbopack-0c..kyer.js gzip N/A 3.84 kB -
turbopack-0o..5lk5.js gzip N/A 3.83 kB -
turbopack-0t..ilm7.js gzip N/A 3.85 kB -
turbopack-17..m634.js gzip N/A 3.85 kB -
turbopack-19..1c1c.js gzip N/A 3.85 kB -
turbopack-1j..f3i6.js gzip N/A 3.85 kB -
turbopack-1q..obpn.js gzip N/A 3.85 kB -
turbopack-1z..7kul.js gzip N/A 3.85 kB -
turbopack-2g..1qrh.js gzip N/A 3.85 kB -
turbopack-2m..1z1h.js gzip N/A 3.85 kB -
turbopack-2y..nv-r.js gzip N/A 3.85 kB -
turbopack-35..jnn_.js gzip N/A 3.86 kB -
turbopack-3j..38kl.js gzip N/A 3.85 kB -
Total 448 kB 448 kB ⚠️ +20 B

Server

Middleware
Canary PR Change
middleware-b..fest.js gzip 730 B 723 B
Total 730 B 723 B ✅ -7 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 434 B 433 B
Total 434 B 433 B ✅ -1 B

📦 Webpack

Client

Main Bundles
Canary PR Change
2486.HASH.js gzip 169 B N/A -
3146-HASH.js gzip 64 kB N/A -
39fcf99b-HASH.js gzip 62.9 kB N/A -
8443-HASH.js gzip 4.68 kB N/A -
9431-HASH.js gzip 5.62 kB N/A -
framework-HASH.js gzip 59.8 kB 59.8 kB
main-app-HASH.js gzip 256 B 254 B
main-HASH.js gzip 39.6 kB 40.1 kB 🔴 +455 B (+1%)
webpack-HASH.js gzip 1.68 kB 1.68 kB
6105-HASH.js gzip N/A 5.63 kB -
764.HASH.js gzip N/A 169 B -
8898-HASH.js gzip N/A 63.4 kB -
9597-HASH.js gzip N/A 4.65 kB -
e1ccab69-HASH.js gzip N/A 62.9 kB -
Total 239 kB 239 kB ✅ -142 B
Polyfills
Canary PR Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Total 39.4 kB 39.4 kB
Pages
Canary PR Change
_app-HASH.js gzip 194 B 194 B
_error-HASH.js gzip 183 B 182 B
css-HASH.js gzip 335 B 335 B
dynamic-HASH.js gzip 1.8 kB 1.8 kB
edge-ssr-HASH.js gzip 255 B 254 B
head-HASH.js gzip 351 B 349 B
hooks-HASH.js gzip 384 B 384 B
image-HASH.js gzip 580 B 580 B
index-HASH.js gzip 259 B 259 B
link-HASH.js gzip 2.49 kB 2.49 kB
routerDirect..HASH.js gzip 319 B 319 B
script-HASH.js gzip 386 B 386 B
withRouter-HASH.js gzip 315 B 313 B
1afbb74e6ecf..834.css gzip 106 B 106 B
Total 7.96 kB 7.95 kB ✅ -7 B

Server

Edge SSR
Canary PR Change
edge-ssr.js gzip 127 kB 128 kB
page.js gzip 278 kB 284 kB 🔴 +5.18 kB (+2%)
Total 406 kB 411 kB ⚠️ +5.76 kB
Middleware
Canary PR Change
middleware-b..fest.js gzip 617 B 615 B
middleware-r..fest.js gzip 156 B 155 B
middleware.js gzip 44.8 kB 45.2 kB
edge-runtime..pack.js gzip 842 B 842 B
Total 46.4 kB 46.8 kB ⚠️ +363 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 719 B 720 B
Total 719 B 720 B ⚠️ +1 B
Build Cache
Canary PR Change
0.pack gzip 4.76 MB 4.78 MB 🔴 +14.5 kB (+0%)
index.pack gzip 116 kB 118 kB 🔴 +1.87 kB (+2%)
index.pack.old gzip 117 kB 118 kB 🔴 +1.29 kB (+1%)
Total 5 MB 5.01 MB ⚠️ +17.7 kB

🔄 Shared (bundler-independent)

Runtimes
Canary PR Change
app-page-exp...dev.js gzip 361 kB 363 kB
app-page-exp..prod.js gzip 199 kB 201 kB
app-page-tur...dev.js gzip 361 kB 363 kB
app-page-tur..prod.js gzip 199 kB 201 kB
app-page-tur...dev.js gzip 357 kB 359 kB
app-page-tur..prod.js gzip 197 kB 199 kB
app-page.run...dev.js gzip 358 kB 360 kB
app-page.run..prod.js gzip 197 kB 199 kB
app-route-ex...dev.js gzip 79.1 kB 81.1 kB 🔴 +2.06 kB (+3%)
app-route-ex..prod.js gzip 53.6 kB 55.2 kB 🔴 +1.59 kB (+3%)
app-route-tu...dev.js gzip 79.1 kB 81.1 kB 🔴 +2.06 kB (+3%)
app-route-tu..prod.js gzip 53.6 kB 55.2 kB 🔴 +1.59 kB (+3%)
app-route-tu...dev.js gzip 78.7 kB 80.7 kB 🔴 +2.06 kB (+3%)
app-route-tu..prod.js gzip 53.4 kB 55 kB 🔴 +1.59 kB (+3%)
app-route.ru...dev.js gzip 78.7 kB 80.7 kB 🔴 +2.06 kB (+3%)
app-route.ru..prod.js gzip 53.3 kB 54.9 kB 🔴 +1.59 kB (+3%)
dist_client_...dev.js gzip 324 B 324 B
dist_client_...dev.js gzip 326 B 326 B
dist_client_...dev.js gzip 318 B 318 B
dist_client_...dev.js gzip 317 B 317 B
pages-api-tu...dev.js gzip 45.2 kB 45.2 kB
pages-api-tu..prod.js gzip 34 kB 34 kB
pages-api.ru...dev.js gzip 45.2 kB 45.2 kB
pages-api.ru..prod.js gzip 33.9 kB 33.9 kB
pages-turbo....dev.js gzip 54.7 kB 54.7 kB
pages-turbo...prod.js gzip 39.6 kB 39.6 kB
pages.runtim...dev.js gzip 54.7 kB 54.7 kB
pages.runtim..prod.js gzip 39.6 kB 39.6 kB
server.runti..prod.js gzip 65.2 kB 65.2 kB
use-cache-pr...dev.js gzip 71.4 kB 71.4 kB
use-cache-pr...dev.js gzip 71.4 kB 71.4 kB
use-cache-pr...dev.js gzip 69.7 kB 69.7 kB
use-cache-pr...dev.js gzip 69.7 kB 69.7 kB
Total 3.46 MB 3.48 MB ⚠️ +28.1 kB
📝 Changed Files (20 files)

Files with changes:

  • app-page-exp..ntime.dev.js
  • app-page-exp..time.prod.js
  • app-page-tur..ntime.dev.js
  • app-page-tur..time.prod.js
  • app-page-tur..ntime.dev.js
  • app-page-tur..time.prod.js
  • app-page.runtime.dev.js
  • app-page.runtime.prod.js
  • app-route-ex..ntime.dev.js
  • app-route-ex..time.prod.js
  • app-route-tu..ntime.dev.js
  • app-route-tu..time.prod.js
  • app-route-tu..ntime.dev.js
  • app-route-tu..time.prod.js
  • app-route.runtime.dev.js
  • app-route.ru..time.prod.js
  • pages-api-tu..ntime.dev.js
  • pages-api.runtime.dev.js
  • pages-turbo...ntime.dev.js
  • pages.runtime.dev.js
View diffs
app-page-exp..ntime.dev.js
failed to diff
app-page-exp..time.prod.js
failed to diff
app-page-tur..ntime.dev.js
failed to diff
app-page-tur..time.prod.js
failed to diff
app-page-tur..ntime.dev.js
failed to diff
app-page-tur..time.prod.js
failed to diff
app-page.runtime.dev.js
failed to diff
app-page.runtime.prod.js
failed to diff
app-route-ex..ntime.dev.js

Diff too large to display

app-route-ex..time.prod.js

Diff too large to display

app-route-tu..ntime.dev.js

Diff too large to display

app-route-tu..time.prod.js

Diff too large to display

app-route-tu..ntime.dev.js

Diff too large to display

app-route-tu..time.prod.js

Diff too large to display

app-route.runtime.dev.js

Diff too large to display

app-route.ru..time.prod.js

Diff too large to display

pages-api-tu..ntime.dev.js

Diff too large to display

pages-api.runtime.dev.js

Diff too large to display

pages-turbo...ntime.dev.js

Diff too large to display

pages.runtime.dev.js

Diff too large to display

📎 Tarball URL
https://vercel-packages.vercel.app/next/commits/6e9860e4a45c85194d77d02cdde02bbf68d94b67/next

Commit: 6e9860e

@timneutkens timneutkens force-pushed the request-insights/request-history branch from c869f76 to 92c79b6 Compare June 19, 2026 09:27
@timneutkens timneutkens force-pushed the request-insights/local-span-recorder branch from c8779dc to 4cc9c25 Compare June 19, 2026 09:27
@timneutkens timneutkens force-pushed the request-insights/request-history branch from 92c79b6 to b0b9396 Compare June 19, 2026 12:14
@timneutkens timneutkens marked this pull request as ready for review June 22, 2026 08:39
@timneutkens timneutkens force-pushed the request-insights/local-span-recorder branch from 3f01826 to 129f119 Compare June 26, 2026 15:11
@timneutkens timneutkens force-pushed the request-insights/request-history branch from 29d07a5 to 56ce019 Compare June 26, 2026 15:11
@timneutkens timneutkens self-requested a review July 7, 2026 16:39
Comment on lines +38 to +39
const SENSITIVE_PARAM_NAME_RE =
/(?:^|[_-])(?:access[_-]?token|api[_-]?key|auth|authorization|code|cookie|credential|id[_-]?token|jwt|key|password|secret|session|signature|sig|token)(?:$|[_-])/i

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks overly specific? it would block access-token but not accesstoken?
I'd just do "contains any of these"?

@timneutkens timneutkens Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it as-is and verify if it's even relevant first by dogfooding the tab. I suspect it's not needed to even have this filter.

Comment thread packages/next/src/server/lib/trace/request-insights.ts
@timneutkens timneutkens force-pushed the request-insights/local-span-recorder branch from 129f119 to d63e2ea Compare July 8, 2026 11:53
@timneutkens timneutkens force-pushed the request-insights/request-history branch 2 times, most recently from 2c81fa9 to 0a993aa Compare July 9, 2026 09:02
@timneutkens timneutkens force-pushed the request-insights/local-span-recorder branch 2 times, most recently from 3a050d0 to cb02682 Compare July 10, 2026 13:24
@timneutkens timneutkens force-pushed the request-insights/request-history branch from 0a993aa to 633b1bd Compare July 10, 2026 13:24
@timneutkens timneutkens force-pushed the request-insights/local-span-recorder branch from cb02682 to b2ffb8f Compare July 10, 2026 13:54
@timneutkens timneutkens force-pushed the request-insights/request-history branch from 633b1bd to 56c3d97 Compare July 10, 2026 13:54
timneutkens and others added 4 commits July 11, 2026 19:59
Adds bounded request insight aggregation from local framework spans and fetch metrics, including fetch timing, method, URL, status, cache status, cache reason, fetch index, span trace identity, events, links, and dedupe between span-derived and metric-derived fetch entries.

Verification:

- 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
@timneutkens timneutkens force-pushed the request-insights/local-span-recorder branch from b2ffb8f to 6421469 Compare July 11, 2026 18:01
@timneutkens timneutkens force-pushed the request-insights/request-history branch from 56c3d97 to b5fb280 Compare July 11, 2026 18:01
@timneutkens timneutkens merged commit 510d00b into canary Jul 12, 2026
227 of 229 checks passed
@timneutkens timneutkens deleted the request-insights/request-history branch July 12, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants