Make the checkpoint metrics more accurate

This commit is contained in:
teor 2020-11-06 16:25:03 +10:00
parent e0c92167bc
commit 96b7572bb5
1 changed files with 8 additions and 2 deletions

View File

@ -400,6 +400,14 @@ where
/// Increase the current checkpoint height to `verified_height`,
fn update_progress(&mut self, verified_height: block::Height) {
if let Some(max_height) = self.queued.keys().next_back() {
metrics::gauge!("checkpoint.queued.max.height", max_height.0 as i64);
} else {
// use -1 as a sentinel value for "None", because 0 is a valid height
metrics::gauge!("checkpoint.queued.max.height", -1);
}
metrics::gauge!("checkpoint.queued_slots", self.queued.len() as i64);
// Ignore blocks that are below the previous checkpoint, or otherwise
// have invalid heights.
//
@ -837,8 +845,6 @@ where
// should be rare.
self.process_checkpoint_range();
metrics::gauge!("checkpoint.queued_slots", self.queued.len() as i64);
let mut state_service = self.state_service.clone();
async move {
let hash = rx