Class SimpleMeterRegistry

java.lang.Object
io.micrometer.core.instrument.MeterRegistry
io.micrometer.core.instrument.simple.SimpleMeterRegistry

public class SimpleMeterRegistry
extends MeterRegistry
A minimal meter registry implementation primarily used for tests.
  • Constructor Details

    • SimpleMeterRegistry

      public SimpleMeterRegistry()
    • SimpleMeterRegistry

      public SimpleMeterRegistry​(SimpleConfig config, Clock clock)
  • Method Details

    • newDistributionSummary

      protected DistributionSummary newDistributionSummary​(Meter.Id id, DistributionStatisticConfig distributionStatisticConfig, double scale)
      Description copied from class: MeterRegistry
      Build a new distribution summary to be added to the registry. This is guaranteed to only be called if the distribution summary doesn't already exist.
      Specified by:
      newDistributionSummary in class MeterRegistry
      Parameters:
      id - The id that uniquely identifies the distribution summary.
      distributionStatisticConfig - Configuration for published distribution statistics.
      scale - Multiply every recorded sample by this factor.
      Returns:
      A new distribution summary.
    • newMeter

      protected Meter newMeter​(Meter.Id id, Meter.Type type, java.lang.Iterable<Measurement> measurements)
      Description copied from class: MeterRegistry
      Build a new custom meter to be added to the registry. This is guaranteed to only be called if the custom meter doesn't already exist.
      Specified by:
      newMeter in class MeterRegistry
      Parameters:
      id - The id that uniquely identifies the custom meter.
      type - What kind of meter this is.
      measurements - A set of measurements describing how to sample this meter.
      Returns:
      A new custom meter.
    • newTimer

      protected Timer newTimer​(Meter.Id id, DistributionStatisticConfig distributionStatisticConfig, PauseDetector pauseDetector)
      Description copied from class: MeterRegistry
      Build a new timer to be added to the registry. This is guaranteed to only be called if the timer doesn't already exist.
      Specified by:
      newTimer in class MeterRegistry
      Parameters:
      id - The id that uniquely identifies the timer.
      distributionStatisticConfig - Configuration for published distribution statistics.
      pauseDetector - The pause detector to use for coordinated omission compensation.
      Returns:
      A new timer.
    • newGauge

      protected <T> Gauge newGauge​(Meter.Id id, @Nullable T obj, java.util.function.ToDoubleFunction<T> valueFunction)
      Description copied from class: MeterRegistry
      Build a new gauge to be added to the registry. This is guaranteed to only be called if the gauge doesn't already exist.
      Specified by:
      newGauge in class MeterRegistry
      Type Parameters:
      T - The type of the state object from which the gauge value is extracted.
      Parameters:
      id - The id that uniquely identifies the gauge.
      obj - State object used to compute a value.
      valueFunction - Function that is applied on the value for the number.
      Returns:
      A new gauge.
    • newCounter

      protected Counter newCounter​(Meter.Id id)
      Description copied from class: MeterRegistry
      Build a new counter to be added to the registry. This is guaranteed to only be called if the counter doesn't already exist.
      Specified by:
      newCounter in class MeterRegistry
      Parameters:
      id - The id that uniquely identifies the counter.
      Returns:
      A new counter.
    • newLongTaskTimer

      protected LongTaskTimer newLongTaskTimer​(Meter.Id id, DistributionStatisticConfig distributionStatisticConfig)
      Description copied from class: MeterRegistry
      Build a new long task timer to be added to the registry. This is guaranteed to only be called if the long task timer doesn't already exist.
      Overrides:
      newLongTaskTimer in class MeterRegistry
      Parameters:
      id - The id that uniquely identifies the long task timer.
      distributionStatisticConfig - Configuration for published distribution statistics.
      Returns:
      A new long task timer.
    • newFunctionTimer

      protected <T> FunctionTimer newFunctionTimer​(Meter.Id id, T obj, java.util.function.ToLongFunction<T> countFunction, java.util.function.ToDoubleFunction<T> totalTimeFunction, java.util.concurrent.TimeUnit totalTimeFunctionUnit)
      Description copied from class: MeterRegistry
      Build a new function timer to be added to the registry. This is guaranteed to only be called if the function timer doesn't already exist.
      Specified by:
      newFunctionTimer in class MeterRegistry
      Type Parameters:
      T - The type of the object upon which the value functions derives their measurements.
      Parameters:
      id - The id that uniquely identifies the function timer.
      obj - The state object from which the count and total functions derive measurements.
      countFunction - A monotonically increasing count function.
      totalTimeFunction - A monotonically increasing total time function.
      totalTimeFunctionUnit - The base unit of time of the totals returned by the total time function.
      Returns:
      A new function timer.
    • newFunctionCounter

      protected <T> FunctionCounter newFunctionCounter​(Meter.Id id, T obj, java.util.function.ToDoubleFunction<T> countFunction)
      Description copied from class: MeterRegistry
      Build a new function counter to be added to the registry. This is guaranteed to only be called if the function counter doesn't already exist.
      Specified by:
      newFunctionCounter in class MeterRegistry
      Type Parameters:
      T - The type of the object upon which the value function derives a measurement.
      Parameters:
      id - The id that uniquely identifies the function counter.
      obj - The state object from which the count function derives a measurement.
      countFunction - A monotonically increasing count function.
      Returns:
      A new function counter.
    • getBaseTimeUnit

      protected java.util.concurrent.TimeUnit getBaseTimeUnit()
      Specified by:
      getBaseTimeUnit in class MeterRegistry
      Returns:
      the registry's base TimeUnit. Must not be null.
    • defaultHistogramConfig

      protected DistributionStatisticConfig defaultHistogramConfig()
      Description copied from class: MeterRegistry
      Every custom registry implementation should define a default histogram expiry at a minimum:
       DistributionStatisticConfig.builder()
          .expiry(defaultStep)
          .build()
          .merge(DistributionStatisticConfig.DEFAULT);
       
      Specified by:
      defaultHistogramConfig in class MeterRegistry
      Returns:
      The default distribution statistics config.