-
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
Incorrect calculation of metric from Prometheus #1881
Comments
Do you have any news? We got similar behaviour with keda 1.5 as well. |
@diegosanchez Nope, still waiting |
@zroubalik Is this just because of how we report metrics to HPA or not? |
The prometheus scaler is an "average value" scaler. This means that the value you get from prometheus will be divided by the number of ready pods in the target deployment/job before being passed on to the HPA. E.g. Your target deployment has 2 pods, prometheus returns 15 for your metric, your threshold is 10. The HPA will show 7500m/10. Does that explain this issue, or do you think there's still a bug here? |
After several trials and errors, we (@ronalcelaya and I) bumped into a helpful piece of documentation: https://github.com/kedacore/keda/blob/v1.5.0/CREATE-NEW-SCALER.md#getmetricspecforscaling. Could we refer to it from the documentation page? |
Definately, feel free to open a PR! |
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. |
This issue has been automatically closed due to inactivity. |
Report
To scale deployment based on pods qty in namespace I am using this query to Prometheus:
threshold: '10' query: sum(kube_pod_status_phase{namespace="namespace",phase="Running"}) / sum(kube_pod_status_phase{namespace="namespace",phase="Running",pod=~"workload2.*"})
While direct query to Prometheus show number 15 command
kubectl describe hpa
shows:"prometheus-http---prometheus-server-prometheus-svc-srv-rps" (target average value): 7 / 10
Expected Behavior
Metrics in keda hpa should be the same as in Prometheus
Actual Behavior
Metrics in keda hpa are not the same as in Prometheus
Steps to Reproduce the Problem
sum(kube_pod_status_phase{namespace="namespace",phase="Running"}) / sum(kube_pod_status_phase{namespace="namespace",phase="Running",pod=~"workload-2*"})
andthreshold '10'
Logs from KEDA operator
KEDA Version
2.3.0
Kubernetes Version
1.19
Platform
Amazon Web Services
Scaler Details
Prometheus
Anything else?
No response
The text was updated successfully, but these errors were encountered: