public interface CounterMetric extends Metric
Can be used to count discrete events like 'user login'. ValueMetric
would typically
be used when the event has a value (bytes sent, bytes received, lines read etc).
// Declare the counter (typically as a static field)
static final CounterMetric userLoginCounter = MetricManager.getCounterMetric(MyService.class, "userLogin");
...
public void performUserLogin() {
// increment the counter
userLoginCounter.markEvent();
...
}
Modifier and Type | Method and Description |
---|---|
CounterStatistics |
getCollectedStatistics()
Return the collected statistics.
|
CounterStatistics |
getStatistics(boolean reset)
Return the current statistics.
|
void |
markEvent()
Mark that 1 event has occurred.
|
void |
markEvents(long numberOfEventsOccurred)
Mark that numberOfEventsOccurred events have occurred.
|
clearStatistics, collectStatistics, getName, visit
CounterStatistics getStatistics(boolean reset)
CounterStatistics getCollectedStatistics()
void markEvent()
void markEvents(long numberOfEventsOccurred)
Copyright © 2014. All Rights Reserved.