Development: Implement request log time details (#84906)
## What? Adds more detailed time for each request, showing what time is spent in Next.js (i.e. routing, Turbopack compilation, etc.) and what time is spent executing the application code which includes time spent in React / React rendering, requiring the application code, etc. The additional info is dimmed: <img width="744" height="124" alt="CleanShot 2025-10-15 at 19 27 01@2x" src="https://github.com/user-attachments/assets/b6ce973e-4687-4865-9ebb-be54865331b1" /> Text: ``` GET / 200 in 626ms (compile: 500ms, render: 125ms) GET / 200 in 24ms (compile: 2ms, render: 22ms) GET / 200 in 20ms (compile: 2ms, render: 18ms) GET / 200 in 16ms (compile: 1ms, render: 15ms) GET / 200 in 16ms (compile: 1ms, render: 14ms) ``` While working on this I found that the existing time (the `in 22ms` part) did not include time spent in proxy.ts, which is unexpected as you'd want to see the total time spent on a request, including running proxy.ts. I've fixed that bug in this PR, as well as added tracking of the time spent in proxy: To test I added a middleware that adds 1 second delay on all requests: Before (note: request took more than 1 second): ``` GET / 200 in 16ms GET / 200 in 20ms ``` After (note: request still takes the same time, but now correctly logs it): ``` GET / 200 in 1610ms (compile: 450ms, proxy.ts: 1039ms, render: 121ms) GET / 200 in 1038ms (compile: 5ms, proxy.ts: 1007ms, render: 27ms) GET / 200 in 1034ms (compile: 5ms, proxy.ts: 1004ms, render: 25ms) ```
Showing
Please
register
or
sign in
to comment