show full public key in metrics (#4988)

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
tzapu 2020-03-03 18:36:49 +02:00 committed by GitHub
parent 4c43616647
commit c09ae21ab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 5 deletions

View File

@ -48,7 +48,7 @@ func (v *validator) SubmitAggregateAndProof(ctx context.Context, slot uint64, pu
defer span.End()
span.AddAttributes(trace.StringAttribute("validator", fmt.Sprintf("%#x", pubKey)))
fmtKey := fmt.Sprintf("%#x", pubKey[:8])
fmtKey := fmt.Sprintf("%#x", pubKey[:])
duty, err := v.duty(pubKey)
if err != nil {

View File

@ -54,7 +54,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot uint64, pubKey [
defer span.End()
span.AddAttributes(trace.StringAttribute("validator", fmt.Sprintf("%#x", pubKey)))
fmtKey := fmt.Sprintf("%#x", pubKey[:8])
fmtKey := fmt.Sprintf("%#x", pubKey[:])
log := log.WithField("pubKey", fmt.Sprintf("%#x", bytesutil.Trunc(pubKey[:]))).WithField("slot", slot)
duty, err := v.duty(pubKey)
if err != nil {

View File

@ -65,10 +65,11 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot uint64)
for _, pkey := range pubKeys {
pubKey := fmt.Sprintf("%#x", pkey[:8])
log := log.WithField("pubKey", pubKey)
fmtKey := fmt.Sprintf("%#x", pkey[:])
if missingValidators[bytesutil.ToBytes48(pkey)] {
log.Info("Validator not in beacon chain")
if v.emitAccountMetrics {
validatorBalancesGaugeVec.WithLabelValues(pubKey).Set(0)
validatorBalancesGaugeVec.WithLabelValues(fmtKey).Set(0)
}
continue
}
@ -92,7 +93,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(pubKey).Set(newBalance)
validatorBalancesGaugeVec.WithLabelValues(fmtKey).Set(newBalance)
}
}

View File

@ -56,7 +56,7 @@ func (v *validator) ProposeBlock(ctx context.Context, slot uint64, pubKey [48]by
}
ctx, span := trace.StartSpan(ctx, "validator.ProposeBlock")
defer span.End()
fmtKey := fmt.Sprintf("%#x", pubKey[:8])
fmtKey := fmt.Sprintf("%#x", pubKey[:])
span.AddAttributes(trace.StringAttribute("validator", fmt.Sprintf("%#x", pubKey)))
log := log.WithField("pubKey", fmt.Sprintf("%#x", bytesutil.Trunc(pubKey[:])))