mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-11 00:18:06 -05:00
Add metrics per keys for next scheduled attestation and proposal (#8583)
* Add metrics per keys for next scheduled attestation and proposal * Found a better place where to update the counters * Wrap with emitAccountMetrics flag
This commit is contained in:
@@ -172,6 +172,28 @@ var (
|
||||
"pubkey",
|
||||
},
|
||||
)
|
||||
// ValidatorNextAttestationSlotGaugeVec used to track validator statuses by public key.
|
||||
ValidatorNextAttestationSlotGaugeVec = promauto.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: "validator",
|
||||
Name: "next_attestation_slot",
|
||||
Help: "validator next scheduled attestation slot",
|
||||
},
|
||||
[]string{
|
||||
"pubkey",
|
||||
},
|
||||
)
|
||||
// ValidatorNextProposalSlotGaugeVec used to track validator statuses by public key.
|
||||
ValidatorNextProposalSlotGaugeVec = promauto.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: "validator",
|
||||
Name: "next_proposal_slot",
|
||||
Help: "validator next scheduled proposal slot",
|
||||
},
|
||||
[]string{
|
||||
"pubkey",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
// LogValidatorGainsAndLosses logs important metrics related to this validator client's
|
||||
|
||||
@@ -634,9 +634,9 @@ func (v *validator) logDuties(slot types.Slot, duties []*ethpb.DutiesResponse_Du
|
||||
slotOffset := slot - (slot % params.BeaconConfig().SlotsPerEpoch)
|
||||
var totalAttestingKeys uint64
|
||||
for _, duty := range duties {
|
||||
validatorNotTruncatedKey := fmt.Sprintf("%#x", duty.PublicKey)
|
||||
if v.emitAccountMetrics {
|
||||
fmtKey := fmt.Sprintf("%#x", duty.PublicKey)
|
||||
ValidatorStatusesGaugeVec.WithLabelValues(fmtKey).Set(float64(duty.Status))
|
||||
ValidatorStatusesGaugeVec.WithLabelValues(validatorNotTruncatedKey).Set(float64(duty.Status))
|
||||
}
|
||||
|
||||
// Only interested in validators who are attesting/proposing.
|
||||
@@ -652,6 +652,9 @@ func (v *validator) logDuties(slot types.Slot, duties []*ethpb.DutiesResponse_Du
|
||||
} else {
|
||||
attesterKeys[duty.AttesterSlot-slotOffset] = append(attesterKeys[duty.AttesterSlot-slotOffset], validatorKey)
|
||||
totalAttestingKeys++
|
||||
if v.emitAccountMetrics {
|
||||
ValidatorNextAttestationSlotGaugeVec.WithLabelValues(validatorNotTruncatedKey).Set(float64(duty.AttesterSlot))
|
||||
}
|
||||
}
|
||||
|
||||
for _, proposerSlot := range duty.ProposerSlots {
|
||||
@@ -661,6 +664,9 @@ func (v *validator) logDuties(slot types.Slot, duties []*ethpb.DutiesResponse_Du
|
||||
} else {
|
||||
proposerKeys[proposerIndex] = validatorKey
|
||||
}
|
||||
if v.emitAccountMetrics {
|
||||
ValidatorNextProposalSlotGaugeVec.WithLabelValues(validatorNotTruncatedKey).Set(float64(proposerSlot))
|
||||
}
|
||||
}
|
||||
}
|
||||
for i := types.Slot(0); i < params.BeaconConfig().SlotsPerEpoch; i++ {
|
||||
|
||||
Reference in New Issue
Block a user