Skip to main content

Crate rolldown_devtools_metrics

Crate rolldown_devtools_metrics 

Source
Expand description

In-memory aggregation of Rolldown’s devtools event stream into a small, agent-readable metrics report.

This is the metrics sink for build data: instead of the multi-GB JSON-lines devtools log, the writer thread folds the exact same trace_action! events (module graph, chunk graph, package graph, assets, per-hook calls) into bounded top-N aggregates, then renders at session close:

  • metrics.json — the canonical, schema-versioned, machine-readable report. Every other file is a view of this model, so the JSON and markdown can never drift.
  • entry.md + on-demand detail markdown files — progressive disclosure for agents/humans.
  • delta.md / metrics.json#delta — build-over-build comparison via .state.json.
  • history.jsonl — one flat summary line per build, appended across builds/sessions.
  • AGENTS.md — self-describing contract for agents that discover the directory.

It never retains the large content payloads carried by load/transform/renderChunk events — only counts, sizes, graph structure, and timing. Durations are exact: they are computed from Instants captured at event-emit time on the build thread (not at fold time on the writer thread), so writer-queue latency does not skew them.

Structs§

MetricsAggregator
Accumulates one session’s devtools events into bounded aggregates.
MetricsConfig
Configuration for a metrics session, supplied when the session is opened.

Constants§

REPORT_ROOT
Root of every report folder, relative to cwd.

Functions§

report_dir_for
The report folder of one build output, relative to cwd: node_modules/.rolldown/report/<output dir>.