keda icon indicating copy to clipboard operation
keda copied to clipboard

Fallback for metricType: Value

Open yuvalweber opened this issue 2 years ago • 14 comments

Right now keda only supports fallback for metric with a type of "AverageValue"

https://github.com/kedacore/keda/blob/c0c99493304d35cd025c0996ecbabff835a0a7fc/pkg/fallback/fallback.go#L39-L42

I want to add it to metric type of "Value" also, I just wanted to know if there is some kind of a blocker to this?

yuvalweber avatar Feb 07 '23 07:02 yuvalweber

Hi, There isn't any blocker from user side, the main blocker I can see here is how you can calculate the required value for setting the desired replicas. I mean, for AverageValue value is easy because you just need to return threshold * desired replicas and the HPA controller will eventually scale to that replica. Using other metric types, you need to return a value that after HPA Controller calculation results in the desired replicas (tbh, IDK if it's doable, but I think so). If you are interested on contributing with this, I can assign the issue to you if you want

JorTurFer avatar Feb 07 '23 12:02 JorTurFer

Assign it to me. I want to try and do it

yuvalweber avatar Feb 07 '23 19:02 yuvalweber

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.

stale[bot] avatar Apr 08 '23 21:04 stale[bot]

This issue has been automatically closed due to inactivity.

stale[bot] avatar Apr 16 '23 22:04 stale[bot]

Hi @yuvalweber Do you have any update?

JorTurFer avatar Apr 17 '23 06:04 JorTurFer

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.

stale[bot] avatar Jun 16 '23 06:06 stale[bot]

This issue has been automatically closed due to inactivity.

stale[bot] avatar Jun 23 '23 06:06 stale[bot]

Would it be feasible to change the metricType to AverageValue if the fallback is active and continue using threshold * desired replicas, then change metricType back to Value when the fallback is no longer needed?

RRethy avatar Jan 17 '24 18:01 RRethy

Any updates on this topic? I have a situation where I am using a PostgreSQL KEDA trigger, and my query is of the Value type. However, I would like to ensure that if my database is down, the scaled-up replicas will not remain in that state indefinitely. The fallback option is really useful and should not be limited to AverageValue types.

sdd-el avatar Feb 04 '25 08:02 sdd-el

There isn't any advance in this direction currently, the issue was automatically closed due to inactivity, but we can reopen if if you are willing to take a look and draft a PR 😄

JorTurFer avatar Feb 04 '25 08:02 JorTurFer

@JorTurFer For the Value and other metrics, can't we just use the amount defined in the fallback.replicas? I mean the fallback only happens in failure cases and it's better than not having it 😅

joseasouza avatar Feb 14 '25 17:02 joseasouza

I mean the fallback only happens in failure cases and it's better than not having it

Actually no. I mean, Value isn't linear and it doesn't depend on the replicas, so the amount of replicas that you will have will scale to max/min in a couple of loops, because doesn't matter the amount of replicas that you have, the value will be always above or below. The only option that I see to extend the fallback to Value metrics is transforming them to AverageValue during the fallback. WDYT @zroubalik @wozniakjan ?

JorTurFer avatar Feb 14 '25 22:02 JorTurFer

Looks like https://github.com/kedacore/keda/pull/6655 is a fix for this? This is very exciting for us.

akahn avatar Jun 03 '25 17:06 akahn

Hi @JorTurFer Can we expect #6655 in the next release? It's a very useful feature for our use case.

caesarxuchao avatar Jun 14 '25 00:06 caesarxuchao

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.

stale[bot] avatar Aug 13 '25 03:08 stale[bot]

This issue has been automatically closed due to inactivity.

stale[bot] avatar Aug 20 '25 04:08 stale[bot]