Closed rc-bryanlinebaugh closed 5 months ago
Hello
Are you scrapping prometheus metrics from KEDA by change? Which is the value of this metric keda_scaler_metrics_value
for those ScaledObjects?
Hello,
I had to do a port-forward for the KEDA Operator in the same cluster, but I was able to retrieve what would have been scraped by Prometheus. For example, here's what a collection of our ScaledObject
resources is reporting:
Interesting information, so we are getting somehow negative values from Pub/Sub api somehow, maybe it's because the aggregation window or something so that we use is not correct. Could it be possible? Are you willing to take a look? This is the scaler code: https://github.com/kedacore/keda/blob/main/pkg/scalers/gcp_pubsub_scaler.go
This is the relevant part of scaler code (and other calls executed within it): https://github.com/kedacore/keda/blob/a16802261ed3f6ae589ca30945ef596853a549be/pkg/scalers/gcp_pubsub_scaler.go#L236-L256
Not a Golang expert by any means, but I can take a look. It would be great if someone with more expertise could take a look as well.
Let's see if there is any other folk willing to help here too :)
@JorTurFer Thanks for the initial triage of this issue!
It looks like we were receiving negative values because we were mistakenly passing the aggregation
function (sum
) in our Scaler configuration. This is an issue because the SubscriptionSize
metric we configured is not a Distribution type metric and not supported by the available aggregation
methods. This is mentioned in a comment in the documented Scaler example. With the included aggregation, the clauses for the MQL query added here on the Gauge metric resulted in negative values (I don't fully understand why, but I was able to replicate it in Metrics Explorer).
Once we removed the aggregation
parameter from our Scaler config, values were reported as expected.
Nice to read that it's working well :smile: Thanks a lot for the feedback!
We still have a problem without any aggregation function defined, we sometimes get -9223372036854775808m/100 (avg)
.
Apparently it also happens when using kafka on GCP #5730
Report
We have configured the GCP Pub/Sub Scaler to scale our deployments based on the reported "SubscriptionSize" of the configured Pub/Sub Subscription. We have experienced frequent reporting of negative metric values by the underlying
HorizontalPodAutoscaler
resource for eachScaledObject
.The reported negative values seems to be having the adverse affect of incorrectly scaling down our deployments.
Examples:
Scaler Config:
Expected Behavior
There should not be any negative values reported for the
HorizontalPodAutoscaler
metric.Actual Behavior
Observed the
HorizontalPodAutoscaler
consistently reporting negative values.Steps to Reproduce the Problem
Logs from KEDA operator
No response
KEDA Version
2.13.0
Kubernetes Version
1.28
Platform
Amazon Web Services
Scaler Details
GCP Pub/Sub
Anything else?
No response