Skip to content

Commit c5139b9

Browse files
committed
add reasoning for introducing a metrics format version
1 parent 7040d41 commit c5139b9

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/bootstrap/metrics.rs

+15-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,21 @@ use sysinfo::{CpuExt, System, SystemExt};
1616

1717
// Update this number whenever a breaking change is made to the build metrics.
1818
//
19-
// Versions:
20-
// 0: initial version
21-
// 1: replaced JsonNode::Test with JsonNode::TestSuite
19+
// The output format is versioned for two reasons:
20+
//
21+
// - The metadata is intended to be consumed by external tooling, and exposing a format version
22+
// helps the tools determine whether they're compatible with a metrics file.
23+
//
24+
// - If a developer enables build metrics in their local checkout, making a breaking change to the
25+
// metrics format would result in a hard-to-diagnose error message when an existing metrics file
26+
// is not compatible with the new changes. With a format version number, bootstrap can discard
27+
// incompatible metrics files instead of appending metrics to them.
28+
//
29+
// Version changelog:
30+
//
31+
// - v0: initial version
32+
// - v1: replaced JsonNode::Test with JsonNode::TestSuite
33+
//
2234
const CURRENT_FORMAT_VERSION: usize = 1;
2335

2436
pub(crate) struct BuildMetrics {

0 commit comments

Comments
 (0)