From 72defc212aa5ade7e21303d1dc2a00ab84a2803c Mon Sep 17 00:00:00 2001 From: Dao Thanh Tung Date: Mon, 13 Feb 2023 19:44:00 +0800 Subject: [PATCH] Kafka Scaler: Improve error logging for `GetBlock()` method (#4233) * Make error logging for method more informative Signed-off-by: dttung2905 * Minor typo fixing Signed-off-by: dttung2905 --------- Signed-off-by: dttung2905 --- CHANGELOG.md | 1 + pkg/scalers/kafka_scaler.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13ca27ad27b..83d867f7afb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ Here is an overview of all new **experimental** features: - **Azure Pipelines Scaler**: Improve error logging for `validatePoolID` ([#3996](https://github.com/kedacore/keda/issues/3996)) - **Azure Pipelines Scaler**: New configuration parameter `requireAllDemands` to scale only if jobs request all demands provided by the scaling definition ([#4138](https://github.com/kedacore/keda/issues/4138)) - **Hashicorp Vault**: Add support to secrets backend version 1 ([#2645](https://github.com/kedacore/keda/issues/2645)) +- **Kafka Scaler**: Improve error logging for `GetBlock` method ([#4232](https://github.com/kedacore/keda/issues/4232)) - **RabbitMQ Scaler**: Add TLS support ([#967](https://github.com/kedacore/keda/issues/967)) - **Redis Scalers**: Add support to Redis 7 ([#4052](https://github.com/kedacore/keda/issues/4052)) - **Selenium Grid Scaler**: Add 'platformName' to selenium-grid scaler metadata structure ([#4038](https://github.com/kedacore/keda/issues/4038)) diff --git a/pkg/scalers/kafka_scaler.go b/pkg/scalers/kafka_scaler.go index 5e1cea26174..1aba2c87779 100644 --- a/pkg/scalers/kafka_scaler.go +++ b/pkg/scalers/kafka_scaler.go @@ -444,7 +444,7 @@ func (s *kafkaScaler) getConsumerOffsets(topicPartitions map[string][]int32) (*s func (s *kafkaScaler) getLagForPartition(topic string, partitionID int32, offsets *sarama.OffsetFetchResponse, topicPartitionOffsets map[string]map[int32]int64) (int64, int64, error) { block := offsets.GetBlock(topic, partitionID) if block == nil { - errMsg := fmt.Errorf("error finding offset block for topic %s and partition %d", topic, partitionID) + errMsg := fmt.Errorf("error finding offset block for topic %s and partition %d from offset block: %v", topic, partitionID, offsets.Blocks) s.logger.Error(errMsg, "") return 0, 0, errMsg }