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

[Consensus] count missing ancestors and blocks per authority #19293

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 16 additions & 1 deletion consensus/core/src/block_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,26 @@ impl BlockManager {
.or_default()
.insert(block_ref);

let ancestor_hostname = &self.context.committee.authority(ancestor.author).hostname;
self.context
.metrics
.node_metrics
.block_manager_missing_ancestors_by_authority
.with_label_values(&[ancestor_hostname])
.inc();

// Add the ancestor to the missing blocks set only if it doesn't already exist in the suspended blocks - meaning
// that we already have its payload.
if !self.suspended_blocks.contains_key(ancestor) {
self.missing_blocks.insert(*ancestor);
ancestors_to_fetch.insert(*ancestor);
if self.missing_blocks.insert(*ancestor) {
self.context
.metrics
.node_metrics
.block_manager_missing_blocks_by_authority
.with_label_values(&[ancestor_hostname])
.inc();
}
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions consensus/core/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ pub(crate) struct NodeMetrics {
pub(crate) block_manager_suspended_blocks: IntGauge,
pub(crate) block_manager_missing_ancestors: IntGauge,
pub(crate) block_manager_missing_blocks: IntGauge,
pub(crate) block_manager_missing_blocks_by_authority: IntCounterVec,
pub(crate) block_manager_missing_ancestors_by_authority: IntCounterVec,
pub(crate) threshold_clock_round: IntGauge,
pub(crate) subscriber_connection_attempts: IntCounterVec,
pub(crate) subscriber_connections: IntGaugeVec,
Expand Down Expand Up @@ -488,6 +490,18 @@ impl NodeMetrics {
"The number of blocks missing content tracked in the block manager",
registry,
).unwrap(),
block_manager_missing_blocks_by_authority: register_int_counter_vec_with_registry!(
"block_manager_missing_blocks_by_authority",
"The number of new missing blocks by block authority",
&["authority"],
registry,
).unwrap(),
block_manager_missing_ancestors_by_authority: register_int_counter_vec_with_registry!(
"block_manager_missing_ancestors_by_authority",
"The number of missing ancestors by ancestor authority",
mwtian marked this conversation as resolved.
Show resolved Hide resolved
&["authority"],
registry,
).unwrap(),
threshold_clock_round: register_int_gauge_with_registry!(
"threshold_clock_round",
"The current threshold clock round. We only advance to a new round when a quorum of parents have been synced.",
Expand Down
Loading