Skip to content

Commit

Permalink
feat(issue-12348): add validator index label to validator_statuses me…
Browse files Browse the repository at this point in the history
…tric
  • Loading branch information
0xste committed Sep 24, 2024
1 parent 315c05b commit 3d409ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
- Updated k8s-io/client-go to v0.30.4 and k8s-io/apimachinery to v0.30.4
- Migrated tracing library from opencensus to opentelemetry for both the beacon node and validator.
- Refactored light client code to make it more readable and make future PRs easier.
- Added validator index label to `validator_statuses` metric

### Deprecated
- `--disable-grpc-gateway` flag is deprecated due to grpc gateway removal.
Expand Down
4 changes: 2 additions & 2 deletions validator/client/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ 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",
Name: "statuses",
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.
Expand Down
4 changes: 2 additions & 2 deletions validator/client/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ func (v *validator) checkAndLogValidatorStatus(activeValCount int64) 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:
Expand Down

0 comments on commit 3d409ba

Please sign in to comment.