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 TimingbeginTiming(String name)Begins measurement of execution time interval.voidincrement(String name, int value)Increments counter by given value.voidincrementOne(String name)Increments counter by 1.voidlast(String name, float value)Records the last calculated measurement value.voidstats(String name, float value)Calculates min/average/max statistics based on the current and previous values.voidtimestamp(String name, ZonedDateTime value)Records the given timestamp.voidtimestampNow(String name)Records the current time as a timestamp.
-
Method Details
-
beginTiming
Begins measurement of execution time interval. It returns Timing object which has to be called atTiming.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
Calculates min/average/max statistics based on the current and previous values.- Parameters:
name- a counter name of Statistics typevalue- a value to update statistics
-
last
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
Records the current time as a timestamp.- Parameters:
name- a counter name of Timestamp type.
-
timestamp
Records the given timestamp.- Parameters:
name- a counter name of Timestamp type.value- a timestamp to record.
-
incrementOne
Increments counter by 1.- Parameters:
name- a counter name of Increment type.
-
increment
Increments counter by given value.- Parameters:
name- a counter name of Increment type.value- a value to add to the counter.
-