Class MetricSample

java.lang.Object
org.acemq.rabbitmq.admin.metrics.MetricSample

public final class MetricSample extends Object
One measurement: a metric name, its labels, and a number.

The unit of everything in a Prometheus scrape. rabbitmq_detailed_queue_messages_ready with {vhost="/", queue="orders.new"} and the value 42 is one sample; the same metric for another queue is a different sample with the same name.

  • Constructor Details

  • Method Details

    • name

      public String name()
      Returns:
      the metric name, without labels
    • labels

      public Map<String,String> labels()
      Returns:
      the labels, in the order the broker wrote them
    • label

      public Optional<String> label(String name)
      Parameters:
      name - a label
      Returns:
      its value, or empty when this sample does not carry it. Absent rather than null, because the aggregate endpoint publishes the same metric names with no labels at all and code written against the detailed endpoint would otherwise fail on the wrong one
    • queue

      public Optional<String> queue()
      Returns:
      the queue this sample is about, when it is about one
    • value

      public double value()
      Returns:
      the value
    • asLong

      public long asLong()
      Returns:
      the value as a whole number, which is what a count or a depth always is
    • toString

      public String toString()
      Overrides:
      toString in class Object