diff --git a/operator/validator/controller.go b/operator/validator/controller.go index e08e62b4a2..3076c6c7e5 100644 --- a/operator/validator/controller.go +++ b/operator/validator/controller.go @@ -6,6 +6,7 @@ import ( "encoding/hex" "encoding/json" "fmt" + "math" "sync" "time" @@ -310,6 +311,9 @@ func (c *controller) GetValidatorStats() (uint64, uint64, uint64, error) { active++ } } + if operatorShares <= math.MaxInt64 { + validatorsCountGauge.Record(c.ctx, int64(operatorShares)) + } return uint64(len(allShares)), active, operatorShares, nil } diff --git a/operator/validator/observability.go b/operator/validator/observability.go index 1386c5cd4a..a5daa95d45 100644 --- a/operator/validator/observability.go +++ b/operator/validator/observability.go @@ -36,8 +36,13 @@ var ( validatorStatusCounter = observability.NewMetric( meter.Int64Counter( - metricName("validators"), + metricName("validators.per_status"), metric.WithDescription("total number of validators by status"))) + + validatorsCountGauge = observability.NewMetric( + meter.Int64Gauge( + metricName("validators.active"), + metric.WithDescription("number of active validators"))) ) func metricName(name string) string {