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

Stackdriver scalar returns 0 for gauge values of type double #3777

Closed
octothorped opened this issue Oct 25, 2022 · 2 comments · Fixed by #3788
Closed

Stackdriver scalar returns 0 for gauge values of type double #3777

octothorped opened this issue Oct 25, 2022 · 2 comments · Fixed by #3788
Assignees
Labels
bug Something isn't working

Comments

@octothorped
Copy link
Contributor

octothorped commented Oct 25, 2022

Report

When using the GCP Stackdriver scalar to retrieve metrics that have a value type of double it always returns a value of 0. Since it does not create any errors, it triggers a scale down to zero but can never scale back up.

Expected Behavior

Since double is a valid metric value type and can still have a similar average target value calculation, we would expect the scalar to retrieve the correct metric value instead of returning 0. If this is expected behavior, maybe we can update the documentation to make it more clear that the only supported value type is int64.

Actual Behavior

We believe the issue is here where the getMetrics() function in the client is casting the value to an Int64. In the calling function here it also attempts to cast the value back to a float64.

Steps to Reproduce the Problem

  1. Create a ScaledObject that uses a Google Cloud Platform stackdriver scalar with a metric filter of some external metric type. We used metric.type="external.googleapis.com/prometheus/test_pod_scaling" for testing purposes.
  2. Publish values of 1.0 to the stackdriver metric ensuring the gauge value type is double.
  3. Check operator logs and associated HPA to see that the values are always returning 0.

The setup can be verified by:

  1. Deleting the metric created above
  2. Publish values of 1 to that same metric ensuring the gauge value type is now int64
  3. Check operator logs and associated HPA to see that the values retrieved are now 1.

KEDA Version

2.8.1

Platform

Google Cloud

@octothorped octothorped added the bug Something isn't working label Oct 25, 2022
@JorTurFer
Copy link
Member

JorTurFer commented Oct 25, 2022

You are totally right, thanks for reporting the bug
Are you willing to contribute with the fix?

@octothorped
Copy link
Contributor Author

@JorTurFer I am willing to help contribute with a fix.

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

Successfully merging a pull request may close this issue.

2 participants