Class NoopTimer

java.lang.Object
All Implemented Interfaces:
HistogramSupport, Meter, Timer

public class NoopTimer
extends NoopMeter
implements Timer
  • Nested Class Summary

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

    Meter.Builder, Meter.Id, Meter.Type

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

    Timer.Builder, Timer.ResourceSample, Timer.Sample
  • Constructor Summary

    Constructors
    Constructor Description
    NoopTimer​(Meter.Id id)  
  • Method Summary

    Modifier and Type Method Description
    java.util.concurrent.TimeUnit baseTimeUnit()  
    long count()  
    double max​(java.util.concurrent.TimeUnit unit)  
    void record​(long amount, java.util.concurrent.TimeUnit unit)
    Updates the statistics kept by the timer with the specified amount.
    void record​(java.lang.Runnable f)
    Executes the runnable f and records the time taken.
    <T> T record​(java.util.function.Supplier<T> f)
    Executes the Supplier f and records the time taken.
    <T> T recordCallable​(java.util.concurrent.Callable<T> f)
    Executes the callable f and records the time taken.
    HistogramSnapshot takeSnapshot()
    Summary statistics should be published off of a single snapshot instance so that, for example, there isn't disagreement between the distribution's bucket counts because more events continue to stream in.
    double totalTime​(java.util.concurrent.TimeUnit unit)  

    Methods inherited from class io.micrometer.core.instrument.noop.NoopMeter

    measure

    Methods inherited from class io.micrometer.core.instrument.AbstractMeter

    getId

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micrometer.core.instrument.distribution.HistogramSupport

    takeSnapshot

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

    close, getId, match, use

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

    histogramCountAtValue, mean, measure, percentile, record, wrap, wrap, wrap
  • Constructor Details

    • NoopTimer

      public NoopTimer​(Meter.Id id)
  • Method Details

    • record

      public void record​(long amount, java.util.concurrent.TimeUnit unit)
      Description copied from interface: Timer
      Updates the statistics kept by the timer with the specified amount.
      Specified by:
      record in interface Timer
      Parameters:
      amount - Duration of a single event being measured by this timer. If the amount is less than 0 the value will be dropped.
      unit - Time unit for the amount being recorded.
    • record

      public <T> T record​(java.util.function.Supplier<T> f)
      Description copied from interface: Timer
      Executes the Supplier f and records the time taken.
      Specified by:
      record in interface Timer
      Type Parameters:
      T - The return type of the Supplier.
      Parameters:
      f - Function to execute and measure the execution time.
      Returns:
      The return value of f.
    • recordCallable

      public <T> T recordCallable​(java.util.concurrent.Callable<T> f) throws java.lang.Exception
      Description copied from interface: Timer
      Executes the callable f and records the time taken.
      Specified by:
      recordCallable in interface Timer
      Type Parameters:
      T - The return type of the Callable.
      Parameters:
      f - Function to execute and measure the execution time.
      Returns:
      The return value of f.
      Throws:
      java.lang.Exception - Any exception bubbling up from the callable.
    • record

      public void record​(java.lang.Runnable f)
      Description copied from interface: Timer
      Executes the runnable f and records the time taken.
      Specified by:
      record in interface Timer
      Parameters:
      f - Function to execute and measure the execution time.
    • count

      public long count()
      Specified by:
      count in interface Timer
      Returns:
      The number of times that stop has been called on this timer.
    • totalTime

      public double totalTime​(java.util.concurrent.TimeUnit unit)
      Specified by:
      totalTime in interface Timer
      Parameters:
      unit - The base unit of time to scale the total to.
      Returns:
      The total time of recorded events.
    • max

      public double max​(java.util.concurrent.TimeUnit unit)
      Specified by:
      max in interface Timer
      Parameters:
      unit - The base unit of time to scale the max to.
      Returns:
      The maximum time of a single event.
    • baseTimeUnit

      public java.util.concurrent.TimeUnit baseTimeUnit()
      Specified by:
      baseTimeUnit in interface Timer
      Returns:
      The base time unit of the timer to which all published metrics will be scaled
    • takeSnapshot

      public HistogramSnapshot takeSnapshot()
      Description copied from interface: HistogramSupport
      Summary statistics should be published off of a single snapshot instance so that, for example, there isn't disagreement between the distribution's bucket counts because more events continue to stream in.
      Specified by:
      takeSnapshot in interface HistogramSupport
      Returns:
      A snapshot of all distribution statistics at a point in time.