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

Keda 2.14 Prometheus Scaler Divides by Number of replicas of pod #5781

Closed
doverk96 opened this issue May 4, 2024 · 2 comments
Closed

Keda 2.14 Prometheus Scaler Divides by Number of replicas of pod #5781

doverk96 opened this issue May 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@doverk96
Copy link

doverk96 commented May 4, 2024

Report

I am using Keda 2.14, externally hosted Prometheus for triggering the deployment running in EKS.
For every query provided, it always divides the value by the number of replicas.
Example: - count(container_cpu_cfs_throttled_periods_total{cluster="sample-prod", container="sample-web.*", namespace="prod"}) by (container)
This gives 4 in output, whereas if i run : - kubectl describe hpa sample-consumer -n qa, over there it displays value as
Metrics: ( current / target )
"s0-prometheus" (target average value): 1334m / 21
I have 3 pods running of sample-consumer in my EKS, and therefore I can see it is dividing 4 by 3 to get 1334m as value.

Expected Behavior

I was not expecting this inherent division by the number of replicas

Actual Behavior

It do inherent division by the number of replicas

Steps to Reproduce the Problem

  1. Just use the query and see it divides the value by the number of replicas.

Logs from KEDA operator

example

KEDA Version

2.14.0

Kubernetes Version

1.28

Platform

Amazon Web Services

Scaler Details

Prometheus

Anything else?

No response

@doverk96 doverk96 added the bug Something isn't working label May 4, 2024
@JorTurFer
Copy link
Member

Hello,
It's the expected behavior for AverageValue metrics. You can change the metric type to Value to not have the average:
image

To change the metric type, you just need to add metricType: Value in your trigger at the same level of type or metadata.

triggers:
- type: prometheus
  metricType: Value
  metadata:
    # Required fields:

You can get more information about how the HPA formula is calculated here: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#algorithm-details

@JorTurFer JorTurFer closed this as not planned Won't fix, can't repro, duplicate, stale May 4, 2024
@doverk96
Copy link
Author

doverk96 commented May 4, 2024

Thanks

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
None yet
Development

No branches or pull requests

2 participants