diff --git a/CHANGELOG.md b/CHANGELOG.md index 91bc8dfb584..282ded54b7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Add ability to rollback node's internal state during processing. - Change how unsafe protobuf state is created to prevent unnecessary copies. - Added benchmarks for process slots for Capella, Deneb, Electra +- Added validator index label to `validator_statuses` metric ### Changed diff --git a/validator/client/metrics.go b/validator/client/metrics.go index d8ea5f91e85..7d17dfe44ec 100644 --- a/validator/client/metrics.go +++ b/validator/client/metrics.go @@ -16,7 +16,7 @@ import ( ) var ( - // ValidatorStatusesGaugeVec used to track validator statuses by public key. + // ValidatorStatusesGaugeVec used to track validator statuses by public key and validator index. ValidatorStatusesGaugeVec = promauto.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "validator", @@ -24,7 +24,7 @@ var ( Help: "validator statuses: 0 UNKNOWN, 1 DEPOSITED, 2 PENDING, 3 ACTIVE, 4 EXITING, 5 SLASHING, 6 EXITED", }, []string{ - "pubkey", + "pubkey", "index", }, ) // ValidatorAggSuccessVec used to count successful aggregations. diff --git a/validator/client/validator.go b/validator/client/validator.go index 53628e99af1..29cd3421a54 100644 --- a/validator/client/validator.go +++ b/validator/client/validator.go @@ -361,8 +361,8 @@ func (v *validator) checkAndLogValidatorStatus() bool { } log := log.WithFields(fields) if v.emitAccountMetrics { - fmtKey := fmt.Sprintf("%#x", s.publicKey) - ValidatorStatusesGaugeVec.WithLabelValues(fmtKey).Set(float64(s.status.Status)) + fmtKey, fmtIndex := fmt.Sprintf("%#x", s.publicKey), fmt.Sprintf("%#x", s.index) + ValidatorStatusesGaugeVec.WithLabelValues(fmtKey, fmtIndex).Set(float64(s.status.Status)) } switch s.status.Status { case ethpb.ValidatorStatus_UNKNOWN_STATUS: