From 08576bd0ecc650393d109b355329b270a2692ecb Mon Sep 17 00:00:00 2001 From: Conor Schaefer Date: Wed, 10 Apr 2024 15:09:24 -0700 Subject: [PATCH] fix(metrics): validator missed blocks, inc -> set We were inappropriately `increment`ing a gauge to track missed blocks, when instead we should have been clobbering the value via `set`, as we know the precise number from the state machine. This fixes a broken metric for missed blocks that was growing too fast, emitting wrong values. Refs #3746. --- .../stake/src/component/validator_handler/uptime_tracker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/core/component/stake/src/component/validator_handler/uptime_tracker.rs b/crates/core/component/stake/src/component/validator_handler/uptime_tracker.rs index bd656db61f..bb6f68e9b1 100644 --- a/crates/core/component/stake/src/component/validator_handler/uptime_tracker.rs +++ b/crates/core/component/stake/src/component/validator_handler/uptime_tracker.rs @@ -172,7 +172,7 @@ pub trait ValidatorUptimeTracker: StateWrite { "recorded vote info" ); metrics::gauge!(metrics::MISSED_BLOCKS, "identity_key" => identity_key.to_string()) - .increment(uptime.num_missed_blocks() as f64); + .set(uptime.num_missed_blocks() as f64); uptime.mark_height_as_signed(height, voted)?; if uptime.num_missed_blocks() as u64 >= params.missed_blocks_maximum {