From f061d57ce5adee6278fcb47aac9a6710f04604df Mon Sep 17 00:00:00 2001 From: Mikel Alejo Date: Fri, 13 Dec 2024 15:19:56 +0100 Subject: [PATCH] RHCLOUD-36895 | refactor: reduce logging noise (#241) * refactor: reduce logging noise The log messages about the ignored committed offsets are not really useful unless we are debugging problems with that. Therefore, we could simply leave an error log message for when the offset committing goes wrong, and a debug one when we really want to know that offsets are being committed. RHCLOUD-36895 * refactor: implement feedback RHCLOUD-36895 --- internal/kafka/kafka.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/kafka/kafka.go b/internal/kafka/kafka.go index 6ce7cef..bc1b0ec 100644 --- a/internal/kafka/kafka.go +++ b/internal/kafka/kafka.go @@ -94,8 +94,16 @@ func NewConsumerEventLoop( case kafka.Error: endpoints.IncConsumeErrors() l.Log.Errorf("Consumer error: %v (%v)\n", e.Code(), e) + case kafka.OffsetsCommitted: + if e.Error != nil { + l.Log.Errorf("Unable to commit offset: %#v", e) + break + } + + l.Log.Tracef("Ignored OffsetsComitted: %#v", e) + default: - l.Log.Infof("Ignored %v\n", e) + l.Log.Infof("Ignored Kafka event: %#v\n", e) } }