Interface Gauge

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Gauge.Builder<T>
      Fluent builder for gauges.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      static Gauge.Builder<java.util.function.Supplier<java.lang.Number>> builder​(java.lang.String name, java.util.function.Supplier<java.lang.Number> f)
      A convenience method for building a gauge from a supplying function, holding a strong reference to this function.
      static <T> Gauge.Builder<T> builder​(java.lang.String name, T obj, java.util.function.ToDoubleFunction<T> f)  
      default java.lang.Iterable<Measurement> measure()
      Get a set of measurements.
      double value()
      The act of observing the value by calling this method triggers sampling of the underlying number or user-defined function that defines the value for the gauge.
    • Method Detail

      • builder

        static <T> Gauge.Builder<T> builder​(java.lang.String name,
                                            @Nullable
                                            T obj,
                                            java.util.function.ToDoubleFunction<T> f)
        Type Parameters:
        T - The type of object to gauge.
        Parameters:
        name - The gauge's name.
        obj - An object with some state or function which the gauge's instantaneous value is determined from.
        f - A function that yields a double value for the gauge, based on the state of obj.
        Returns:
        A new gauge builder.
      • builder

        @Incubating(since="1.1.0")
        static Gauge.Builder<java.util.function.Supplier<java.lang.Number>> builder​(java.lang.String name,
                                                                                    java.util.function.Supplier<java.lang.Number> f)
        A convenience method for building a gauge from a supplying function, holding a strong reference to this function.
        Parameters:
        name - The gauge's name.
        f - A function that yields a double value for the gauge.
        Returns:
        A new gauge builder.
        Since:
        1.1.0
      • value

        double value()
        The act of observing the value by calling this method triggers sampling of the underlying number or user-defined function that defines the value for the gauge.
        Returns:
        The current value.
      • measure

        default java.lang.Iterable<Measurement> measure()
        Description copied from interface: Meter
        Get a set of measurements. Should always return the same number of measurements and in the same order, regardless of the level of activity or the lack thereof.
        Specified by:
        measure in interface Meter
        Returns:
        The set of measurements that represents the instantaneous value of this meter.