From e0e3b4d1c2c1f773bbacee2503fad4246b0fba0e Mon Sep 17 00:00:00 2001 From: ZayanKhan-12 <108294002+ZayanKhan-12@users.noreply.github.com> Date: Wed, 22 Jul 2026 13:04:46 -0400 Subject: [PATCH] Fix misleading fields in log statements - decodeAndSendOffset logged offsetValue.Offset and offsetValue.Timestamp in its decode-failure warning, but the decoder returns early on error, so those fields are zero or only partially filled in. Logging them makes a failed decode look like a real offset. Log only the reason, consistent with every other decode-failure warning in the file. - manageEvalLoop logged "starting evaluations" and "stopping evaluations" with zap.Error(err), where err is the result of the earlier lock.Lock() call and is always nil on these paths (the error case continues the loop). The field never carries information; drop it. Co-Authored-By: Claude Fable 5 --- core/internal/consumer/kafka_client.go | 3 +-- core/internal/notifier/coordinator.go | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/internal/consumer/kafka_client.go b/core/internal/consumer/kafka_client.go index 98c61081..10404775 100644 --- a/core/internal/consumer/kafka_client.go +++ b/core/internal/consumer/kafka_client.go @@ -502,9 +502,8 @@ func (module *KafkaClient) decodeKeyAndOffset(offsetOrder int64, keyBuffer *byte func (module *KafkaClient) decodeAndSendOffset(offsetOrder int64, offsetKey offsetKey, valueBuffer *bytes.Buffer, logger *zap.Logger, decoder func(*bytes.Buffer) (offsetValue, string)) { offsetValue, errorAt := decoder(valueBuffer) if errorAt != "" { + // Don't log offsetValue fields - the decoder returned early, so they are zero or only partially filled in logger.Warn("failed to decode", - zap.Int64("offset", offsetValue.Offset), - zap.Int64("timestamp", offsetValue.Timestamp), zap.String("reason", errorAt), ) return diff --git a/core/internal/notifier/coordinator.go b/core/internal/notifier/coordinator.go index 5cab2906..550ada3a 100644 --- a/core/internal/notifier/coordinator.go +++ b/core/internal/notifier/coordinator.go @@ -310,14 +310,14 @@ func (nc *Coordinator) manageEvalLoop() { nc.doEvaluations = true nc.running.Add(1) go nc.sendEvaluatorRequests() - nc.Log.Info("starting evaluations", zap.Error(err)) + nc.Log.Info("starting evaluations") // Wait for ZK session expiration, and stop doing evaluations if it happens nc.App.ZookeeperExpired.L.Lock() nc.App.ZookeeperExpired.Wait() nc.App.ZookeeperExpired.L.Unlock() nc.doEvaluations = false - nc.Log.Info("stopping evaluations", zap.Error(err)) + nc.Log.Info("stopping evaluations") // Wait for the ZK connection to come back before trying again for !nc.App.ZookeeperConnected {