fix: add missing error returns in kafka scaler error handling#7182
Merged
wozniakjan merged 3 commits intokedacore:mainfrom Oct 25, 2025
Merged
fix: add missing error returns in kafka scaler error handling#7182wozniakjan merged 3 commits intokedacore:mainfrom
wozniakjan merged 3 commits intokedacore:mainfrom
Conversation
Add missing error returns after error logging in getTopicPartitions and getLagForPartition functions to prevent incorrect behavior when errors occur. - Add error return in getTopicPartitions when listCGOffsetResponse.Err > 0 - Add error return in getTopicPartitions when topicMetadata.Err > 0 - Add error return in getLagForPartition when block.Err > 0 Previously these functions only logged errors but continued execution, which could lead to incorrect scaling behavior. Signed-off-by: leeyeonwoo <rexrex1105@gmail.com>
|
Thank you for your contribution! 🙏 Please understand that we will do our best to review your PR and give you feedback as soon as possible, but please bear with us if it takes a little longer as expected. While you are waiting, make sure to:
Once the initial tests are successful, a KEDA member will ensure that the e2e tests are run. Once the e2e tests have been successfully completed, the PR may be merged at a later date. Please be patient. Learn more about our contribution guide. |
Signed-off-by: leeyeonwoo <rexrex1105@gmail.com>
SpiritZhou
approved these changes
Oct 17, 2025
Contributor
|
/run-e2e kafka |
rickbrouwer
approved these changes
Oct 20, 2025
dttung2905
approved these changes
Oct 20, 2025
Contributor
dttung2905
left a comment
There was a problem hiding this comment.
LGTM. Thanks alot for the fix 🙏
Contributor
Author
|
Thank you for approving! |
wozniakjan
approved these changes
Oct 21, 2025
Member
|
/run-e2e kafka |
JorTurFer
approved these changes
Oct 25, 2025
JorTurFer
pushed a commit
to JorTurFer/keda
that referenced
this pull request
Oct 29, 2025
…re#7182) * fix: add missing error returns in kafka scaler error handling Add missing error returns after error logging in getTopicPartitions and getLagForPartition functions to prevent incorrect behavior when errors occur. - Add error return in getTopicPartitions when listCGOffsetResponse.Err > 0 - Add error return in getTopicPartitions when topicMetadata.Err > 0 - Add error return in getLagForPartition when block.Err > 0 Previously these functions only logged errors but continued execution, which could lead to incorrect scaling behavior. Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> * docs: update changelog for PR kedacore#7182 Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> --------- Signed-off-by: leeyeonwoo <rexrex1105@gmail.com>
JorTurFer
pushed a commit
to JorTurFer/keda
that referenced
this pull request
Oct 29, 2025
…re#7182) * fix: add missing error returns in kafka scaler error handling Add missing error returns after error logging in getTopicPartitions and getLagForPartition functions to prevent incorrect behavior when errors occur. - Add error return in getTopicPartitions when listCGOffsetResponse.Err > 0 - Add error return in getTopicPartitions when topicMetadata.Err > 0 - Add error return in getLagForPartition when block.Err > 0 Previously these functions only logged errors but continued execution, which could lead to incorrect scaling behavior. Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> * docs: update changelog for PR kedacore#7182 Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> --------- Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz>
JorTurFer
added a commit
that referenced
this pull request
Oct 29, 2025
* Fix incorrect 'unmatched input property' notification (#7176) * Fix incorrect 'unmatched input property' notification Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * Remove redundant parsing Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * fix Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * use typedconfig once Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * static check Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * Update test Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * Update datadog_scaler_test.go Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * update schemas Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * fix test Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * update typedconfig Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * Update pkg/scalers/datadog_scaler.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> --------- Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz> * fix: add missing error returns in kafka scaler error handling (#7182) * fix: add missing error returns in kafka scaler error handling Add missing error returns after error logging in getTopicPartitions and getLagForPartition functions to prevent incorrect behavior when errors occur. - Add error return in getTopicPartitions when listCGOffsetResponse.Err > 0 - Add error return in getTopicPartitions when topicMetadata.Err > 0 - Add error return in getLagForPartition when block.Err > 0 Previously these functions only logged errors but continued execution, which could lead to incorrect scaling behavior. Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> * docs: update changelog for PR #7182 Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> --------- Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz> * Fix incorrect 'unmatched input property' notification (#7188) * Fix incorrect 'unmatched input property' notification Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * add azure cloud Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> * fix Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> --------- Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz> * fix: feature flag for unexpected scaler param check (#7191) Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com> Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz> * Update prometheus dependency version (#7194) Updated prometheus dependency version to v0.54.0. Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz> * fix: send raw metrics also during polling interval (#7198) Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com> Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz> * update changelog Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz> * . Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz> * fix changelog Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz> --------- Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com> Signed-off-by: Jorge Turrado <jorge.turrado@mail.schwarz> Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com> Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com> Co-authored-by: Rick Brouwer <rickbrouwer@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: leeyeonwoo <74847519+5iing@users.noreply.github.com> Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com> Co-authored-by: Zbynek Roubalik <zroubalik@gmail.com>
alt-dima
pushed a commit
to alt-dima/keda
that referenced
this pull request
Dec 13, 2025
…re#7182) * fix: add missing error returns in kafka scaler error handling Add missing error returns after error logging in getTopicPartitions and getLagForPartition functions to prevent incorrect behavior when errors occur. - Add error return in getTopicPartitions when listCGOffsetResponse.Err > 0 - Add error return in getTopicPartitions when topicMetadata.Err > 0 - Add error return in getLagForPartition when block.Err > 0 Previously these functions only logged errors but continued execution, which could lead to incorrect scaling behavior. Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> * docs: update changelog for PR kedacore#7182 Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> --------- Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> Signed-off-by: Dmitriy Altuhov <altuhovd@gmail.com>
tangobango5
pushed a commit
to tangobango5/keda
that referenced
this pull request
Dec 22, 2025
…re#7182) * fix: add missing error returns in kafka scaler error handling Add missing error returns after error logging in getTopicPartitions and getLagForPartition functions to prevent incorrect behavior when errors occur. - Add error return in getTopicPartitions when listCGOffsetResponse.Err > 0 - Add error return in getTopicPartitions when topicMetadata.Err > 0 - Add error return in getLagForPartition when block.Err > 0 Previously these functions only logged errors but continued execution, which could lead to incorrect scaling behavior. Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> * docs: update changelog for PR kedacore#7182 Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> --------- Signed-off-by: leeyeonwoo <rexrex1105@gmail.com>
tangobango5
pushed a commit
to tangobango5/keda
that referenced
this pull request
Feb 13, 2026
…re#7182) * fix: add missing error returns in kafka scaler error handling Add missing error returns after error logging in getTopicPartitions and getLagForPartition functions to prevent incorrect behavior when errors occur. - Add error return in getTopicPartitions when listCGOffsetResponse.Err > 0 - Add error return in getTopicPartitions when topicMetadata.Err > 0 - Add error return in getLagForPartition when block.Err > 0 Previously these functions only logged errors but continued execution, which could lead to incorrect scaling behavior. Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> * docs: update changelog for PR kedacore#7182 Signed-off-by: leeyeonwoo <rexrex1105@gmail.com> --------- Signed-off-by: leeyeonwoo <rexrex1105@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes missing error returns in the Kafka scaler's error handling paths. Currently, three error cases only log errors but continue execution, which can lead to incorrect scaling behavior.
Changes
Previously these functions only logged errors but continued execution, which could lead to incorrect scaling behavior when Kafka API calls fail.
Test Results
All Kafka scaler tests pass:
$ go test -v ./pkg/scalers -run Kafka
=== RUN TestApacheKafkaGetBrokers
--- PASS: TestApacheKafkaGetBrokers (0.00s)
=== RUN TestApacheKafkaAuthParams
--- PASS: TestApacheKafkaAuthParams (0.00s)
=== RUN TestApacheKafkaGetMetricSpecForScaling
--- PASS: TestApacheKafkaGetMetricSpecForScaling (0.00s)
=== RUN TestKafkaAuthParamsInTriggerAuthentication
--- PASS: TestKafkaAuthParamsInTriggerAuthentication (0.00s)
=== RUN TestKafkaAuthParamsInScaledObject
--- PASS: TestKafkaAuthParamsInScaledObject (0.00s)
=== RUN TestKafkaOAuthbearerAuthParams
--- PASS: TestKafkaOAuthbearerAuthParams (0.00s)
=== RUN TestKafkaClientsOAuthTokenProvider
--- PASS: TestKafkaClientsOAuthTokenProvider (0.00s)
=== RUN TestKafkaGetMetricSpecForScaling
--- PASS: TestKafkaGetMetricSpecForScaling (0.00s)
PASS
ok github.com/kedacore/keda/v2/pkg/scalers (cached)
Checklist