Skip to content

Commit dad2b6b

Browse files
committed
fix: update ROUND_TIMEOUT_MS to be reported in histogram
1 parent 324437f commit dad2b6b

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

consensus/src/counters.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,13 @@ pub static TIMEOUT_COUNT: Lazy<IntCounter> = Lazy::new(|| {
547547
});
548548

549549
/// Round timeout in milliseconds
550-
pub static ROUND_TIMEOUT_MS: Lazy<IntCounterVec> = Lazy::new(|| {
551-
register_int_counter_vec!(
550+
pub static ROUND_TIMEOUT_MS: Lazy<Histogram> = Lazy::new(|| {
551+
register_histogram!(
552552
"aptos_consensus_round_timeout_ms",
553553
"Round timeout in milliseconds",
554-
&["round"]
554+
vec![
555+
100.0, 200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0, 20000.0, 50000.0, 100000.0
556+
]
555557
)
556558
.unwrap()
557559
});

consensus/src/round_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ impl RoundManager {
333333
new_round_event: NewRoundEvent,
334334
) -> anyhow::Result<()> {
335335
counters::CURRENT_ROUND.set(new_round_event.round as i64);
336-
counters::ROUND_TIMEOUT_MS.with_label_values(&[&new_round_event.round.to_string()]).inc_by(new_round_event.timeout.as_millis() as u64);
336+
counters::ROUND_TIMEOUT_MS.observe(new_round_event.timeout.as_millis() as f64);
337337
match new_round_event.reason {
338338
NewRoundReason::QCReady => {
339339
counters::QC_ROUNDS_COUNT.inc();

crates/aptos-telemetry/src/core_metrics.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,7 @@ fn collect_consensus_metrics(core_metrics: &mut BTreeMap<String, String>) {
140140
// Get the round timeout in milliseconds
141141
core_metrics.insert(
142142
CONSENSUS_ROUND_TIMEOUT_MS.into(),
143-
aptos_consensus::counters::ROUND_TIMEOUT_MS
144-
.with_label_values(&[&aptos_consensus::counters::CURRENT_ROUND.get().to_string()])
145-
.get()
146-
.to_string(),
143+
get_histogram_values(&aptos_consensus::counters::ROUND_TIMEOUT_MS),
147144
);
148145

149146
// Get sync info messages count

0 commit comments

Comments
 (0)