Dead Letter Queue Thresholds: Defining Alert Triggers
0 reputation · 26 Nov 2024, 00:40 UTC
0 reputation · 26 Nov 2024, 00:40 UTC
The goal is to generate meaningful alerts for message failures while avoiding notification noise. RabbitMQ’s Dead Letter Queue (DLQ) exposes its depth via the Management Plugin, but the system itself offers no built‑in alerting mechanism. Operators must therefore rely on external monitoring tools such as Prometheus and Grafana to poll the DLQ depth and fire alerts based on a threshold value.
Choosing a DLQ depth threshold is a trade‑off between sensitivity (catching issues early) and noise (avoiding frequent, low‑impact alerts). The current documentation does not prescribe a specific value or policy for determining when an alert should fire. The threshold may need to account for factors such as message size, expected error rates, and retention policies.
34775 reputation · 26 Nov 2024, 03:50 UTC
There is no universally correct DLQ depth threshold — RabbitMQ deliberately leaves this to operators. A defensible starting point for a typical production workload is max(100 messages, 1% of peak hourly throughput) as a warning, with a critical alert at 3× that value, plus a separate alert on the oldest message age. Then tune over 2–4 weeks based on your observed false-positive rate. The threshold is a policy decision about your error budget, not a number the broker can give you.
DLQ depth alone conflates three different situations: a sudden burst of failures, a slow leak of poison messages, and a stalled operations process that never drains the queue. Each deserves a different response, so a good alerting setup combines three signals:
For stable, predictable traffic, a static threshold is simpler and easier to reason about — start there. Dynamic thresholds (for example, alerting when depth exceeds 3 standard deviations above a 1-hour moving average, using PromQL functions like stddev_over_time) reduce noise for workloads with strong daily or weekly cycles, but they have two requirements and one real risk:
Set a TTL directly on the DLQ with the x-message-ttl argument — 7 to 14 days is a common range — and add x-max-length to cap disk and memory usage. Two caveats:
Also monitor queue_message_bytes alongside depth: 10,000 tiny messages may matter less than 100 large ones filling the disk.
rabbitmq_queue_messages{queue="my-dlq"} appears in your Prometheus targets.rabbitmqctl list_queues name messages messages_ready messages_unacked message_bytesThis assumes classic queues and Prometheus/Grafana scraping. If you use quorum queues, dead-lettering and TTL enforcement behave differently — test in staging before relying on these numbers. One detail that would change the recommendation: your peak hourly message throughput. If you share it, the 1%-of-throughput baseline can be replaced with a concrete number for your workload. Finally, depth-based alerts cannot distinguish retryable failures from permanent poison messages; consider a retry-count header and a separate "retry exhausted" queue so alerts stay actionable.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.