Interface Gauge<T extends Number>

  • Type Parameters:
    T - the type of the metric's value. Must be numeric.
    All Superinterfaces:
    Metric
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Gauge<T extends Number>
    extends Metric
    A gauge metric is an instantaneous reading of a particular value. To instrument a queue's depth, for example:
     
     final Queue<String> queue = new ConcurrentLinkedQueue<String>();
     final Gauge<Integer> queueDepth = new Gauge<Integer>() {
         public Integer getValue() {
             return queue.size();
         }
     };
     
     
    • Method Detail

      • getValue

        T getValue()
        Returns the metric's current value.
        Returns:
        the metric's current value