-
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
Extend RabbitMQ scaler to support count unacked messages #700
Conversation
Signed-off-by: Alex Emelyanov <[email protected]>
3d6e809
to
6a2e827
Compare
Docs are saying this:
Which requires following URLs:
One could argue that we should always require Certainly since vhost is being added via kedacore/keda-docs#70 (pending review) which is also the same. |
Sure I tried it first (parse AMQP connection string, replace protocol, port, extract vhost) and suddenly discovered that our credentials for AMQP protocol has different permissions level and can't be used to access management API. That is why I introduced new connection string. We can use all different fields for like
Hm, we have been using vhost in AMQP connection string since we started to use Keda and it works ). You mean it wasn't documented? |
pkg/scalers/rabbitmq_scaler.go
Outdated
if err != nil { | ||
rabbitmqLog.Error(err, "Error closing rabbitmq connection") | ||
return err | ||
if s.metadata.countUnacked == false { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about s.connection != nil
so it'd make sure to dispose the connection if it's at all created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @holyketzer, and appreciate the thorough test. I have one minor comment.
I'm not very familiar with rabbitmq, so not sure I have anything to add to the discussion. I think having a single |
I think using
Yes, I've merged it now |
+1 good questions I agree with @tomkerkhove point on opening a new issue targeted for 2.0 for the breaking change (in case it makes sense to implement it that way wrt the questions raised by @ahmelsayed). |
Ok, I got all the points and going to fix all of them. |
Signed-off-by: Alex Emelyanov <[email protected]>
5f8d644
to
ce4c385
Compare
Feedback is accepted I pushed fixes + fix for doc PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from a config/semantics approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@ahmelsayed should we merge this one? WDYT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too
Thanks @holyketzer for your contributions! |
Cool thank you guys! |
* Extend RabbitMQ scaler to support count unacked messages Signed-off-by: Alex Emelyanov <[email protected]> * Fix code review feedback Signed-off-by: Alex Emelyanov <[email protected]>
* Extend RabbitMQ scaler to support count unacked messages Signed-off-by: Alex Emelyanov <[email protected]> * Fix code review feedback Signed-off-by: Alex Emelyanov <[email protected]>
* Extend RabbitMQ scaler to support count unacked messages Signed-off-by: Alex Emelyanov <[email protected]> * Fix code review feedback Signed-off-by: Alex Emelyanov <[email protected]> Signed-off-by: Amith Ganesh <[email protected]>
Add settings which allows to count total messages count in queue (ready + unacked) to do not scale worker down if some long time processing is going.
By default
countUnacked = false
and it keeps old behaviour via AMQP protocol, ifcountUnacked = true
it requires alsoapiHost
to be set and uses HTTP management API to get queue info.AMQP protocol doesn't allow to fetch unacked messages count, that is we need management API here. Technically we an completely switch to management API but as I understand not all servers have it enabled, that is why backward compatibility is saved and
countUnacked
is optional.Checklist
It was tested in our Kubernetes cluster
Fixes #356