Skip to content

Refactored querying RabbitMQ query status from RabbitMQ admin api - #137

Merged
Hilbrand merged 2 commits into
aerius:mainfrom
Hilbrand:rabbitmq-client-metrics
Sep 25, 2026
Merged

Hilbrand merged 2 commits into
aerius:mainfrom
Hilbrand:rabbitmq-client-metrics

Conversation

@Hilbrand

@Hilbrand Hilbrand commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

This changes the way the scheduled RabbitMQ admin api is queried to get the latest stats on queries. It used to query per worker queue, but this change queries the data for all queues at once.
This will make it easier to also get status on all client queues. This change is in preparation to create telemetry metrics on client queues.
To keep things simple the changes for client queue metrics is not included in this pr.
Most of the changes in the pr are due to using a record to pass the states instead of the individual values to methods. It also changes the frequency the api is queried to 10 seconds. It was 60 seconds, but it did that for each worker queue. With this change it only needs 1 call and we'll get slightly more detailed data by querying a bit more often.
With this change the event based update of channels state triggered by RabbitMQ events has been removed, as the new 10 seconds update fast enough to handle changes.

This changes the way the scheduled RabbitMQ admin api is queried to get the latest stats on queries. It used to query per worker queue, but this change queries the data for all queues at once.
This will make it easier to also get status on all client queues. This change is in preparation to create telemetry metrics on client queues.
To keep things simple the changes for client queue metrics is not included in this pr.
Most of the changes in the pr are due to using a record to pass the states instead of the individual values to methods.
It also changes the frequency the api is queried to each 20 seconds. It was 60 seconds, but it did that for each worker queue. With this change it only needs 1 call and we'll get slightly more detailed data by querying a bit more often.
@SerhatG

SerhatG commented Sep 18, 2026

Copy link
Copy Markdown
Member

is the difference between getWorkerQueueState() and getWorkerQueueStates() that the latter is used to fetch them all (so every 20 seconds).. and first former to update it when we get an event from the event_exchange plugin, letting us know the amount of consumers changed?

If that's the case I would be open to simplify taskmanager a bit and simply fetch all queues every 10 seconds and use that and get rid of the events_exchange.. Or did we use it for other purposes as well?

@Hilbrand

Copy link
Copy Markdown
Member Author

@SerhatG Yes that is how it works. The event_exchange is also only used here.
My first version had actually implemented it with this removed (not yet all code was removed, only the update call) and the 10 seconds update. But when testing I noticed the startup had some lagging to detect the changes, therefore I put it back. However, this is basically only a little inconvenience when developing and not really an issue on a production system. So yes it will make it cleaner if removed. I'll remove it.

…vents, and reduced generic update frequency to 10 seconds

10 seconds update frequency is enough to handle worker changes. Removing the additional event based trigger reduces complexity of the code.

@BertScholten BertScholten left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, just 1 check question about test data

@Hilbrand
Hilbrand merged commit 8ce03f6 into aerius:main Sep 25, 2026
1 check passed
@Hilbrand
Hilbrand deleted the rabbitmq-client-metrics branch September 25, 2026 12:59
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.

3 participants