Class Alerts

java.lang.Object
org.acemq.rabbitmq.admin.alerts.Alerts

public final class Alerts extends Object
The alerts worth having, ready made.

 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.

  • Field Details

  • Method Details

    • queueNotDraining

      public static AlertRule 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

      public static AlertRule 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 .dlq or .dead-letter
    • deadLetters

      public static AlertRule deadLetters(String queuePattern)
      Parameters:
      queuePattern - a regular expression matching your dead-letter queue names in full
      Returns:
      the rule, for an estate that names them differently
    • memoryAlarm

      public static AlertRule 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

      public static AlertRule diskAlarm()
      A broker refusing publishes because it is out of disk.

      The alarm diskAlarmApproaching() warns about, once it has tripped.

      Returns:
      the rule
    • diskAlarmApproaching

      public static AlertRule 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

      public static Alerts.AlertSet recommended()
      Returns:
      the five above, as a set that can be evaluated or exported together