Add metrics for the sled state (#1062)

This commit is contained in:
teor 2020-10-10 11:49:44 +10:00 committed by GitHub
parent 256c0fce27
commit e2d67fc9e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -68,8 +68,19 @@ impl FinalizedState {
self.queued_by_prev_hash.insert(prev_hash, queued_block);
while let Some(queued_block) = self.queued_by_prev_hash.remove(&self.finalized_tip_hash()) {
self.commit_finalized(queued_block)
let height = queued_block
.block
.coinbase_height()
.expect("valid blocks must have a height");
self.commit_finalized(queued_block);
metrics::counter!("state.committed.block.count", 1);
metrics::gauge!("state.committed.block.height", height.0 as _);
}
metrics::gauge!(
"state.queued.block.count",
self.queued_by_prev_hash.len() as _
);
}
/// Returns the hash of the current finalized tip block.