Interface Timer
- All Superinterfaces:
Meter
- All Known Implementing Classes:
DropwizardTypes.DescribableTimer
Timer intended to track of a large number of short running events. Example would be something like
an HTTP request. Though "short running" is a bit subjective the assumption is that it should be
under a minute.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Fluent builder for timers.static class
Nested classes/interfaces inherited from interface org.forgerock.monitoring.api.instrument.Meter
Meter.Id, Meter.Type
-
Method Summary
Modifier and TypeMethodDescriptionstatic Timer.Builder
static Timer.Builder
Create a timer builder from aTimed
annotation.long
count()
The number of times that stop has been called on this timer.double
histogramCountAtValue
(long valueNanos) double
The maximum time of a single event.default double
default Iterable<Measurement>
measure()
Get a set of measurements.double
percentile
(double percentile, TimeUnit unit) The latency at a specific percentile.void
Updates the statistics kept by the counter with the specified amount.void
Executes the runnable `f` and records the time taken.default void
Updates the statistics kept by the counter with the specified amount.<T> T
Executes the Supplier `f` and records the time taken.<T> T
recordCallable
(Callable<T> f) Executes the callable `f` and records the time taken.static Timer.Sample
static Timer.Sample
start
(MeterRegistry registry) takeSnapshot
(boolean supportsAggregablePercentiles) double
The total time of recorded events.default Runnable
Wrap aRunnable
so that it is timed when invoked.default <T> Callable<T>
Wrap aCallable
so that it is timed when invoked.
-
Method Details
-
start
-
start
-
builder
-
builder
Create a timer builder from aTimed
annotation.- Parameters:
timed
- The annotation instance to base a new timer on.defaultName
- A default name to use in the event that the value attribute is empty.
-
record
Updates the statistics kept by the counter with the specified amount.- Parameters:
amount
- Duration of a single event being measured by this timer. If the amount is less than 0 the value will be dropped.unit
- Time unit for the amount being recorded.
-
record
Updates the statistics kept by the counter with the specified amount.- Parameters:
duration
- Duration of a single event being measured by this timer.
-
record
Executes the Supplier `f` and records the time taken.- Parameters:
f
- Function to execute and measure the execution time.- Returns:
- The return value of `f`.
-
recordCallable
Executes the callable `f` and records the time taken.- Parameters:
f
- Function to execute and measure the execution time.- Returns:
- The return value of `f`.
- Throws:
Exception
-
record
Executes the runnable `f` and records the time taken.- Parameters:
f
- Function to execute and measure the execution time.
-
wrap
Wrap aRunnable
so that it is timed when invoked.- Parameters:
f
- The Runnable to time when it is invoked.- Returns:
- The wrapped Runnable.
-
wrap
Wrap aCallable
so that it is timed when invoked.- Parameters:
f
- The Callable to time when it is invoked.- Returns:
- The wrapped Callable.
-
count
long count()The number of times that stop has been called on this timer. -
totalTime
The total time of recorded events. -
mean
-
max
The maximum time of a single event. -
percentile
The latency at a specific percentile. This value is non-aggregable across dimensions. -
histogramCountAtValue
double histogramCountAtValue(long valueNanos) -
takeSnapshot
-
measure
Description copied from interface:Meter
Get a set of measurements. Should always return the same number of measurements and in the same order, regardless of the level of activity or the lack thereof. -
baseTimeUnit
TimeUnit baseTimeUnit()
-