-
Notifications
You must be signed in to change notification settings - Fork 53
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
Conversation
crates/task-impls/src/consensus.rs
Outdated
.last_synced_block_height | ||
.set(usize::try_from(leaf.get_height()).unwrap_or(0)); | ||
|
||
if !is_ancestor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just update this metric below where we send the decide event? I.e. add this in the if block starting on line 677 (if new_dcide_reached
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think this makes more sense. But what I don't understand is that, if I update metrics at line 677 the synced block height will be 2 views higher than updating at line 613, why they are different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, my understanding is that leafA
we called on 677 is the current newest pending leaf, we made a decide on this view which equals leafA.view()
, but the decided one is leafB
on view - 2 (in most cases) due to the consensus protocol. Therefore we'd better still do the update on line 613. Is this understanding correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seconding the opinion that we could just check the view number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR:
Fix the block height metrics by assigning the most recent leaf (rather than its old ancestor).