mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-24 00:08:27 +00:00
Add sync batch state metrics (#8847)
Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -12,14 +12,16 @@ use lighthouse_network::{
|
||||
};
|
||||
use logging::crit;
|
||||
use std::hash::{DefaultHasher, Hash, Hasher};
|
||||
use strum::IntoEnumIterator;
|
||||
use tracing::{debug, error, info, info_span, warn};
|
||||
use types::{DataColumnSidecarList, Epoch, EthSpec};
|
||||
|
||||
use crate::metrics;
|
||||
use crate::sync::{
|
||||
backfill_sync::{BACKFILL_EPOCHS_PER_BATCH, ProcessResult, SyncStart},
|
||||
batch::{
|
||||
BatchConfig, BatchId, BatchInfo, BatchOperationOutcome, BatchProcessingResult, BatchState,
|
||||
ByRangeRequestType,
|
||||
BatchConfig, BatchId, BatchInfo, BatchMetricsState, BatchOperationOutcome,
|
||||
BatchProcessingResult, BatchState, ByRangeRequestType,
|
||||
},
|
||||
block_sidecar_coupling::CouplingError,
|
||||
manager::CustodyBatchProcessResult,
|
||||
@@ -1114,6 +1116,21 @@ impl<T: BeaconChainTypes> CustodyBackFillSync<T> {
|
||||
*self.network_globals.custody_sync_state.write() = state;
|
||||
}
|
||||
|
||||
pub fn register_metrics(&self) {
|
||||
for state in BatchMetricsState::iter() {
|
||||
let count = self
|
||||
.batches
|
||||
.values()
|
||||
.filter(|b| b.state().metrics_state() == state)
|
||||
.count();
|
||||
metrics::set_gauge_vec(
|
||||
&metrics::SYNCING_CHAIN_BATCHES,
|
||||
&["custody_backfill", state.into()],
|
||||
count as i64,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A fully synced peer has joined us.
|
||||
/// If we are in a failed state, update a local variable to indicate we are able to restart
|
||||
/// the failed sync on the next attempt.
|
||||
|
||||
Reference in New Issue
Block a user