Interface TimeGauge

  • All Superinterfaces:
    Gauge, Meter
    All Known Implementing Classes:
    NoopTimeGauge

    public interface TimeGauge
    extends Gauge
    A specialized gauge that tracks a time value, to be scaled to the base unit of time expected by each registry implementation.
    • Nested Class Summary

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

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.util.concurrent.TimeUnit baseTimeUnit()  
      static <T> TimeGauge.Builder<T> builder​(java.lang.String name, T obj, java.util.concurrent.TimeUnit fUnits, java.util.function.ToDoubleFunction<T> f)  
      default double value​(java.util.concurrent.TimeUnit unit)
      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> TimeGauge.Builder<T> builder​(java.lang.String name,
                                                @Nullable
                                                T obj,
                                                java.util.concurrent.TimeUnit fUnits,
                                                java.util.function.ToDoubleFunction<T> f)
      • baseTimeUnit

        java.util.concurrent.TimeUnit baseTimeUnit()
        Returns:
        The base time unit of the timer to which all published metrics will be scaled
      • value

        default double value​(java.util.concurrent.TimeUnit unit)
        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.
        Parameters:
        unit - The base unit of time to scale the value to.
        Returns:
        The current value, scaled to the appropriate base unit.