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

Metrics API Scaler support different formats #5347

Merged
merged 15 commits into from
Mar 24, 2024

Conversation

fira42073
Copy link
Contributor

@fira42073 fira42073 commented Jan 3, 2024

Provide a description of what has been changed

Checklist

Fixes #2633

Copy link

github-actions bot commented Jan 3, 2024

Thank you for your contribution! 🙏 We will review your PR as soon as possible.

While you are waiting, make sure to:

Learn more about:

@zroubalik
Copy link
Member

Do we have any update on this please?

@fira42073
Copy link
Contributor Author

It seems like I have messed up the history, because I pulled the changes from kedacore:main and then tried to add DCO. I'll fix it asap

@fira42073 fira42073 marked this pull request as ready for review February 14, 2024 12:36
@fira42073 fira42073 requested a review from a team as a code owner February 14, 2024 12:36
@fira42073
Copy link
Contributor Author

Hey. Hope you are well. Could you please review my code? I think it's pretty much ready.
If all is good, I'll finish the rest of the checklist and it's ready to be merged.
@zroubalik

Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are test failures:

Test failures:
  TestGetValueFromResponse: github.com/kedacore/keda/v2/pkg/scalers
  TestGetValueFromResponse/json:_string: github.com/kedacore/keda/v2/pkg/scalers

    metrics_api_scaler_test.go:155: Expected 64, got 64

  TestGetValueFromResponse/json:_{}.[].{}: github.com/kedacore/keda/v2/pkg/scalers

    metrics_api_scaler_test.go:155: Expected 32, got 32

  TestGetValueFromResponse/yaml:_integer: github.com/kedacore/keda/v2/pkg/scalers

    metrics_api_scaler_test.go:151: Expected success but got error: yaml: mapping values are not allowed in this context
    metrics_api_scaler_test.go:155: Expected 2.43, got 0

  TestGetValueFromResponse/yaml:_string: github.com/kedacore/keda/v2/pkg/scalers

    metrics_api_scaler_test.go:151: Expected success but got error: yaml: mapping values are not allowed in this context
    metrics_api_scaler_test.go:155: Expected 64, got 0

  TestGetValueFromResponse/yaml:_{}.[].{}: github.com/kedacore/keda/v2/pkg/scalers

    metrics_api_scaler_test.go:151: Expected success but got error: yaml: mapping values are not allowed in this context
    metrics_api_scaler_test.go:155: Expected 32, got 0

This should be also covered by e2e tests:

https://github.com/kedacore/keda/blob/main/tests/scalers/metrics_api/metrics_api_test.go

Thanks!

@fira42073
Copy link
Contributor Author

fira42073 commented Feb 15, 2024

I have fixed the unit tests. Will get e2e done soon too

Friedrich Albert Kyuri added 5 commits February 29, 2024 13:48
Signed-off-by: Friedrich Albert Kyuri <friedrichak42@gmail.com>
Signed-off-by: Friedrich Albert Kyuri <friedrichak42@gmail.com>
Signed-off-by: Friedrich Albert Kyuri <friedrichak42@gmail.com>
Signed-off-by: Friedrich Albert Kyuri <friedrichak42@gmail.com>
…x []interface edge case for value_by_path

Signed-off-by: Friedrich Albert Kyuri <friedrichak42@gmail.com>
Friedrich Albert Kyuri and others added 3 commits February 29, 2024 17:52
Signed-off-by: Friedrich Albert Kyuri <friedrichak42@gmail.com>
Signed-off-by: Friedrich Albert Kyuri <friedrichak42@gmail.com>
@zroubalik
Copy link
Member

zroubalik commented Mar 1, 2024

/run-e2e metrics_api
Update: You can check the progress here

@fira42073
Copy link
Contributor Author

The tests seem to pass. Shall I also document this change in keda-docs?

@fira42073
Copy link
Contributor Author

Documentation is done as well. You can check it here:
kedacore/keda-docs#1325

@fira42073
Copy link
Contributor Author

I believe that it can be merged if you don't have any additional comments.
Feel free to commit into this/doc branch as well if you want to fix some small detail or something.
@wozniakjan @zroubalik

Signed-off-by: Murr Kyuri <39532283+Friedrich42@users.noreply.github.com>
pkg/scalers/metrics_api_scaler.go Outdated Show resolved Hide resolved
pkg/scalers/metrics_api_scaler.go Outdated Show resolved Hide resolved
pkg/util/value_by_path.go Show resolved Hide resolved
pkg/scalers/metrics_api_scaler.go Outdated Show resolved Hide resolved
pkg/scalers/metrics_api_scaler_test.go Outdated Show resolved Hide resolved
pkg/scalers/metrics_api_scaler_test.go Outdated Show resolved Hide resolved
tests/scalers/metrics_api/metrics_api_test.go Outdated Show resolved Hide resolved
Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: Murr Kyuri <39532283+Friedrich42@users.noreply.github.com>
fira42073 and others added 2 commits March 21, 2024 14:45
Signed-off-by: Murr Kyuri <39532283+Friedrich42@users.noreply.github.com>
…ormat field to ensure backwards compatibility

Signed-off-by: Friedrich Albert Kyuri <friedrichak42@gmail.com>
@fira42073
Copy link
Contributor Author

@wozniakjan
Thank you for the review!

I've addressed most of the points.
Using k8s package is a great idea, but it may not be suitable here, because it doesn't support .number notation.

What do you think we should do about that?

@wozniakjan
Copy link
Member

Using k8s package is a great idea, but it may not be suitable here, because it doesn't support .number notation.
What do you think we should do about that?

I didn't realize the incompatibility, thanks for the thorough testing and you got me convinced to go with GetValueByPath :)

Now FOSSA tests appear to be failing, let me go through the repo to see if there is any info regarding these

Error:  An issue occurred
  *** Relevant Errors ***
      Error: The build failed. Check the FOSSA webapp for more details
      → src/App/Fossa/API/BuildWait.hs:119:41

@fira42073
Copy link
Contributor Author

fira42073 commented Mar 22, 2024

Using k8s package is a great idea, but it may not be suitable here, because it doesn't support .number notation.
What do you think we should do about that?

I didn't realize the incompatibility, thanks for the thorough testing and you got me convinced to go with GetValueByPath :)

Now FOSSA tests appear to be failing, let me go through the repo to see if there is any info regarding these

Error:  An issue occurred
  *** Relevant Errors ***
      Error: The build failed. Check the FOSSA webapp for more details
      → src/App/Fossa/API/BuildWait.hs:119:41

I don't think it's actually failing; just need to restart it; itself report is clean

Signed-off-by: Friedrich Albert Kyuri <friedrichak42@gmail.com>
Copy link
Member

@wozniakjan wozniakjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm
(not sure if approval from me is sufficient, maybe @kedacore/keda-contributors will need to approve as well)

@fira42073
Copy link
Contributor Author

@zroubalik this one is ready to go.
Feel free to merge it.

Thanks!

@JorTurFer
Copy link
Member

JorTurFer commented Mar 24, 2024

/run-e2e metrics
Update: You can check the progress here

@JorTurFer JorTurFer enabled auto-merge (squash) March 24, 2024 22:31
@JorTurFer JorTurFer merged commit 76c6ac0 into kedacore:main Mar 24, 2024
20 checks passed
@fira42073 fira42073 deleted the metric-scaler-format branch March 25, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metrics API Scaler support different format
4 participants