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
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent builder for timers.static classNested classes/interfaces inherited from interface org.forgerock.monitoring.api.instrument.Meter
Meter.Id, Meter.Type -
Method Summary
Modifier and TypeMethodDescriptionstatic Timer.Builderstatic Timer.BuilderCreate a timer builder from aTimedannotation.longcount()The number of times that stop has been called on this timer.doublehistogramCountAtValue(long valueNanos) doubleThe maximum time of a single event.default doubledefault Iterable<Measurement>measure()Get a set of measurements.doublepercentile(double percentile, TimeUnit unit) The latency at a specific percentile.voidUpdates the statistics kept by the counter with the specified amount.voidExecutes the runnable `f` and records the time taken.default voidUpdates the statistics kept by the counter with the specified amount.<T> TExecutes the Supplier `f` and records the time taken.<T> TrecordCallable(Callable<T> f) Executes the callable `f` and records the time taken.static Timer.Samplestatic Timer.Samplestart(MeterRegistry registry) takeSnapshot(boolean supportsAggregablePercentiles) doubleThe total time of recorded events.default RunnableWrap aRunnableso that it is timed when invoked.default <T> Callable<T>Wrap aCallableso that it is timed when invoked.
-
Method Details
-
start
-
start
-
builder
-
builder
Create a timer builder from aTimedannotation.- 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 aRunnableso that it is timed when invoked.- Parameters:
f- The Runnable to time when it is invoked.- Returns:
- The wrapped Runnable.
-
wrap
Wrap aCallableso 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:MeterGet 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()
-