Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Metrics] Fix block height metric #2193

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions crates/task-impls/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,11 +609,12 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, A: ConsensusApi<TYPES, I> +
// starting from the first iteration with a three chain, e.g. right after the else if case nested in the if case above
if new_decide_reached {
let mut leaf = leaf.clone();
consensus
.metrics
.last_synced_block_height
.set(usize::try_from(leaf.get_height()).unwrap_or(0));

if leaf.view_number == new_anchor_view {
consensus
.metrics
.last_synced_block_height
.set(usize::try_from(leaf.get_height()).unwrap_or(0));
}
// If the block payload is available for this leaf, include it in
// the leaf chain that we send to the client.
if let Some(encoded_txns) =
Expand Down