Class PollingAwareMockStepClock

java.lang.Object
io.micrometer.core.instrument.step.PollingAwareMockStepClock
All Implemented Interfaces:
io.micrometer.core.instrument.Clock

@Incubating(since="1.11.1") public class PollingAwareMockStepClock extends Object implements io.micrometer.core.instrument.Clock
A clock meant to be used for testing StepMeterRegistry. This clock does the StepMeterRegistry.pollMetersToRollover() whenever the step is crossed thus simulating the expected behaviour of step meters.
Since:
1.11.1
  • Field Summary

    Fields inherited from interface io.micrometer.core.instrument.Clock

    SYSTEM
  • Constructor Summary

    Constructors
    Constructor
    Description
    PollingAwareMockStepClock(io.micrometer.core.instrument.step.StepRegistryConfig stepRegistryConfig)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    add(Duration duration, io.micrometer.core.instrument.step.StepMeterRegistry stepMeterRegistry)
    Advances clock by the duration specified and does StepMeterRegistry.pollMetersToRollover() if necessary.
    long
     
    long
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PollingAwareMockStepClock

      public PollingAwareMockStepClock(io.micrometer.core.instrument.step.StepRegistryConfig stepRegistryConfig)
  • Method Details

    • wallTime

      public long wallTime()
      Specified by:
      wallTime in interface io.micrometer.core.instrument.Clock
    • monotonicTime

      public long monotonicTime()
      Specified by:
      monotonicTime in interface io.micrometer.core.instrument.Clock
    • add

      public long add(Duration duration, io.micrometer.core.instrument.step.StepMeterRegistry stepMeterRegistry)
      Advances clock by the duration specified and does StepMeterRegistry.pollMetersToRollover() if necessary.
      Parameters:
      duration - amount to increment by
      stepMeterRegistry - StepMeterRegistry to which clock is tied
      Returns:
      current time after adding step