Skip to content

Commit

Permalink
get metrics for the number of indices in aggregate and proof (#12389)
Browse files Browse the repository at this point in the history
Co-authored-by: shota.silagadze <shota.silagadze@taal.com>
  • Loading branch information
shotasilagadze and shotasilagadzetaal authored Oct 23, 2024
1 parent 78f3647 commit cdf9e83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cl/monitor/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var (
metricProposerHit = metrics.GetOrCreateCounter("validator_proposal_hit")
// metricProposerMiss is the number of proposals that miss for those validators we observe in previous slot
metricProposerMiss = metrics.GetOrCreateCounter("validator_proposal_miss")
// aggregateAndProofSignatures is the sum of signatures in all the aggregates in the recent slot
aggregateAndProofSignatures = metrics.GetOrCreateGauge("aggregate_and_proof_signatures")

// Block processing metrics
fullBlockProcessingTime = metrics.GetOrCreateGauge("full_block_processing_time")
Expand Down Expand Up @@ -122,6 +124,11 @@ func microToMilli(micros int64) float64 {
return float64(micros) / 1000
}

// ObserveNumberOfAggregateSignatures sets the average processing time for each attestation in aggregate
func ObserveNumberOfAggregateSignatures(signatures int) {
aggregateAndProofSignatures.Add(float64(signatures))
}

// ObserveEpochProcessingTime sets last epoch processing time
func ObserveEpochProcessingTime(startTime time.Time) {
epochProcessingTime.Set(float64(time.Since(startTime).Microseconds()))
Expand Down Expand Up @@ -218,6 +225,9 @@ func ObserveActiveValidatorsCount(count int) {
}

func ObserveCurrentSlot(slot uint64) {
if currentSlot.GetValueUint64() != slot {
aggregateAndProofSignatures.Set(0)
}
currentSlot.Set(float64(slot))
}

Expand Down
2 changes: 2 additions & 0 deletions cl/phase1/network/services/aggregate_and_proof_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ func (a *aggregateAndProofServiceImpl) ProcessMessage(
return errors.New("no attesting indicies")
}

monitor.ObserveNumberOfAggregateSignatures(len(attestingIndices))

// [REJECT] The aggregator's validator index is within the committee -- i.e. aggregate_and_proof.aggregator_index in get_beacon_committee(state, aggregate.data.slot, index).
if !slices.Contains(committee, aggregateAndProof.SignedAggregateAndProof.Message.AggregatorIndex) {
return errors.New("committee index not in committee")
Expand Down

0 comments on commit cdf9e83

Please sign in to comment.