Skip to content

add DeliverGetRate, PublishedToDeliveredRatio and ExpectedQueueConsumptionTime trigger modes to RabbitMQ scaler#6933

Merged
wozniakjan merged 16 commits intokedacore:mainfrom
mgs2:feat/rabbitmq-add-new-modes
Oct 2, 2025
Merged

add DeliverGetRate, PublishedToDeliveredRatio and ExpectedQueueConsumptionTime trigger modes to RabbitMQ scaler#6933
wozniakjan merged 16 commits intokedacore:mainfrom
mgs2:feat/rabbitmq-add-new-modes

Conversation

@mgs2
Copy link
Contributor

@mgs2 mgs2 commented Jul 28, 2025

Introduced three additional trigger modes for RabbitMQ scaler, as proposed in #7071:

  • DeliverGetRate, which will activate, when given messages delivery rate will be reached
  • PublishedToDeliveredRatio, which will activate, when scaler hits certain level of published to delivered messages ratio
  • ExpectedQueueConsumptionTime, which will be activated when the total estimated waiting time for delivery of all messages available in the queue at a given moment (with the current capacity of consumers) reaches the indicated value.

Checklist

Documentation update: kedacore/keda-docs#1601

Additional references:

…bitMQ scaler

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
mgs2 added 4 commits July 28, 2025 17:14
Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
…to the user

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
@SpiritZhou
Copy link
Contributor

Could you add some e2e tests under /test/rabbitmq?

@mgs2
Copy link
Contributor Author

mgs2 commented Aug 5, 2025

Could you add some e2e tests under /test/rabbitmq?

Will do, once I'll get a hold on some free time. BTW it seems that I'll have to slightly extend send/receive functionalities in Docker image used in e2e tests for RabbitMQ scaler. Is there any contribution guide for https://github.com/kedacore/test-tools/ repo?

@SpiritZhou
Copy link
Contributor

Currently, there is no contribution guide, but we plan to add one soon. The Docker image is written in Go and is designed to be simple and easy to use. https://github.com/kedacore/test-tools/tree/main/e2e/images/rabbitmq

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
@mgs2 mgs2 force-pushed the feat/rabbitmq-add-new-modes branch from 4159be7 to 4a39cb6 Compare August 19, 2025 11:02
Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the contribution, this is really great. A couple of nits from my side:

  • e2e test would be really great to have
  • please create a new issue with the problem description and refrence in the changelog
  • in the documentation PR could you please add a new paragraph with an explanation of all trigger modes we have, ie when to use what - it doesn't have to be super complex, but something along the description you put here in the PR, see the comment there: https://github.com/kedacore/keda-docs/pull/1601/files#r2300363424

mgs2 added 2 commits September 9, 2025 16:57
… interval

- add E2E tests for DeliverGetRate, PublishedToDeliveredRatio and ExpectedQueueConsumptionTime trigger modes

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
- updated some output messages

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
@mgs2 mgs2 changed the title add DeliverGetRate and PublishedToDeliveredRatio trigger modes to RabbitMQ scaler add DeliverGetRate, PublishedToDeliveredRatio and ExpectedQueueConsumptionTime trigger modes to RabbitMQ scaler Sep 9, 2025
Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
@mgs2 mgs2 requested a review from a team as a code owner September 9, 2025 21:13
@keda-automation keda-automation requested a review from a team September 9, 2025 21:13
@semgrep-app
Copy link

semgrep-app bot commented Sep 9, 2025

Semgrep found 6 db-connection-string findings:

  • tests/scalers/rabbitmq/rabbitmq_queue_http_eqct/rabbitmq_queue_http_eqct_test.go
  • tests/scalers/rabbitmq/rabbitmq_queue_http_dpratio/rabbitmq_queue_http_dpratio_test.go
  • tests/scalers/rabbitmq/rabbitmq_queue_http_dget/rabbitmq_queue_http_dget_test.go

Semgrep found a possible database connection string built with string concatenation. Check for proper encoding/escaping of components to prevent parse errors and injection vulnerabilities.

@mgs2
Copy link
Contributor Author

mgs2 commented Sep 9, 2025

e2e test would be really great to have

E2E tests have been added.

Note however, that they'll work only with updated tests-rabbitmq Docker image (see kedacore/test-tools#226).

please create a new issue with the problem description and refrence in the changelog

Done (#7071).

Done.

mgs2 added 5 commits September 9, 2025 23:30
…ght previously in bulk substitution

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
…ght previously in bulk substitution

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
@zroubalik zroubalik requested a review from Copilot September 18, 2025 10:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds three new trigger modes to the RabbitMQ scaler: DeliverGetRate, PublishedToDeliveredRatio, and ExpectedQueueConsumptionTime. These new modes provide more granular scaling capabilities based on message delivery rates and queue consumption patterns.

  • Updates RabbitMQ scaler to support delivery rate monitoring and ratio-based scaling
  • Adds comprehensive test coverage for the new trigger modes with dedicated test files
  • Improves error messages and code maintainability throughout the scaler implementation

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/scalers/rabbitmq_scaler.go Core implementation of new trigger modes and updated scaler logic
pkg/scalers/rabbitmq_scaler_test.go Updated unit tests with new trigger mode test data
tests/scalers/rabbitmq/rabbitmq_helper.go Enhanced helper functions for message publishing/consuming with rate control
tests/scalers/rabbitmq/rabbitmq_queue_http_*_test.go Integration tests for each new trigger mode
CHANGELOG.md Documentation of the new feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@zroubalik
Copy link
Member

zroubalik commented Sep 18, 2025

/run-e2e rabbit
Update: You can check the progress here

@zroubalik zroubalik mentioned this pull request Sep 18, 2025
22 tasks
@wozniakjan
Copy link
Member

wozniakjan commented Sep 24, 2025

/run-e2e rabbit
Update: You can check the progress here

@wozniakjan
Copy link
Member

tests timeout when setting up strimzi

=== RUN   TestSetUpStrimzi
    setup_test.go:***5***: --- installing kafka operator ---
    helper.go:***60: deleting namespace strimzi
    helper.go:***4: waiting for namespace strimzi deletion
    helper.go:***47: Creating namespace - strimzi
    setup_test.go:***67: 
        	Error Trace:	/__w/keda/keda/tests/utils/setup_test.go:***67
        	Error:      	Received unexpected error:
        	            	Error: context deadline exceeded
        	Test:       	TestSetUpStrimzi
        	Messages:   	cannot execute command - Error: context deadline exceeded
    setup_test.go:***69: --- kafka operator installed ---
--- FAIL: TestSetUpStrimzi (***4.9***s)

maybe related to #6929?

Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
@wozniakjan
Copy link
Member

wozniakjan commented Sep 30, 2025

/run-e2e rabbit
Update: You can check the progress here

@wozniakjan
Copy link
Member

wozniakjan commented Sep 30, 2025

all tests passed, lgtm

Passed tests:
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_dpratio/rabbitmq_queue_http_dpratio_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_regex/rabbitmq_queue_http_regex_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_regex_aad_wi/rabbitmq_queue_http_regex_aad_wi_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_vhost/rabbitmq_queue_http_vhost_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_aad_wi/rabbitmq_queue_http_aad_wi_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_eqct/rabbitmq_queue_http_eqct_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_http/rabbitmq_queue_http_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_regex_vhost/rabbitmq_queue_http_regex_vhost_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_dget/rabbitmq_queue_http_dget_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_amqp/rabbitmq_queue_amqp_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_amqp_vhost/rabbitmq_queue_amqp_vhost_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_amqp_auth/rabbitmq_queue_amqp_auth_test.go, has passed after "one" attempts
	Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_auth/rabbitmq_queue_http_auth_test.go, has passed after "one" attempts

Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
@wozniakjan
Copy link
Member

wozniakjan commented Sep 30, 2025

/run-e2e rabbit
Update: You can check the progress here

@wozniakjan wozniakjan enabled auto-merge (squash) September 30, 2025 16:09
@wozniakjan wozniakjan disabled auto-merge October 2, 2025 11:51
@wozniakjan wozniakjan merged commit 3615974 into kedacore:main Oct 2, 2025
24 checks passed
@mgs2 mgs2 deleted the feat/rabbitmq-add-new-modes branch October 4, 2025 20:50
@mgs2
Copy link
Contributor Author

mgs2 commented Oct 26, 2025

@zroubalik, @wozniakjan,
While this feature got merged into upstream some time ago, the docs regarding RabbitMQ scaler are still out of date. Can any of you take a look at kedacore/keda-docs#1601, please?

@JorTurFer
Copy link
Member

Thanks for the heads up, I think that my colleagues missed the docs part, sorry :(

Could you rebase docs and apply the change also to v2.19?

alt-dima pushed a commit to alt-dima/keda that referenced this pull request Dec 13, 2025
…ptionTime trigger modes to RabbitMQ scaler (kedacore#6933)

* add DeliverGetRate and PublishedToDeliveredRatio trigger modes to RabbitMQ scaler

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* changelog update

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* changlog entry updated

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fix invalid mode in e2e tests

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* report complete list of available trigger modes when returning error to the user

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* move description in changelog to improvements section

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* - RMQPublishMessages(): add support for constant messages publication interval
- add E2E tests for DeliverGetRate, PublishedToDeliveredRatio and ExpectedQueueConsumptionTime trigger modes

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* - add ExpectedQueueConsumptionTime trigger mode to RabbitMQ scaler
- updated some output messages

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* ChangeLog update

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fixed missing interval argument in RMQPublishMessages() calls not caught previously in bulk substitution

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fixed missing interval argument in RMQPublishMessages() calls not caught previously in bulk substitution

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* apply static checks recommendations

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* missing fixes to errors reported by static checks

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fixed error expected messages in TestRabbitMQAnonymizeRabbitMQError

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

---------

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: Dmitriy Altuhov <altuhovd@gmail.com>
tangobango5 pushed a commit to tangobango5/keda that referenced this pull request Dec 22, 2025
…ptionTime trigger modes to RabbitMQ scaler (kedacore#6933)

* add DeliverGetRate and PublishedToDeliveredRatio trigger modes to RabbitMQ scaler

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* changelog update

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* changlog entry updated

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fix invalid mode in e2e tests

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* report complete list of available trigger modes when returning error to the user

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* move description in changelog to improvements section

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* - RMQPublishMessages(): add support for constant messages publication interval
- add E2E tests for DeliverGetRate, PublishedToDeliveredRatio and ExpectedQueueConsumptionTime trigger modes

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* - add ExpectedQueueConsumptionTime trigger mode to RabbitMQ scaler
- updated some output messages

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* ChangeLog update

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fixed missing interval argument in RMQPublishMessages() calls not caught previously in bulk substitution

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fixed missing interval argument in RMQPublishMessages() calls not caught previously in bulk substitution

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* apply static checks recommendations

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* missing fixes to errors reported by static checks

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fixed error expected messages in TestRabbitMQAnonymizeRabbitMQError

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

---------

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
tangobango5 pushed a commit to tangobango5/keda that referenced this pull request Feb 13, 2026
…ptionTime trigger modes to RabbitMQ scaler (kedacore#6933)

* add DeliverGetRate and PublishedToDeliveredRatio trigger modes to RabbitMQ scaler

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* changelog update

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* changlog entry updated

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fix invalid mode in e2e tests

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* report complete list of available trigger modes when returning error to the user

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* move description in changelog to improvements section

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* - RMQPublishMessages(): add support for constant messages publication interval
- add E2E tests for DeliverGetRate, PublishedToDeliveredRatio and ExpectedQueueConsumptionTime trigger modes

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* - add ExpectedQueueConsumptionTime trigger mode to RabbitMQ scaler
- updated some output messages

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* ChangeLog update

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fixed missing interval argument in RMQPublishMessages() calls not caught previously in bulk substitution

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fixed missing interval argument in RMQPublishMessages() calls not caught previously in bulk substitution

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* apply static checks recommendations

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* missing fixes to errors reported by static checks

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

* fixed error expected messages in TestRabbitMQAnonymizeRabbitMQError

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>

---------

Signed-off-by: Wojciech Moczulski <wojciech.moczulski@stormlabs.eu>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants