Fix pubkey used in validator metrics (#6246)

* Fix validator metrics pubkey
* Merge branch 'master' into val-metrics
This commit is contained in:
Ivan Martinez 2020-06-14 04:28:26 -04:00 committed by GitHub
parent caf61bd824
commit f6ecf66d1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,6 +73,7 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot uint64)
v.prevBalance[pubKeyBytes] = params.BeaconConfig().MaxEffectiveBalance
}
fmtKey := fmt.Sprintf("%#x", pubKey)
truncatedKey := fmt.Sprintf("%#x", pubKey[:8])
if v.prevBalance[pubKeyBytes] > 0 {
newBalance := float64(resp.BalancesAfterEpochTransition[i]) / gweiPerEth
@ -91,7 +92,7 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot uint64)
"percentChange": fmt.Sprintf("%.5f%%", percentNet*100),
}).Info("Previous epoch voting summary")
if v.emitAccountMetrics {
validatorBalancesGaugeVec.WithLabelValues(truncatedKey).Set(newBalance)
validatorBalancesGaugeVec.WithLabelValues(fmtKey).Set(newBalance)
}
}