Interface FunctionTimer

All Superinterfaces:
Meter
All Known Implementing Classes:
CumulativeFunctionTimer, DropwizardFunctionTimer, NoopFunctionTimer, StepFunctionTimer

public interface FunctionTimer
extends Meter
A timer that tracks two monotonically increasing functions: one representing the count of events and one representing the total time spent in every event.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Interface Description
    static class  FunctionTimer.Builder<T>
    Fluent builder for function timer.

    Nested classes/interfaces inherited from interface io.micrometer.core.instrument.Meter

    Meter.Id, Meter.Type
  • Method Summary

    Modifier and Type Method Description
    java.util.concurrent.TimeUnit baseTimeUnit()  
    static <T> FunctionTimer.Builder<T> builder​(java.lang.String name, T obj, java.util.function.ToLongFunction<T> countFunction, java.util.function.ToDoubleFunction<T> totalTimeFunction, java.util.concurrent.TimeUnit totalTimeFunctionUnit)  
    double count()  
    default double mean​(java.util.concurrent.TimeUnit unit)  
    default java.lang.Iterable<Measurement> measure()
    Get a set of measurements.
    double totalTime​(java.util.concurrent.TimeUnit unit)
    The total time of all occurrences of the timed event.

    Methods inherited from interface io.micrometer.core.instrument.Meter

    close, getId, match, use
  • Method Details

    • builder

      static <T> FunctionTimer.Builder<T> builder​(java.lang.String name, T obj, java.util.function.ToLongFunction<T> countFunction, java.util.function.ToDoubleFunction<T> totalTimeFunction, java.util.concurrent.TimeUnit totalTimeFunctionUnit)
    • count

      double count()
      Returns:
      The total number of occurrences of the timed event.
    • totalTime

      double totalTime​(java.util.concurrent.TimeUnit unit)
      The total time of all occurrences of the timed event.
      Parameters:
      unit - The base unit of time to scale the total to.
      Returns:
      The total time of all occurrences of the timed event.
    • mean

      default double mean​(java.util.concurrent.TimeUnit unit)
      Parameters:
      unit - The base unit of time to scale the mean to.
      Returns:
      The distribution average for all recorded events.
    • baseTimeUnit

      java.util.concurrent.TimeUnit baseTimeUnit()
      Returns:
      The base time unit of the timer to which all published metrics will be scaled
    • 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.