Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keda Kafka lagThreshold error in parsing #5354

Closed
altrack opened this issue Jan 7, 2024 · 6 comments
Closed

Keda Kafka lagThreshold error in parsing #5354

altrack opened this issue Jan 7, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@altrack
Copy link

altrack commented Jan 7, 2024

Report

When using a Keda Kafka scaler with lagThreshold argument as 1000000 I'm getting the following error:

keda-operator  error parsing kafka metadata: error parsing lagThreshold: strconv.ParseInt: parsing "1e+06": invalid 

syntax


### Expected Behavior

Should parse numbers correctly.

### Actual Behavior

Not able to parse or parsing as: `1e+06`

### Steps to Reproduce the Problem

1. set lagThreshold as 1000000
2. kubectl  describe scaledobjects.keda.sh <your-topic>


### Logs from KEDA operator

_No response_

### KEDA Version

None

### Kubernetes Version

None

### Platform

Google Cloud

### Scaler Details

Kafka

### Anything else?

If the bug is related to another repo please let me know, I'll move it.
@altrack altrack added the bug Something isn't working label Jan 7, 2024
@dttung2905
Copy link
Contributor

dttung2905 commented Jan 9, 2024

Hi @altrack seems like the number 1000000 is converted to scientific notation which makes strconv.ParseInt throw error. I have a few questions

  • Did you wrap the deployment of scaleObject around another helm deployment ? Helm has been (in)famous for that link
  • What is the KEDA version you are using? I'm testing with a latest version of KEDA from main and it works fine. I also added a test case into this and run locally but that new test case also passes 🤔
    var parseApacheKafkaMetadataTestDataset = []parseApacheKafkaMetadataTestData{
  • May be you can try putting the number 1000000 in quotes as string instead of int type?

@zroubalik
Copy link
Member

@dttung2905 thanks for the investigation, could you please open a PR with that test case, just to be sure? We should test this for both Kafka scalers (sarama and go based).

@dttung2905
Copy link
Contributor

Hello @altrack , did you manage to resolve the issue by following the suggestion above?

@altrack
Copy link
Author

altrack commented Jan 28, 2024

Hey @dttung2905 , thank you for checking this and writing the test.
Unfortunately, I don't know the answers yet, it will take some time to check this.
I'll try to use a string instead.

@dttung2905
Copy link
Contributor

Hey @dttung2905 , thank you for checking this and writing the test. Unfortunately, I don't know the answers yet, it will take some time to check this. I'll try to use a string instead.

Yes, please use a string instead as it might be converted to scientific notation 😅 . Do let us know if it works

@altrack
Copy link
Author

altrack commented Mar 3, 2024

Sorry for the delay.
Yes, changing the number to string worked as expected.
The issue was caused since in one of the Helm definition I had:
lagThreshold: {{ .Values.keda.kafka.lagThreshold | quote }},
so this caused the conversion.
Thanks for the answers.

@altrack altrack closed this as completed Mar 3, 2024
@github-project-automation github-project-automation bot moved this from To Triage to Ready To Ship in Roadmap - KEDA Core Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants