Skip to content

Commit

Permalink
Fix percentages for validator metric logging (#5609)
Browse files Browse the repository at this point in the history
* Actually fix percentages
* Merge branch 'master' into fix-percentages
* Merge branch 'master' into fix-percentages
  • Loading branch information
0xKiwi authored Apr 24, 2020
1 parent f9eb546 commit cf98de8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions validator/client/validator_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot uint64)

log.WithFields(logrus.Fields{
"epoch": (slot / params.BeaconConfig().SlotsPerEpoch) - 1,
"attestationInclusionPercentage": fmt.Sprintf("%.2f", float64(included)/float64(len(resp.InclusionSlots)*100)),
"correctlyVotedSourcePercentage": fmt.Sprintf("%.2f", float64(votedSource)/float64(len(resp.CorrectlyVotedSource)*100)),
"correctlyVotedTargetPercentage": fmt.Sprintf("%.2f", float64(votedTarget)/float64(len(resp.CorrectlyVotedTarget)*100)),
"correctlyVotedHeadPercentage": fmt.Sprintf("%.2f", float64(votedHead)/float64(len(resp.CorrectlyVotedHead)*100)),
"attestationInclusionPercentage": fmt.Sprintf("%.0f%%", (float64(included)/float64(len(resp.InclusionSlots)))*100),
"correctlyVotedSourcePercentage": fmt.Sprintf("%.0f%%", (float64(votedSource)/float64(len(resp.CorrectlyVotedSource)))*100),
"correctlyVotedTargetPercentage": fmt.Sprintf("%.0f%%", (float64(votedTarget)/float64(len(resp.CorrectlyVotedTarget)))*100),
"correctlyVotedHeadPercentage": fmt.Sprintf("%.0f%%", (float64(votedHead)/float64(len(resp.CorrectlyVotedHead)))*100),
}).Info("Previous epoch aggregated voting summary")

return nil
Expand Down

0 comments on commit cf98de8

Please sign in to comment.