cargo icon indicating copy to clipboard operation
cargo copied to clipboard

Tracking Issue for `-Zbuild-analysis`

Open weihanglo opened this issue 3 months ago • 1 comments

Summary

Original issue: https://github.com/rust-lang/rust-project-goals/pull/332 Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-analysis Project goal: https://github.com/rust-lang/rust-project-goals/issues/398

The -Zbuild-analysis feature records and persists detailed build metrics (timings, rebuild reasons, etc.) across runs, with new commands to query past builds.

Considerations for stabilization

  • [ ] Review the JSON schemas we exposed are reasonable (especially rebuild reason which has lots of variants)
  • [ ] JSON schema evolution
  • [ ] log compression
  • [ ] log rotations

Unresolved Issues

See the unresolved design questions in the design doc: https://hackmd.io/K5-sGEJeR5mLGsJLXqsHrw?view#Unresolved-questions.

  • [ ] Schema questions
    • https://github.com/rust-lang/cargo/pull/16303#discussion_r2561862478
    • https://github.com/rust-lang/cargo/pull/16303#discussion_r2565526807
    • #16203
  • [ ] Is losing data on crashes ok? https://github.com/rust-lang/cargo/pull//16150#discussion_r2462056940
  • [ ] Providing the types for reading these, see https://github.com/rust-lang/cargo/pull//16150#discussion_r2462065538

Future Extensions

No response

Implementations

See the design doc: https://hackmd.io/K5-sGEJeR5mLGsJLXqsHrw

  • [x] Nightly feature gate and configuration https://github.com/rust-lang/cargo/pull/15845
  • [x] Storage infrastructure, storage path, migration, etc. https://github.com/rust-lang/cargo/pull//16150
  • [ ] Collecting metrics
    • [x] Collect build metadata https://github.com/rust-lang/cargo/pull/16150
    • [ ] Collect CLI args (so people know what they've run)
    • [x] Collect timing data timing-info event https://github.com/rust-lang/cargo/pull/16179
    • [x] Collect rebuild reason data https://github.com/rust-lang/cargo/pull/16203
    • [ ] Collect timing concurrency metrics
    • [ ] Collect timing CPU usages
    • [x] Collect timing unlocked units (for drawing the dependency lines) https://github.com/rust-lang/cargo/pull/16303
  • [ ] Set up new unstable cargo report commands
    • [ ] Log reader and filter (--since, --until, default to the latest one)
    • [x] Separate timing tracking and presentation layers (log replay for HTML report) https://github.com/rust-lang/cargo/pull/16282
    • [ ] cargo report timing HTML log replay
    • [ ] cargo report rebuild-reason integration
  • [ ] benchmark the build performance impact

About tracking issues

Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

weihanglo avatar Aug 15 '25 20:08 weihanglo