Package org.eclipse.microprofile.metrics
Interface Timer
A timer metric which aggregates timing durations and provides duration statistics, plus
throughput statistics via
Meter.
See SimpleTimer for a lightweight alternative that only tracks elapsed time
duration and count.
The timer measures duration in nanoseconds.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionlonggetCount()Returns the number of events which have been marked.Returns the total elapsed timing durations of all completed timing events that are recorded withupdate(Duration).doubleReturns the fifteen-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.doubleReturns the five-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.doubleReturns the mean rate at which events have occurred since the meter was created.doubleReturns the one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.Returns a snapshot of the values.time()Returns a newTimer.Context.voidTimes and records the duration of event.<T> TTimes and records the duration of event.voidAdds a recorded duration.
-
Method Details
-
update
Adds a recorded duration.- Parameters:
duration- the length of theduration
-
time
Times and records the duration of event.- Type Parameters:
T- the type of the value returned byevent- Parameters:
event- aCallablewhoseCallable.call()method implements a process whose duration should be timed- Returns:
- the value returned by
event - Throws:
Exception- ifeventthrows anException
-
time
Times and records the duration of event.- Parameters:
event- aRunnablewhoseRunnable.run()method implements a process whose duration should be timed
-
time
Timer.Context time()Returns a newTimer.Context.- Returns:
- a new
Timer.Context - See Also:
-
getElapsedTime
Duration getElapsedTime()Returns the total elapsed timing durations of all completed timing events that are recorded withupdate(Duration).- Returns:
- the elapsed time
duration
-
getCount
long getCount()Description copied from interface:MeteredReturns the number of events which have been marked. -
getFifteenMinuteRate
double getFifteenMinuteRate()Description copied from interface:MeteredReturns the fifteen-minute exponentially-weighted moving average rate at which events have occurred since the meter was created. This rate has the same exponential decay factor as the fifteen-minute load average in thetopUnix command.- Specified by:
getFifteenMinuteRatein interfaceMetered- Returns:
- the fifteen-minute exponentially-weighted moving average rate at which events have occurred since the meter was created
-
getFiveMinuteRate
double getFiveMinuteRate()Description copied from interface:MeteredReturns the five-minute exponentially-weighted moving average rate at which events have occurred since the meter was created. This rate has the same exponential decay factor as the five-minute load average in thetopUnix command.- Specified by:
getFiveMinuteRatein interfaceMetered- Returns:
- the five-minute exponentially-weighted moving average rate at which events have occurred since the meter was created
-
getMeanRate
double getMeanRate()Description copied from interface:MeteredReturns the mean rate at which events have occurred since the meter was created.- Specified by:
getMeanRatein interfaceMetered- Returns:
- the mean rate at which events have occurred since the meter was created
-
getOneMinuteRate
double getOneMinuteRate()Description copied from interface:MeteredReturns the one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created. This rate has the same exponential decay factor as the one-minute load average in thetopUnix command.- Specified by:
getOneMinuteRatein interfaceMetered- Returns:
- the one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created
-
getSnapshot
Snapshot getSnapshot()Description copied from interface:SamplingReturns a snapshot of the values.- Specified by:
getSnapshotin interfaceSampling- Returns:
- a snapshot of the values
-