Interface Timer
- All Superinterfaces:
HistogramSupport, Meter, Wrapper, Wrapper
Accumulates timing information about large numbers of short-running events (e.g., HTTP requests), each with a
Duration value, and reports statistics over all samples (count, total time, mean, max) as well as grouping
samples using percentiles or bucket boundaries.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder for a newTimer.static interfaceMeasures an interval of time from instantiation to an explicit invocation ofTimer.Sample.stop(io.helidon.metrics.api.Timer).Nested classes/interfaces inherited from interface Meter
Meter.BaseUnits, Meter.Id, Meter.Scope, Meter.TypeModifier and TypeInterfaceDescriptionstatic classCommon unit declarations (inspired by the list from MicroProfile metrics).static interfaceUnique idenfier for a meter.static classDeprecated, for removal: This API element is subject to removal in a future version.Core metrics ignores scope values, and this type will be removed.static enumType of meter. -
Method Summary
Modifier and TypeMethodDescriptionstatic Timer.BuilderDeprecated, for removal: This API element is subject to removal in a future version.this method getsMetricsFactoryfromServiceRegistry, which may be inefficient.longcount()Returns the current count of completed events measured by the timer.doubleReturns the maximum value, expressed in the specified units, consumed by a completed event measured by the timer.doubleReturns the average time, expressed in the specified units, consumed by completed events measured by the timer.voidUpdates the statistics kept by the timer with the specified amount.voidExecutes theRunnablefand records the time it takes.voidUpdates the statistics kept by the timer with the specified amount.<T> TExecutes theCallablefand records the time spent it, returning the callable's result.<T> TExecutes theSupplierfand records the time spent invoking the function.static Timer.Samplestart()Deprecated, for removal: This API element is subject to removal in a future version.this method getsMetricsFactoryfromServiceRegistry, which may be inefficient.static Timer.SampleDeprecated, for removal: This API element is subject to removal in a future version.this method getsMetricsFactoryfromServiceRegistry, which may be inefficient.static Timer.Samplestart(MeterRegistry registry) Deprecated, for removal: This API element is subject to removal in a future version.callMetricsFactory.timerStart(MeterRegistry)on the registry's owning factory insteaddoubleReturns the total time, expressed in the specified units, consumed by completed events measured by the timer.Wraps aRunnableso that it will be timed every time it is invoked via the return value from this method.<T> Callable<T> Wraps aCallableso that it is will be timed every time it is invoked via the return value from this method.<T> Supplier<T> Wraps aSupplierso that it will be timed every time it is invoked via the return value from this method.Methods inherited from interface HistogramSupport
snapshotMethods inherited from interface Meter
baseUnit, description, id, scope, typeModifier and TypeMethodDescriptionbaseUnit()Returns the meter's base unit.Returns the meter's description.id()Returns the meter ID.scope()Deprecated, for removal: This API element is subject to removal in a future version.Core metrics does not assign scopes, and this method will be removed.type()Returns the meter type.
-
Method Details
-
builder
Deprecated, for removal: This API element is subject to removal in a future version.this method getsMetricsFactoryfromServiceRegistry, which may be inefficient. CallMetricsFactory.timerBuilder(String)insteadCreates a builder for a newTimer.- Parameters:
name- timer name- Returns:
- new builder
-
start
Deprecated, for removal: This API element is subject to removal in a future version.this method getsMetricsFactoryfromServiceRegistry, which may be inefficient. callMetricsFactory.timerStart()insteadStarts a timing sample using the default system clock.- Returns:
- new sample
-
start
Deprecated, for removal: This API element is subject to removal in a future version.callMetricsFactory.timerStart(MeterRegistry)on the registry's owning factory insteadStarts a timing sample using the clock associated with the specifiedMeterRegistry.- Parameters:
registry- the meter registry whose clock is to be used for measuring the interval- Returns:
- new sample with start time recorded
-
start
Deprecated, for removal: This API element is subject to removal in a future version.this method getsMetricsFactoryfromServiceRegistry, which may be inefficient. callMetricsFactory.timerStart(Clock)insteadStarts a timing sample using the specified clock.- Parameters:
clock- a clock to be used- Returns:
- new sample with start time recorded
-
record
Updates the statistics kept by the timer 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 droppedunit- time unit for the amount being recorded
-
record
Updates the statistics kept by the timer with the specified amount.- Parameters:
duration- duration of a single event being measured by this timer
-
record
-
record
Executes theCallablefand records the time spent it, returning the callable's result. -
record
-
wrap
-
wrap
-
wrap
-
count
long count()Returns the current count of completed events measured by the timer.- Returns:
- number of events recorded by the timer
-
totalTime
Returns the total time, expressed in the specified units, consumed by completed events measured by the timer.- Parameters:
unit- time unit in which to express the total accumulated time- Returns:
- total time of recorded events
-
mean
Returns the average time, expressed in the specified units, consumed by completed events measured by the timer.- Parameters:
unit- time unit in which to express the mean- Returns:
- average for all events recorded by this timer
-
max
Returns the maximum value, expressed in the specified units, consumed by a completed event measured by the timer.- Parameters:
unit- time unit in which to express the maximum- Returns:
- maximum time recorded by a single event measured by this timer
-