Skip to content

Return policy and op-policy-related fields plus delivery_limit when management stats are disabled#15651

Merged
michaelklishin merged 4 commits intomainfrom
amazon-mq-rabbitmq-server-15182
Mar 6, 2026
Merged

Return policy and op-policy-related fields plus delivery_limit when management stats are disabled#15651
michaelklishin merged 4 commits intomainfrom
amazon-mq-rabbitmq-server-15182

Conversation

@michaelklishin
Copy link
Copy Markdown
Collaborator

This is #15183 by @lukebakken with a few follow-up changes from me.

Closes #15182.

lukebakken and others added 2 commits March 5, 2026 07:48
When `management_agent.disable_metrics_collector` and
`management.disable_stats` are both set to `true`, the HTTP API returns
minimal queue information that excludes policy-related fields and
`delivery_limit`. This causes `policy`, `operator_policy`,
`effective_policy_definition`, and `delivery_limit` to be `null` in API
responses, even though these are configuration metadata rather than
statistics.

This change adds these four fields to the `format/2` function in both
`rabbit_classic_queue` and `rabbit_quorum_queue` modules. The fields now
appear in the type-specific formatting that runs regardless of metrics
collection status. The three policy fields use existing `i/2` function
implementations that call `rabbit_policy` module functions. For
`delivery_limit`, this change adds an `i(delivery_limit, Q)` function to
`rabbit_quorum_queue` that extracts the delivery limit from the queue's
`x-delivery-limit` argument, returning `unlimited` when not set.

Fixes #15182
The changes in #15182 missed streams.

`stats_disabled_via_config` (a test group) unintentionally
overridden `disable_management_stats` due to how
the parameter merging works.

On top of that, add more tests and refactor
the implementation to be a bit more defensive
and consistent.
@michaelklishin michaelklishin added this to the 4.3.0 milestone Mar 5, 2026
…re enabled

`rabbit_queue_type:format/2` now conditionally emits policy fields only
when management stats are disabled: the stats augmentation
code path provides them.

1. `format/2` now conditionally emits policy fields
   based on whether the management plugin stats are enabled
2. `combine/2` acts as the next layer of protection
   against duplicate keys: it drops the `format/2`-originating
   keys that are duplicates
3. `prepare_for_encoding/1` is the new name for `format_nulls/1`
   that reflects its expanded scope: another deduplication pass

References #15182.
@michaelklishin michaelklishin merged commit 646363c into main Mar 6, 2026
185 checks passed
@michaelklishin michaelklishin deleted the amazon-mq-rabbitmq-server-15182 branch March 6, 2026 04:58
mergify bot pushed a commit that referenced this pull request Mar 6, 2026
(cherry picked from commit 1824d3f)
michaelklishin added a commit that referenced this pull request Mar 6, 2026
(cherry picked from commit 1824d3f)
michaelklishin added a commit that referenced this pull request Mar 6, 2026
Return policy and op-policy-related fields plus `delivery_limit` when management stats are disabled (backport #15651)
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.

Disabling management statistics removes non-stats data from HTTP API

2 participants