The number of durations recorded.
The fifteen-minute rate of timings.
The five-minute rate of timings.
The longest recorded duration in nanoseconds.
The arithmetic mean of all recorded durations in nanoseconds.
The mean rate of timings.
The shortest recorded duration in nanoseconds.
The one-minute rate of timings.
A snapshot of the values in the timer's sample.
The standard deviation of all recorded durations.
Runs f, recording its duration, and returns its result.
Measures 'now' up to the moment that the given future
completes, then updates this timer with the measurement.
Measures 'now' up to the moment that the given future
completes, then updates this timer with the measurement.
*Know what you measure*
This method may measure more than is obvious. It measures:
* the evaluation of the (by name) parameter future
* in case the future is not yet completed: the delay until the constructed Future is scheduled in the
given ExecutionContext
* in case the future is not yet completed: the actual execution of the Future
* the time it takes to schedule stopping the timer
To only measure the Future execution time, please use use a timer in the code that is executed inside the Future.
Example usage:
class Example extends Instrumented { private[this] loadTimer = metrics.timer("loading") private def asyncFetchRows(): Future[Seq[Row]] = ... def loadStuffEventually(): Future[Seq[Row]] = loadTimer.timeFuture { asyncFetchRows() } }
future result type
the expression that results in a future
execution context
the result of executing future
Converts partial function pf
into a side-effecting partial function that times
every invocation of pf
for which it is defined.
Converts partial function pf
into a side-effecting partial function that times
every invocation of pf
for which it is defined. The result is passed unchanged.
Example usage:
class Example extends Instrumented { val isEven: PartialFunction[Int, String] = { case x if x % 2 == 0 => x+" is even" } val isEvenTimer = metrics.timer("isEven") val timedIsEven: PartialFunction[Int, String] = isEvenTimer.timePF(isEven) val sample = 1 to 10 sample collect timedIsEven // timer does 5 measurements }
A timing com.codahale.metrics.Timer.Context, which measures an elapsed time in nanoseconds.
Adds a recorded duration.
Adds a recorded duration.
A Scala facade class for DropwizardTimer.
Features: * measure the execution duration of a block of code with time() * measure the time until a future is completed with timeFuture() * add an execution duration measurement as a side effect to a partial function with timePF() * direct access to the underlying timer with update(), timerContext(), count, max, etc.
Example usage: