mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-29 10:54:24 +00:00
Add metrics inside fork-choice crate (#6205)
* Add metrics inside fork-choice crate
This commit is contained in:
@@ -2192,8 +2192,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
&self,
|
||||
verified: &impl VerifiedAttestation<T>,
|
||||
) -> Result<(), Error> {
|
||||
let _timer = metrics::start_timer(&metrics::FORK_CHOICE_PROCESS_ATTESTATION_TIMES);
|
||||
|
||||
self.canonical_head
|
||||
.fork_choice_write_lock()
|
||||
.on_attestation(
|
||||
@@ -3634,8 +3632,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
|
||||
// Register the new block with the fork choice service.
|
||||
{
|
||||
let _fork_choice_block_timer =
|
||||
metrics::start_timer(&metrics::FORK_CHOICE_PROCESS_BLOCK_TIMES);
|
||||
let block_delay = self
|
||||
.slot_clock
|
||||
.seconds_from_current_slot_start()
|
||||
|
||||
@@ -1666,9 +1666,6 @@ impl<T: BeaconChainTypes> ExecutionPendingBlock<T> {
|
||||
|
||||
// Register each attestation in the block with fork choice.
|
||||
for (i, attestation) in block.message().body().attestations().enumerate() {
|
||||
let _fork_choice_attestation_timer =
|
||||
metrics::start_timer(&metrics::FORK_CHOICE_PROCESS_ATTESTATION_TIMES);
|
||||
|
||||
let indexed_attestation = consensus_context
|
||||
.get_indexed_attestation(&state, attestation)
|
||||
.map_err(|e| BlockError::PerBlockProcessingError(e.into_with_index(i)))?;
|
||||
|
||||
@@ -569,19 +569,6 @@ pub static FORK_CHOICE_AFTER_FINALIZATION_TIMES: LazyLock<Result<Histogram>> =
|
||||
exponential_buckets(1e-3, 2.0, 10),
|
||||
)
|
||||
});
|
||||
pub static FORK_CHOICE_PROCESS_BLOCK_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
|
||||
try_create_histogram(
|
||||
"beacon_fork_choice_process_block_seconds",
|
||||
"Time taken to add a block and all attestations to fork choice",
|
||||
)
|
||||
});
|
||||
pub static FORK_CHOICE_PROCESS_ATTESTATION_TIMES: LazyLock<Result<Histogram>> =
|
||||
LazyLock::new(|| {
|
||||
try_create_histogram(
|
||||
"beacon_fork_choice_process_attestation_seconds",
|
||||
"Time taken to add an attestation to fork choice",
|
||||
)
|
||||
});
|
||||
pub static FORK_CHOICE_SET_HEAD_LAG_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
|
||||
try_create_histogram(
|
||||
"beacon_fork_choice_set_head_lag_times",
|
||||
@@ -1955,6 +1942,11 @@ pub fn scrape_for_metrics<T: BeaconChainTypes>(beacon_chain: &BeaconChain<T>) {
|
||||
.validator_monitor
|
||||
.read()
|
||||
.scrape_metrics(&beacon_chain.slot_clock, &beacon_chain.spec);
|
||||
|
||||
beacon_chain
|
||||
.canonical_head
|
||||
.fork_choice_read_lock()
|
||||
.scrape_for_metrics();
|
||||
}
|
||||
|
||||
/// Scrape the given `state` assuming it's the head state, updating the `DEFAULT_REGISTRY`.
|
||||
|
||||
Reference in New Issue
Block a user