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:
Eitan Seri-Levi
2024-11-15 14:09:54 +07:00
committed by GitHub
parent 5f053b0b6d
commit 654fc6acdc
2 changed files with 23 additions and 4 deletions

View File

@@ -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)
}