Skip to content

Expose per-queue delivered and acked totals in Prometheus metrics#1837

Open
lukas8219 wants to merge 3 commits intomainfrom
issue-1831
Open

Expose per-queue delivered and acked totals in Prometheus metrics#1837
lukas8219 wants to merge 3 commits intomainfrom
issue-1831

Conversation

@lukas8219
Copy link
Copy Markdown
Contributor

WHAT is this pull request doing?

Adds lavinmq_detailed_queue_messages_delivered_total and lavinmq_detailed_queue_messages_acked_total counters to the queue_coarse_metrics family on /metrics/detailed. These use the same deliver_get_count and ack_count counters shown in the Overview API, now broken down per queue with queue and vhost labels. This enables per-queue latency calculations like latency ≈ (ready + unacked) / ack_rate.

Closes #1831

HOW can this pull request be tested?

make test SPEC=spec/api/prometheus_spec.cr — includes a new spec that publishes, consumes, and acks messages then verifies both new metrics appear with correct values.

Add `detailed_queue_messages_delivered_total` and
`detailed_queue_messages_acked_total` counters to the
`queue_coarse_metrics` family, enabling per-queue latency calculations.

Closes #1831

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lukas8219 lukas8219 requested a review from a team as a code owner March 31, 2026 17:13
lukas8219 and others added 2 commits March 31, 2026 17:31
Use synchronous basic_get instead of async subscribe to avoid
a race where server-side ack processing hasn't completed before
metrics are fetched.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restore subscribe-based consumption (tests the push consumer path)
and use should_eventually to retry the metrics assertion until
server-side ack processing completes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lukas8219 lukas8219 marked this pull request as draft March 31, 2026 20:32
@claude
Copy link
Copy Markdown

claude bot commented Mar 31, 2026

Code Review

No issues found.

The new metrics follow the same pattern as existing metrics in the queue_coarse_metrics family, reading from atomic counters (deliver_get_count, ack_count) that are already maintained on the queue objects. The spec covers both new counters with publish/consume/ack verification.

@lukas8219 lukas8219 marked this pull request as ready for review March 31, 2026 20:40
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.

Expose lavinmq_detailed_queue_messages_(delivered|acked)_total metrics

1 participant