Class DefaultLongTaskTimer
- java.lang.Object
-
- io.micrometer.core.instrument.AbstractMeter
-
- io.micrometer.core.instrument.internal.DefaultLongTaskTimer
-
- All Implemented Interfaces:
LongTaskTimer,Meter
public class DefaultLongTaskTimer extends AbstractMeter implements LongTaskTimer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.micrometer.core.instrument.LongTaskTimer
LongTaskTimer.Builder, LongTaskTimer.Sample
-
Nested classes/interfaces inherited from interface io.micrometer.core.instrument.Meter
Meter.Builder, Meter.Id, Meter.Type
-
-
Constructor Summary
Constructors Constructor Description DefaultLongTaskTimer(Meter.Id id, Clock clock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intactiveTasks()doubleduration(long task, java.util.concurrent.TimeUnit unit)The current duration for an active task.doubleduration(java.util.concurrent.TimeUnit unit)booleanequals(java.lang.Object o)inthashCode()LongTaskTimer.Samplestart()Start keeping time for a task.longstop(long task)Mark a given task as completed.-
Methods inherited from class io.micrometer.core.instrument.AbstractMeter
getId
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micrometer.core.instrument.LongTaskTimer
measure, record, record, record, recordCallable
-
-
-
-
Method Detail
-
start
public LongTaskTimer.Sample start()
Description copied from interface:LongTaskTimerStart keeping time for a task.- Specified by:
startin interfaceLongTaskTimer- Returns:
- A task id that can be used to look up how long the task has been running.
-
stop
public long stop(long task)
Description copied from interface:LongTaskTimerMark a given task as completed.- Specified by:
stopin interfaceLongTaskTimer- Parameters:
task- Id for the task to stop. This should be the value returned fromLongTaskTimer.start().- Returns:
- Duration for the task in nanoseconds. A -1 value will be returned for an unknown task.
-
duration
public double duration(long task, java.util.concurrent.TimeUnit unit)Description copied from interface:LongTaskTimerThe current duration for an active task.- Specified by:
durationin interfaceLongTaskTimer- Parameters:
task- Id for the task to stop. This should be the value returned fromLongTaskTimer.start().unit- The time unit to scale the duration to.- Returns:
- Duration for the task. A -1 value will be returned for an unknown task.
-
duration
public double duration(java.util.concurrent.TimeUnit unit)
- Specified by:
durationin interfaceLongTaskTimer- Parameters:
unit- The time unit to scale the duration to.- Returns:
- The cumulative duration of all current tasks.
-
activeTasks
public int activeTasks()
- Specified by:
activeTasksin interfaceLongTaskTimer- Returns:
- The current number of tasks being executed.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-