mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 17:26:04 +00:00
Add cache metrics
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
use super::Error;
|
use super::Error;
|
||||||
use crate::{BeaconChain, BeaconChainTypes};
|
use crate::{metrics, BeaconChain, BeaconChainTypes};
|
||||||
use proto_array_fork_choice::ProtoArrayForkChoice;
|
use proto_array_fork_choice::ProtoArrayForkChoice;
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use types::{BeaconState, Checkpoint, Epoch, EthSpec, Hash256, Slot};
|
use types::{BeaconState, Checkpoint, Epoch, EthSpec, Hash256, Slot};
|
||||||
@@ -201,8 +201,12 @@ impl CheckpointManager {
|
|||||||
chain: &BeaconChain<T>,
|
chain: &BeaconChain<T>,
|
||||||
) -> Result<Vec<u64>, Error> {
|
) -> Result<Vec<u64>, Error> {
|
||||||
if let Some(balances) = self.balances_cache.get(block_root) {
|
if let Some(balances) = self.balances_cache.get(block_root) {
|
||||||
|
metrics::inc_counter(&metrics::BALANCES_CACHE_HITS);
|
||||||
|
|
||||||
Ok(balances)
|
Ok(balances)
|
||||||
} else {
|
} else {
|
||||||
|
metrics::inc_counter(&metrics::BALANCES_CACHE_MISSES);
|
||||||
|
|
||||||
let block = chain
|
let block = chain
|
||||||
.get_block_caching(&block_root)?
|
.get_block_caching(&block_root)?
|
||||||
.ok_or_else(|| Error::UnknownJustifiedBlock(block_root))?;
|
.ok_or_else(|| Error::UnknownJustifiedBlock(block_root))?;
|
||||||
|
|||||||
@@ -138,6 +138,10 @@ lazy_static! {
|
|||||||
"beacon_fork_choice_process_attestation_seconds",
|
"beacon_fork_choice_process_attestation_seconds",
|
||||||
"Time taken to add an attestation to fork choice"
|
"Time taken to add an attestation to fork choice"
|
||||||
);
|
);
|
||||||
|
pub static ref BALANCES_CACHE_HITS: Result<IntCounter> =
|
||||||
|
try_create_int_counter("beacon_balances_cache_hits_total", "Count of times balances cache fulfils request");
|
||||||
|
pub static ref BALANCES_CACHE_MISSES: Result<IntCounter> =
|
||||||
|
try_create_int_counter("beacon_balances_cache_misses_total", "Count of times balances cache fulfils request");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Persisting BeaconChain to disk
|
* Persisting BeaconChain to disk
|
||||||
|
|||||||
Reference in New Issue
Block a user