From adb44c13729e617bd1577ad27e9725e74cf896fd Mon Sep 17 00:00:00 2001 From: Marcin Zawiejski Date: Thu, 25 Sep 2025 16:05:53 +0200 Subject: [PATCH] fix for missing votes telemetry with logging level less than info --- agreement/pseudonode.go | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/agreement/pseudonode.go b/agreement/pseudonode.go index 54c9fde7df..c0699c6ccb 100644 --- a/agreement/pseudonode.go +++ b/agreement/pseudonode.go @@ -415,23 +415,25 @@ func (t pseudonodeVotesTask) execute(verifier *AsyncVoteVerifier, quit chan stru for _, result := range verifiedResults { totalWeight += result.v.Cred.Weight } - if t.node.log.IsLevelEnabled(logging.Info) { + if t.node.log.IsLevelEnabled(logging.Info) || t.node.log.GetTelemetryEnabled() { for _, result := range verifiedResults { vote := result.v - logEvent := logspec.AgreementEvent{ - Type: logspec.VoteBroadcast, - Sender: vote.R.Sender.String(), - Hash: vote.R.Proposal.BlockDigest.String(), - Round: uint64(t.round), - Period: uint64(t.period), - Step: uint64(t.step), - ObjectRound: uint64(vote.R.Round), - ObjectPeriod: uint64(vote.R.Period), - ObjectStep: uint64(vote.R.Step), - Weight: vote.Cred.Weight, - WeightTotal: totalWeight, + if t.node.log.IsLevelEnabled(logging.Info) { + logEvent := logspec.AgreementEvent{ + Type: logspec.VoteBroadcast, + Sender: vote.R.Sender.String(), + Hash: vote.R.Proposal.BlockDigest.String(), + Round: uint64(t.round), + Period: uint64(t.period), + Step: uint64(t.step), + ObjectRound: uint64(vote.R.Round), + ObjectPeriod: uint64(vote.R.Period), + ObjectStep: uint64(vote.R.Step), + Weight: vote.Cred.Weight, + WeightTotal: totalWeight, + } + t.node.log.with(logEvent).Infof("vote created for broadcast (weight %d, total weight %d)", vote.Cred.Weight, totalWeight) } - t.node.log.with(logEvent).Infof("vote created for broadcast (weight %d, total weight %d)", vote.Cred.Weight, totalWeight) if !t.node.log.GetTelemetryEnabled() { continue } @@ -445,7 +447,9 @@ func (t pseudonodeVotesTask) execute(verifier *AsyncVoteVerifier, quit chan stru // Recovered: false, }) } - t.node.log.Infof("pseudonode.makeVotes: %v votes created for %v at (%v, %v, %v), total weight %v", len(verifiedResults), t.prop, t.round, t.period, t.step, totalWeight) + if t.node.log.IsLevelEnabled(logging.Info) { + t.node.log.Infof("pseudonode.makeVotes: %v votes created for %v at (%v, %v, %v), total weight %v", len(verifiedResults), t.prop, t.round, t.period, t.step, totalWeight) + } } if len(verifiedResults) > 0 { // wait until the persist state is flushed, as we don't want to send any vote unless we've completed flushing it to disk.