Skip to content

Commit

Permalink
Squashed commit of #2439
Browse files Browse the repository at this point in the history
commit 8847bd0
Author: Paul Hauner <[email protected]>
Date:   Thu Jul 8 18:24:00 2021 +1000

    Add metrics for sync committee fullness
  • Loading branch information
paulhauner committed Jul 8, 2021
1 parent 1c78a39 commit e8f79a0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2185,6 +2185,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
block.body().attestations().len() as f64,
);

if let Ok(block) = block.as_altair() {
metrics::set_gauge(
&metrics::BLOCK_SYNC_AGGREGATE_SET_BITS,
block.body.sync_aggregate.num_set_bits() as i64,
);
}

let db_write_timer = metrics::start_timer(&metrics::BLOCK_PROCESSING_DB_WRITE);

// Store the block and its state, and execute the confirmation batch for the intermediate
Expand Down
4 changes: 4 additions & 0 deletions beacon_node/beacon_chain/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ lazy_static! {
"beacon_block_processing_attestation_observation_seconds",
"Time spent hashing and remembering all the attestations in the block"
);
pub static ref BLOCK_SYNC_AGGREGATE_SET_BITS: Result<IntGauge> = try_create_int_gauge(
"block_sync_aggregate_set_bits",
"The number of true bits in the last sync aggregate in a block"
);

/*
* Block Production
Expand Down
5 changes: 5 additions & 0 deletions consensus/types/src/sync_aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,9 @@ impl<T: EthSpec> SyncAggregate<T> {
sync_committee_signature: AggregateSignature::empty(),
}
}

/// Returns how many bits are `true` in `self.sync_committee_bits`.
pub fn num_set_bits(&self) -> usize {
self.sync_committee_bits.num_set_bits()
}
}

0 comments on commit e8f79a0

Please sign in to comment.