mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-28 14:17:17 +00:00
28 lines
696 B
Go
28 lines
696 B
Go
|
package state
|
||
|
|
||
|
import (
|
||
|
"encoding/hex"
|
||
|
|
||
|
"github.com/prometheus/client_golang/prometheus"
|
||
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
||
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
validatorBalancesGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
|
||
|
Name: "state_validator_balances",
|
||
|
Help: "Balances of validators, updated on epoch transition",
|
||
|
}, []string{
|
||
|
"validator",
|
||
|
})
|
||
|
)
|
||
|
|
||
|
func reportEpochTransitionMetrics(state *pb.BeaconState) {
|
||
|
// Validator balances
|
||
|
for i, bal := range state.ValidatorBalances {
|
||
|
validatorBalancesGauge.WithLabelValues(
|
||
|
"0x" + hex.EncodeToString(state.ValidatorRegistry[i].Pubkey), // Validator
|
||
|
).Set(float64(bal))
|
||
|
}
|
||
|
}
|