-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Getting empty metric data with multiple dimensions in aws-cloudwatch trigger #2760
Comments
Hi @dekelev |
Hi @JorTurFer , Thanks for responding! After debugging the Scaler class and the cloudwatch-sdk, I came to conclusion that it is probably an issue with the cloudwatch-sdk, because the request params sent to CloudWatch looks fine when using multiple dimensions. As a workaround, I ended up with a forked git repo, replacing the metric data query with an expression query:
|
@dekelev would you mind opening a PR to fix this issue? |
My current fix is just to replace the whole aws-cloudwatch scaler's internals with an expression logic, which wasn't the author vision for this scaler. I don't have enough time available now to create a PR, but I'll consider extending this scaler in the future if no one else will. It doesn't seems to be much effort to extend the scaler so it would validate and execute the expression only if it is defined in the user's config. |
From some reason, I also had to multiply the metric value returned from CloudWatch by 100, so that the external metric's quantity would be correctly consumed and displayed by the HPA. Any idea why the metric is not consumed as is by the HPA? I'm not sure if using the original scaler without expression won't lead to the same issue, so if I create a PR, this might be a breaking-change. |
HPA doesn't work with float numbers, integers only. keda/pkg/scalers/aws_cloudwatch_scaler.go Lines 45 to 46 in 11f0554
@JorTurFer FYI |
Interesting! So we are missing the info during the cast to int64 🤔 |
yeah, we should fix that |
I've opened this PR to add alternative expression field and also changed the scaler to use int64 instead of float64. |
@zroubalik I still had to multiply the metric by 100, even with int64. I have no idea why, but it only works like that. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
I think this is already covered in the PR, feel free to reopen it if it's not done 😄 |
Report
Using the following
ScaledObject
config, I always get an empty metric data:Running the following query in CloudWatch UI with 1 minute period returns a number above 0:
SELECT AVG(MessageCount) FROM "AWS/AmazonMQ" WHERE Broker = 'aws-production' and Queue = 'aws-worker'
While
keda-operator
log repeatedly shows:aws_cloudwatch_scaler empty metric data received, returning minMetricValue
Expected Behavior
Getting a number above 0 for the requested metric.
Actual Behavior
Getting 0 for the requested metric.
Steps to Reproduce the Problem
ScaledObject
configkeda-operator
logLogs from KEDA operator
KEDA Version
2.6.1
Kubernetes Version
1.21
Platform
Amazon Web Services
Scaler Details
AWS CloudWatch
More Info
I'm debugging this locally and this is what I see when I add the
input
variable to the log:And this log shows that the response from CloudWatch is missing the
Values
field:The text was updated successfully, but these errors were encountered: