Skip to content

Commit

Permalink
fix metrics bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-aranha-cw committed Jun 7, 2024
1 parent ec0e65f commit bf4de85
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/eth/consensus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,17 @@ impl AppendEntryService for AppendEntryServiceImpl {
);

#[cfg(feature = "metrics")]
metrics::set_append_entries_block_number_diff(last_last_arrived_block_number - header.number);
{
if let Some(diff) = last_last_arrived_block_number.checked_sub(header.number) {
metrics::set_append_entries_block_number_diff(diff);
} else {
tracing::error!(
"leader is behind follower: arrived_block: {}, header_block: {}",
last_last_arrived_block_number,
header.number
);
}
}

Ok(Response::new(AppendBlockCommitResponse {
status: StatusCode::AppendSuccess as i32,
Expand Down

0 comments on commit bf4de85

Please sign in to comment.