Interface Meter

All Known Subinterfaces:
Counter, DistributionSummary, FunctionCounter, FunctionTimer, Gauge, HistogramSupport, LongTaskTimer, TimeGauge, Timer
All Known Implementing Classes:
AbstractDistributionSummary, AbstractMeter, AbstractTimer, CompositeFunctionCounter, CumulativeCounter, CumulativeDistributionSummary, CumulativeFunctionCounter, CumulativeFunctionTimer, CumulativeHistogramLongTaskTimer, CumulativeTimer, DefaultGauge, DefaultLongTaskTimer, DefaultMeter, DropwizardCounter, DropwizardDistributionSummary, DropwizardFunctionCounter, DropwizardFunctionTimer, DropwizardGauge, DropwizardTimer, NoopCounter, NoopDistributionSummary, NoopFunctionCounter, NoopFunctionTimer, NoopGauge, NoopLongTaskTimer, NoopMeter, NoopTimeGauge, NoopTimer, StepCounter, StepDistributionSummary, StepFunctionCounter, StepFunctionTimer, StepTimer

public interface Meter
A named and dimensioned producer of one or more measurements.
  • Method Details

    • builder

      static Meter.Builder builder(String name, Meter.Type type, Iterable<Measurement> measurements)
    • getId

      Meter.Id getId()
      Returns:
      A unique combination of name and tags
    • measure

      Iterable<Measurement> measure()
      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.
      Returns:
      The set of measurements that represents the instantaneous value of this meter.
    • match

      default <T> T match(Function<Gauge,​T> visitGauge, Function<Counter,​T> visitCounter, Function<Timer,​T> visitTimer, Function<DistributionSummary,​T> visitSummary, Function<LongTaskTimer,​T> visitLongTaskTimer, Function<TimeGauge,​T> visitTimeGauge, Function<FunctionCounter,​T> visitFunctionCounter, Function<FunctionTimer,​T> visitFunctionTimer, Function<Meter,​T> visitMeter)
      Match a Meter by type with series of dedicated functions for specific Meters and return a result from the matched function.

      NOTE: This method contract will change in minor releases if ever a new Meter type is created. In this case only, this is considered a feature. By using this method, you are declaring that you want to be sure to handle all types of meters. A breaking API change during the introduction of a new Meter indicates that there is a new meter type for you to consider and the compiler will effectively require you to consider it.

      Type Parameters:
      T - return type of function to apply
      Parameters:
      visitGauge - function to apply for Gauge
      visitCounter - function to apply for Counter
      visitTimer - function to apply for Timer
      visitSummary - function to apply for DistributionSummary
      visitLongTaskTimer - function to apply for LongTaskTimer
      visitTimeGauge - function to apply for TimeGauge
      visitFunctionCounter - function to apply for FunctionCounter
      visitFunctionTimer - function to apply for FunctionTimer
      visitMeter - function to apply as a fallback
      Returns:
      return value from the applied function
      Since:
      1.1.0
    • use

      default void use(Consumer<Gauge> visitGauge, Consumer<Counter> visitCounter, Consumer<Timer> visitTimer, Consumer<DistributionSummary> visitSummary, Consumer<LongTaskTimer> visitLongTaskTimer, Consumer<TimeGauge> visitTimeGauge, Consumer<FunctionCounter> visitFunctionCounter, Consumer<FunctionTimer> visitFunctionTimer, Consumer<Meter> visitMeter)
      Match a Meter with a series of dedicated functions for specific Meters and call the matching consumer.

      NOTE: This method contract will change in minor releases if ever a new Meter type is created. In this case only, this is considered a feature. By using this method, you are declaring that you want to be sure to handle all types of meters. A breaking API change during the introduction of a new Meter indicates that there is a new meter type for you to consider and the compiler will effectively require you to consider it.

      Parameters:
      visitGauge - function to apply for Gauge
      visitCounter - function to apply for Counter
      visitTimer - function to apply for Timer
      visitSummary - function to apply for DistributionSummary
      visitLongTaskTimer - function to apply for LongTaskTimer
      visitTimeGauge - function to apply for TimeGauge
      visitFunctionCounter - function to apply for FunctionCounter
      visitFunctionTimer - function to apply for FunctionTimer
      visitMeter - function to apply as a fallback
      Since:
      1.1.0
    • close

      default void close()