mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 21:08:32 +00:00
Additional light client metrics (#6545)
* Fix db query and add some additional metrics * fmt * Update beacon_node/beacon_chain/src/metrics.rs Co-authored-by: Jimmy Chen <jchen.tc@gmail.com> * Update beacon_node/beacon_chain/src/metrics.rs Co-authored-by: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -85,6 +85,7 @@ impl<T: BeaconChainTypes> LightClientServerCache<T> {
|
||||
log: &Logger,
|
||||
chain_spec: &ChainSpec,
|
||||
) -> Result<(), BeaconChainError> {
|
||||
metrics::inc_counter(&metrics::LIGHT_CLIENT_SERVER_CACHE_PROCESSING_REQUESTS);
|
||||
let _timer =
|
||||
metrics::start_timer(&metrics::LIGHT_CLIENT_SERVER_CACHE_RECOMPUTE_UPDATES_TIMES);
|
||||
|
||||
@@ -205,6 +206,7 @@ impl<T: BeaconChainTypes> LightClientServerCache<T> {
|
||||
*self.latest_light_client_update.write() = Some(new_light_client_update);
|
||||
}
|
||||
|
||||
metrics::inc_counter(&metrics::LIGHT_CLIENT_SERVER_CACHE_PROCESSING_SUCCESSES);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -280,6 +282,11 @@ impl<T: BeaconChainTypes> LightClientServerCache<T> {
|
||||
let (sync_committee_bytes, light_client_update_bytes) = res?;
|
||||
let sync_committee_period = u64::from_ssz_bytes(&sync_committee_bytes)
|
||||
.map_err(store::errors::Error::SszDecodeError)?;
|
||||
|
||||
if sync_committee_period >= start_period + count {
|
||||
break;
|
||||
}
|
||||
|
||||
let epoch = sync_committee_period
|
||||
.safe_mul(chain_spec.epochs_per_sync_committee_period.into())?;
|
||||
|
||||
@@ -290,10 +297,6 @@ impl<T: BeaconChainTypes> LightClientServerCache<T> {
|
||||
.map_err(store::errors::Error::SszDecodeError)?;
|
||||
|
||||
light_client_updates.push(light_client_update);
|
||||
|
||||
if sync_committee_period >= start_period + count {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(light_client_updates)
|
||||
}
|
||||
|
||||
@@ -1972,6 +1972,22 @@ pub static LIGHT_CLIENT_SERVER_CACHE_PREV_BLOCK_CACHE_MISS: LazyLock<Result<IntC
|
||||
)
|
||||
});
|
||||
|
||||
pub static LIGHT_CLIENT_SERVER_CACHE_PROCESSING_REQUESTS: LazyLock<Result<IntCounter>> =
|
||||
LazyLock::new(|| {
|
||||
try_create_int_counter(
|
||||
"beacon_light_client_server_cache_processing_requests",
|
||||
"Count of all requests to recompute and cache updates",
|
||||
)
|
||||
});
|
||||
|
||||
pub static LIGHT_CLIENT_SERVER_CACHE_PROCESSING_SUCCESSES: LazyLock<Result<IntCounter>> =
|
||||
LazyLock::new(|| {
|
||||
try_create_int_counter(
|
||||
"beacon_light_client_server_cache_processing_successes",
|
||||
"Count of all successful requests to recompute and cache updates",
|
||||
)
|
||||
});
|
||||
|
||||
/// Scrape the `beacon_chain` for metrics that are not constantly updated (e.g., the present slot,
|
||||
/// head state info, etc) and update the Prometheus `DEFAULT_REGISTRY`.
|
||||
pub fn scrape_for_metrics<T: BeaconChainTypes>(beacon_chain: &BeaconChain<T>) {
|
||||
|
||||
Reference in New Issue
Block a user