diff --git a/cl/monitor/metrics.go b/cl/monitor/metrics.go index a3b012c111b..609ea8de3af 100644 --- a/cl/monitor/metrics.go +++ b/cl/monitor/metrics.go @@ -24,6 +24,9 @@ var ( attestationBlockProcessingTime = metrics.GetOrCreateGauge("attestation_block_processing_time") batchVerificationThroughput = metrics.GetOrCreateGauge("aggregation_per_signature") + // Epoch processing metrics + epochProcessingTime = metrics.GetOrCreateGauge("epoch_processing_time") + // Network metrics gossipTopicsMetricCounterPrefix = "gossip_topics_seen" gossipMetricsMap = sync.Map{} @@ -54,6 +57,11 @@ func microToMilli(micros int64) float64 { return float64(micros) / 1000 } +// ObserveEpochProcessingTime sets last epoch processing time +func ObserveEpochProcessingTime(startTime time.Time) { + epochProcessingTime.Set(float64(time.Since(startTime).Microseconds())) +} + // ObserveAttestHit increments the attestation hit metric func ObserveAttestationBlockProcessingTime(startTime time.Time) { attestationBlockProcessingTime.Set(microToMilli(time.Since(startTime).Microseconds())) diff --git a/cl/transition/impl/eth2/operations.go b/cl/transition/impl/eth2/operations.go index 37b35009912..bc0a75521f2 100644 --- a/cl/transition/impl/eth2/operations.go +++ b/cl/transition/impl/eth2/operations.go @@ -984,6 +984,7 @@ func (I *impl) ProcessSlots(s abstract.BeaconState, slot uint64) error { "process_epoch_elpsed", time.Since(start), ) + monitor.ObserveEpochProcessingTime(start) } sSlot += 1