Interface Counter

All Superinterfaces:
Meter
All Known Implementing Classes:
CumulativeCounter, DropwizardCounter, NoopCounter, StepCounter

public interface Counter
extends Meter
Counters monitor monotonically increasing values. Counters may never be reset to a lesser value. If you need to track a value that goes up and down, use a Gauge.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Interface Description
    static class  Counter.Builder
    Fluent builder for counters.

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

    Meter.Id, Meter.Type
  • Method Summary

    Modifier and Type Method Description
    static Counter.Builder builder​(java.lang.String name)  
    double count()  
    default void increment()
    Update the counter by one.
    void increment​(double amount)
    Update the counter by amount.
    default java.lang.Iterable<Measurement> measure()
    Get a set of measurements.

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

    close, getId, match, use
  • Method Details

    • builder

      static Counter.Builder builder​(java.lang.String name)
    • increment

      default void increment()
      Update the counter by one.
    • increment

      void increment​(double amount)
      Update the counter by amount.
      Parameters:
      amount - Amount to add to the counter.
    • count

      double count()
      Returns:
      The cumulative count since this counter was created.
    • 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.