Skip to content

Commit 324437f

Browse files
committed
feat: update IntGauge to CounterVec type
1 parent 81ac6b3 commit 324437f

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

consensus/src/counters.rs

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

549549
/// Round timeout in milliseconds
550-
pub static ROUND_TIMEOUT_MS: Lazy<IntGauge> = Lazy::new(|| {
551-
register_int_gauge!(
550+
pub static ROUND_TIMEOUT_MS: Lazy<IntCounterVec> = Lazy::new(|| {
551+
register_int_counter_vec!(
552552
"aptos_consensus_round_timeout_ms",
553-
"Round timeout in milliseconds"
553+
"Round timeout in milliseconds",
554+
&["round"]
554555
)
555556
.unwrap()
556557
});

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.set(new_round_event.timeout.as_millis() 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);
337337
match new_round_event.reason {
338338
NewRoundReason::QCReady => {
339339
counters::QC_ROUNDS_COUNT.inc();

crates/aptos-telemetry/src/core_metrics.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ 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-
get_gauge_metric(&aptos_consensus::counters::ROUND_TIMEOUT_MS),
143+
aptos_consensus::counters::ROUND_TIMEOUT_MS
144+
.with_label_values(&[&aptos_consensus::counters::CURRENT_ROUND.get().to_string()])
145+
.get()
146+
.to_string(),
144147
);
145148

146149
// Get sync info messages count

0 commit comments

Comments
 (0)