Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Always Update Metrics on Peer Inspection, Even When Logging is Skipped #1814

Open
wants to merge 1 commit into
base: stage
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions network/topics/scoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ func scoreInspector(logger *zap.Logger,
}
gossipScoreIndex.SetScores(peerScores)

// Skip if it's not time to log yet.
if inspections%logFrequency != 0 {
inspections++
return
}
inspections++

// Reset metrics before updating them.
metrics.ResetPeerScores()

Expand Down Expand Up @@ -154,6 +147,11 @@ func scoreInspector(logger *zap.Logger,
// Short logs per topic https://github.com/ssvlabs/ssv/issues/1666
invalidMessagesStats := formatInvalidMessageStats(filtered)

if inspections%logFrequency != 0 {
// Don't log yet.
continue
}

// Log.
fields := []zap.Field{
fields.PeerID(pid),
Expand Down Expand Up @@ -185,6 +183,8 @@ func scoreInspector(logger *zap.Logger,
// zap.Any("scores", scores), zap.Any("topicScores", peerScores.Topics))
//}
}

inspections++
}
}

Expand Down
Loading