kedacore / keda

KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes
https://keda.sh
Apache License 2.0
8.01k stars 1.01k forks source link

Update GetAzureQueueLength in azure queue scaler, to support different queue length strategies. #5875

Open leodip opened 2 weeks ago

leodip commented 2 weeks ago

This PR is an attempt to solve https://github.com/kedacore/keda/issues/4478

It adds a new configuration option queueLengthStrategy to the Azure Storage Queue scaler, where you can set the value of default or visibleonly.

default: Considers both visible and invisible messages. visibleonly: Uses Peek to count only visible messages. If the count of visible messages is 32 or higher, it falls back to the default strategy, counting both visible and invisible messages.

visibleonly will, in practice, use the previous behaviour, as before https://github.com/kedacore/keda/pull/4003 was merged.

Docs PR: https://github.com/kedacore/keda-docs/pull/1406.

I've created this change to the best of my ability. However, it hasn't been tested. I would appreciate if someone could help with testing, or giving directions on how to test.

Thanks!

semgrep-app[bot] commented 2 weeks ago

Semgrep found 2 context-todo findings:

Consider to use well-defined context

Ignore this finding from context-todo.

leodip commented 4 days ago

Looking good! Could you replace the magic string with a constant?

Thanks, hope the new commit makes it better.