next.js
cbc5ea55 - Exclude blocking spans from trace work accounting (#99685)

Commit
1 day ago
Exclude blocking spans from trace work accounting (#99685) ## Summary Stacked above #99254. Allow `blocking = true` on elapsed-duration events and entered tracing spans, using the same ignore-self-time accounting as existing `blocking` spans. Waiting durations otherwise inflate concurrency and CPU totals even after the tasks yield—for example, a pending fetch emits overlapping request and attempt durations. Blocking spans now keep their elapsed ranges and metadata, but contribute no own CPU time, corrected time or concurrency, and do not affect other work's correction factor. Counted descendants remain included. Classify network and Node.js pool-acquisition waits as blocking, while keeping Node.js startup, initialization and evaluation counted as external work. Missing/false attributes preserve legacy accounting. No trace format or viewer payload changes. Existing name-exempt `thread`/`blocking` spans also retain their full elapsed end now, rather than dropping it along with self-time. Attributes are classified at creation, not retroactively via record updates. External-work durations remain elapsed approximations, not OS-measured CPU time. ## Verification - 85 trace-server/trace-utils tests passed, including new reader regressions for flags, retained ranges, counted children, correction factors and live cache invalidation; affected Rust producers and native bindings compile. - Rebuilt trace server queried over WebSocket: the 40-wait fixture changes from concurrency 80 to 0 during the wait when its duration events carry `blocking = true`. Root CPU totals drop from 8002ms to the 2ms entered work; waiting leaf retains its 100ms elapsed range with zero CPU/corrected duration. - No new benchmark screenshot: actual raw-reader tests and the rebuilt-server fixture verify the changed accounting. <!-- NEXT_JS_LLM --> <!-- fleet 0c297c2c-8e55-4012-be8a-752ff8175d1b --> Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading