From 0470d370728a519066d81929437055047be4b82f Mon Sep 17 00:00:00 2001 From: terence tsao Date: Mon, 24 Feb 2020 08:28:22 -0800 Subject: [PATCH] Consider missing validator count for performance metric (#4928) * Consider missing validator count * Use validator count reported * Merge branch 'master' into missing-validators * Merge refs/heads/master into missing-validators --- validator/client/validator_metrics.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/validator/client/validator_metrics.go b/validator/client/validator_metrics.go index a58a93a9086..b8344a2ffaf 100644 --- a/validator/client/validator_metrics.go +++ b/validator/client/validator_metrics.go @@ -61,6 +61,7 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot uint64) votedTarget := 0 votedHead := 0 + reported := 0 for i, pkey := range pubKeys { pubKey := fmt.Sprintf("%#x", pkey[:8]) log := log.WithField("pubKey", pubKey) @@ -95,21 +96,23 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot uint64) } } - if i < len(resp.InclusionSlots) && resp.InclusionSlots[i] != ^uint64(0) { + if reported < len(resp.InclusionSlots) && resp.InclusionSlots[i] != ^uint64(0) { included++ } - if i < len(resp.CorrectlyVotedSource) && resp.CorrectlyVotedSource[i] { + if reported < len(resp.CorrectlyVotedSource) && resp.CorrectlyVotedSource[i] { votedSource++ } - if i < len(resp.CorrectlyVotedTarget) && resp.CorrectlyVotedTarget[i] { + if reported < len(resp.CorrectlyVotedTarget) && resp.CorrectlyVotedTarget[i] { votedTarget++ } - if i < len(resp.CorrectlyVotedHead) && resp.CorrectlyVotedHead[i] { + if reported < len(resp.CorrectlyVotedHead) && resp.CorrectlyVotedHead[i] { votedHead++ } - if i < len(resp.BalancesAfterEpochTransition) { + if reported < len(resp.BalancesAfterEpochTransition) { v.prevBalance[bytesutil.ToBytes48(pkey)] = resp.BalancesBeforeEpochTransition[i] } + + reported++ } log.WithFields(logrus.Fields{