Skip to content

Commit

Permalink
show full public key in metrics (#4988)
Browse files Browse the repository at this point in the history
Co-authored-by: Raul Jordan <[email protected]>
  • Loading branch information
tzapu and rauljordan authored Mar 3, 2020
1 parent 4c43616 commit c09ae21
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion validator/client/validator_aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion validator/client/validator_attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions validator/client/validator_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion validator/client/validator_propose.go
Original file line number Diff line number Diff line change
Expand Up @@ -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[:])))
Expand Down

0 comments on commit c09ae21

Please sign in to comment.