Interface ICounters

All Known Implementing Classes:
CachedCounters, CompositeCounters, LogCounters, NullCounters

public interface ICounters
Interface for performance counters that measure execution metrics.

The performance counters measure how code is performing: how fast or slow, how many transactions performed, how many objects are stored, what was the latest transaction time and so on.

They are critical to monitor and improve performance, scalability and reliability of code in production.

  • Method Summary

    Modifier and Type Method Description
    Timing beginTiming​(String name)
    Begins measurement of execution time interval.
    void increment​(String name, int value)
    Increments counter by given value.
    void incrementOne​(String name)
    Increments counter by 1.
    void last​(String name, float value)
    Records the last calculated measurement value.
    void stats​(String name, float value)
    Calculates min/average/max statistics based on the current and previous values.
    void timestamp​(String name, ZonedDateTime value)
    Records the given timestamp.
    void timestampNow​(String name)
    Records the current time as a timestamp.
  • Method Details

    • beginTiming

      Timing beginTiming​(String name)
      Begins measurement of execution time interval. It returns Timing object which has to be called at Timing.endTiming() to end the measurement and update the counter.
      Parameters:
      name - a counter name of Interval type.
      Returns:
      a Timing callback object to end timing.
    • stats

      void stats​(String name, float value)
      Calculates min/average/max statistics based on the current and previous values.
      Parameters:
      name - a counter name of Statistics type
      value - a value to update statistics
    • last

      void last​(String name, float value)
      Records the last calculated measurement value. Usually this method is used by metrics calculated externally.
      Parameters:
      name - a counter name of Last type.
      value - a last value to record.
    • timestampNow

      void timestampNow​(String name)
      Records the current time as a timestamp.
      Parameters:
      name - a counter name of Timestamp type.
    • timestamp

      void timestamp​(String name, ZonedDateTime value)
      Records the given timestamp.
      Parameters:
      name - a counter name of Timestamp type.
      value - a timestamp to record.
    • incrementOne

      void incrementOne​(String name)
      Increments counter by 1.
      Parameters:
      name - a counter name of Increment type.
    • increment

      void increment​(String name, int value)
      Increments counter by given value.
      Parameters:
      name - a counter name of Increment type.
      value - a value to add to the counter.