public interface TimedMetricGroup
This is intended to be used when the full metric name is determined at runtime.
Modifier and Type | Method and Description |
---|---|
void |
addEventDuration(String name,
boolean success,
long durationNanos)
Add an event duration in nanoseconds noting if it was a success or failure result.
|
void |
addEventSince(String name,
boolean success,
long startNanos)
Add an event based on a startNanos (determined by
System.nanoTime() ). |
TimedMetric |
getTimedMetric(String name)
Return the TimedMetric for the specific name.
|
TimedEvent |
start(String name)
Start the event for the given name.
|
TimedEvent start(String name)
The group and type parts of the metric name are common and the metrics only differ by this name.
Typically the underlying implementation uses a cache to lookup the TimedMetric and create it if necessary.
name
- the specific name for the metric (group and type name parts are common).TimedMetric getTimedMetric(String name)
void addEventSince(String name, boolean success, long startNanos)
System.nanoTime()
).
Success and failure statistics are kept separately.
This is an alternative to using #startEvent()
. Note that using startEvent() has
slightly higher overhead as it instantiates a TimedEvent object which must be later GC'ed. In
this sense generally addEventSince() is the preferred method to use.
void addEventDuration(String name, boolean success, long durationNanos)
Success and failure statistics are kept separately.
This is an alternative to using #addEventSince(boolean, long)
where you pass in the
duration rather than the start nanoseconds.
Copyright © 2014. All Rights Reserved.