Skip to content

Commit

Permalink
add epoch processing metric (#12144)
Browse files Browse the repository at this point in the history
Co-authored-by: shota.silagadze <[email protected]>
  • Loading branch information
shotasilagadze and shotasilagadzetaal authored Oct 1, 2024
1 parent 7086799 commit 858d6d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cl/monitor/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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()))
Expand Down
1 change: 1 addition & 0 deletions cl/transition/impl/eth2/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 858d6d5

Please sign in to comment.