Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion crates/bin/docs_rs_builder/src/build_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use docs_rs_context::Context;
use docs_rs_fastly::CdnBehaviour as _;
use docs_rs_logging::BUILD_PACKAGE_TRANSACTION_NAME;
use docs_rs_utils::{Handle, retry};
use opentelemetry::KeyValue;
use std::time::Instant;
use tracing::{error, info_span};

Expand All @@ -25,7 +26,22 @@ fn process_next_crate(
let instant = Instant::now();
let res = f(to_process);
let elapsed = instant.elapsed().as_secs_f64();
builder_metrics.build_time.record(elapsed, &[]);
builder_metrics.build_time.record(
elapsed,
&[KeyValue::new(
"result",
match &res {
Ok(summary) => {
if summary.successful {
"success"
} else {
"failed"
}
}
Err(_) => "error",
},
)],
);
res
};

Expand Down
43 changes: 22 additions & 21 deletions crates/bin/docs_rs_builder/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@ pub const DOCUMENTATION_SIZE_BUCKETS: &[f64; 16] = &[

/// the measured times of building crates will be put into these buckets
pub const BUILD_TIME_HISTOGRAM_BUCKETS: &[f64] = &[
30.0, // 0.5
60.0, // 1
120.0, // 2
180.0, // 3
240.0, // 4
300.0, // 5
360.0, // 6
420.0, // 7
480.0, // 8
540.0, // 9
600.0, // 10
660.0, // 11
720.0, // 12
780.0, // 13
840.0, // 14
900.0, // 15
1200.0, // 20
1800.0, // 30
2400.0, // 40
3000.0, // 50
3600.0, // 60
5.0, // 5s
10.0, // 10s
15.0, // 15s
20.0, // 20s
25.0, // 25s
30.0, // 30s
45.0, // 45s
60.0, // 1 min
90.0, // 1.5 min
120.0, // 2 min
150.0, // 2.5 min
180.0, // 3 min
210.0, // 3.5 min
240.0, // 4 min
270.0, // 4.5 min
300.0, // 5 min
420.0, // 7 min
600.0, // 10 min
900.0, // 15 min
1200.0, // 20 min
1800.0, // 30 min
3600.0, // 60 min
];

#[derive(Debug)]
Expand Down
Loading