Skip to content

Commit 2ffb739

Browse files
committed
Re-added block_availability_delay and utilized it
1 parent 86c65d6 commit 2ffb739

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4322,6 +4322,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
43224322
payload_verification_status: PayloadVerificationStatus,
43234323
current_slot: Slot,
43244324
) {
4325+
let block_delay_total =
4326+
get_slot_delay_ms(block_time_imported, block.slot(), &self.slot_clock);
4327+
43254328
// Only present some metrics for blocks from the previous epoch or later.
43264329
//
43274330
// This helps avoid noise in the metrics during sync.
@@ -4331,6 +4334,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
43314334
block.body().attestations_len() as f64,
43324335
);
43334336

4337+
metrics::set_gauge(
4338+
&metrics::BLOCK_AVAILABILITY_DELAY,
4339+
block_delay_total.as_secs() as i64,
4340+
);
4341+
43344342
if let Ok(sync_aggregate) = block.body().sync_aggregate() {
43354343
metrics::set_gauge(
43364344
&metrics::BLOCK_SYNC_AGGREGATE_SET_BITS,
@@ -4339,9 +4347,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
43394347
}
43404348
}
43414349

4342-
let block_delay_total =
4343-
get_slot_delay_ms(block_time_imported, block.slot(), &self.slot_clock);
4344-
43454350
// Do not write to the cache for blocks older than 2 epochs, this helps reduce writes to
43464351
// the cache during sync.
43474352
if block_delay_total < self.slot_clock.slot_duration() * 64 {

beacon_node/beacon_chain/src/metrics.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,16 @@ pub static BLOCK_PRODUCTION_BLOBS_VERIFICATION_TIMES: LazyLock<Result<Histogram>
18351835
},
18361836
);
18371837

1838+
/*
1839+
* Availability related metrics
1840+
*/
1841+
pub static BLOCK_AVAILABILITY_DELAY: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
1842+
try_create_int_gauge(
1843+
"block_availability_delay",
1844+
"Duration between start of the slot and the time at which all components of the block are available.",
1845+
)
1846+
});
1847+
18381848
/*
18391849
* Data Availability cache metrics
18401850
*/

0 commit comments

Comments
 (0)