Skip to content
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

HTTP API: GET /api/queues/{vhost}/{name} now supports enable_queue_totals #10839

Merged

Conversation

aaron-seo
Copy link
Contributor

@aaron-seo aaron-seo commented Mar 24, 2024

Proposed Changes

Attempt at issue #10314.

For /api/queues, users can specify disable_stats=true and enable_queue_totals=true parameters to return a concise set of fields. However, the enable_queue_totals is not currently supported for /api/queues/<vhost>/<name>, probably just a small oversight that "slipped through the cracks".

This commit adds that support and updates the respective unit test, focusing on not breaking existing public functions and on simplicity, at the cost of a slight bit of duplication.

Testing

  1. Run broker with changes
    bazel run broker RABBITMQ_NODENAME=rmq1@localhost RABBITMQ_ENABLED_PLUGINS='rabbitmq_management,rabbitmq_prometheus'

  2. Perform some load on a queue with perf-test tool

  3. GET http://guest:guest@localhost:15672/api/queues/%2F/test-queue?disable_stats=true

{
	"arguments": {},
	"auto_delete": false,
	"durable": true,
	"exclusive": false,
	"name": "test-queue",
	"node": "rmq1@localhost",
	"state": "running",
	"type": "classic",
	"vhost": "/"
}
  1. GET http://guest:guest@localhost:15672/api/queues/%2F/test-queue?disable_stats=true&enable_queue_totals=true
{
	"arguments": {},
	"auto_delete": false,
	"durable": true,
	"exclusive": false,
	"messages": 175,
	"messages_ready": 175,
	"messages_unacknowledged": 0,
	"name": "test-queue",
	"node": "rmq1@localhost",
	"online": null,
	"state": "running",
	"type": "classic",
	"vhost": "/"
}

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Build system and/or CI

Checklist

Put an x in the boxes that apply.
You can also fill these out after creating the PR.
If you're unsure about any of them, don't hesitate to ask on the mailing list.
We're here to help!
This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally with my changes
  • If relevant, I have added necessary documentation to https://github.com/rabbitmq/rabbitmq-website
  • If relevant, I have added this change to the first version(s) in release-notes that I expect to introduce it

Further Comments

Not super familiar Erlang best practices, please critique as needed :)

For `/api/queues`, users can specify `disable_stats=true` and
`enable_queue_totals=true` parameters to return a concise set of
fields. However, the `enable_queue_totals` is not currently
supported for `/api/queues/<vhost>/<name>`, probably just a small
oversight that slipped through the cracks. This commit adds that
support and updates the respective unit test, focusing on not breaking
existing public functions and on simplicity, at the cost of a slight
bit of duplication.
@pivotal-cla
Copy link

@aaron-seo Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@aaron-seo Thank you for signing the Contributor License Agreement!

@michaelklishin
Copy link
Member

@aaron-seo you aren't missing anything, the CLA bot is quite simplistic.

@aaron-seo
Copy link
Contributor Author

@aaron-seo you aren't missing anything, the CLA bot is quite simplistic.

Haha yeah, I guess I needed to make my affiliation public (sorry deleted the previous message)

@michaelklishin michaelklishin changed the title Support enable_queue_totals when queue name is specified HTTP API: GET /api/queues/{vhost}/{name} now supports enable_queue_totals Mar 24, 2024
@michaelklishin michaelklishin added this to the 3.13.1 milestone Mar 25, 2024
@michaelklishin michaelklishin merged commit 524d688 into rabbitmq:main Mar 25, 2024
11 checks passed
michaelklishin added a commit that referenced this pull request Mar 25, 2024
HTTP API: GET /api/queues/{vhost}/{name} now supports enable_queue_totals (backport #10839)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants