Class Alerts
List<AlertEvent> firing = Alerts.recommended().evaluate(metrics);
firing.forEach(event -> log.warn(event.message()));
Files.writeString(Path.of("acemq-alerts.yml"), Alerts.recommended().toPrometheusRules());
Five of them, and the list is short on purpose. A starter pack of thirty alerts is a starter pack of thirty things to silence, and the ones that survive contact with an on-call rota are the ones that are silent until something is genuinely wrong.
Every metric named here is asserted against a running broker by PrometheusMetricsIT.
A rule naming a metric that RabbitMQ does not emit is not a compile error and not a test
failure — it is an alert that stays silent forever, in Prometheus as well as here, and the way
you find out is the incident it did not page for.
What is deliberately not here
Queue depth. A queue is a buffer and having things in it is the job.
Depth crosses any threshold you pick during every normal burst, so the alert fires, nothing is
wrong, and within a week it is muted — taking with it the one time it would have mattered.
queueNotDraining() watches a queue with a backlog and no consumers, which
is the case that is always wrong.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classSeveral rules, evaluated and exported together. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe queue namesdeadLetters()treats as dead-letter queues. -
Method Summary
Modifier and TypeMethodDescriptionstatic AlertRuleAnything in a dead-letter queue.static AlertRuledeadLetters(String queuePattern) static AlertRuleA broker refusing publishes because it is out of disk.static AlertRuleA node running out of disk.static AlertRuleA broker refusing publishes because memory is exhausted.static AlertRuleA backlog with nobody reading it.static Alerts.AlertSet
-
Field Details
-
DEFAULT_DEAD_LETTER_PATTERN
The queue namesdeadLetters()treats as dead-letter queues.- See Also:
-
-
Method Details
-
queueNotDraining
A backlog with nobody reading it.Not a depth alarm. Depth alone is normal; depth with zero consumers means every consumer has gone and nothing is coming back on its own.
- Returns:
- the rule
-
deadLetters
Anything in a dead-letter queue.Above zero rather than above a threshold: a message reaches a dead-letter queue only after every retry has failed, so one is already a message nobody processed.
Restricted to queues named like dead-letter queues. The metric is per-queue and unfiltered it would fire, at critical, for every ordinary queue holding a single message — which is the whole broker, most of the time.
- Returns:
- the rule, matching queues ending in
.dlqor.dead-letter
-
deadLetters
- Parameters:
queuePattern- a regular expression matching your dead-letter queue names in full- Returns:
- the rule, for an estate that names them differently
-
memoryAlarm
A broker refusing publishes because memory is exhausted.A resource alarm blocks publishing connections. The broker keeps running, the consumers keep working, and every publisher stops — which looks like an application problem from every direction except this one.
- Returns:
- the rule
-
diskAlarm
A broker refusing publishes because it is out of disk.The alarm
diskAlarmApproaching()warns about, once it has tripped.- Returns:
- the rule
-
diskAlarmApproaching
A node running out of disk.The one that becomes
diskAlarm()shortly, and the difference between the two is how much time somebody has.- Returns:
- the rule
-
recommended
- Returns:
- the five above, as a set that can be evaluated or exported together
-