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");
...
void performUserLogin() {
// increment the counter
userLoginCounter.markEvent();
...
}
| Modifier and Type | Method and Description |
|---|---|
long |
getCount()
Return the current count.
|
void |
markEvent()
Mark that 1 event has occurred.
|
void |
markEvents(long numberOfEventsOccurred)
Mark that numberOfEventsOccurred events have occurred.
|
void markEvent()
void markEvents(long numberOfEventsOccurred)
long getCount()
Copyright © 2019. All rights reserved.