Class DefaultLongTaskTimer
java.lang.Object
io.micrometer.core.instrument.AbstractMeter
io.micrometer.core.instrument.internal.DefaultLongTaskTimer
- All Implemented Interfaces:
HistogramSupport,LongTaskTimer,Meter
- Direct Known Subclasses:
CumulativeHistogramLongTaskTimer
public class DefaultLongTaskTimer extends AbstractMeter implements LongTaskTimer
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micrometer.core.instrument.LongTaskTimer
LongTaskTimer.Builder, LongTaskTimer.SampleNested 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)Deprecated.DefaultLongTaskTimer(Meter.Id id, Clock clock, java.util.concurrent.TimeUnit baseTimeUnit, DistributionStatisticConfig distributionStatisticConfig, boolean supportsAggregablePercentiles)Create aDefaultLongTaskTimerinstance. -
Method Summary
Modifier and Type Method Description intactiveTasks()java.util.concurrent.TimeUnitbaseTimeUnit()doubleduration(java.util.concurrent.TimeUnit unit)booleanequals(java.lang.Object o)protected voidforEachActive(java.util.function.Consumer<LongTaskTimer.Sample> sample)inthashCode()doublemax(java.util.concurrent.TimeUnit unit)The amount of time the longest running task has been runningLongTaskTimer.Samplestart()Start keeping time for a task.HistogramSnapshottakeSnapshot()Summary statistics should be published off of a single snapshot instance so that, for example, there isn't disagreement between the distribution's bucket counts because more events continue to stream in.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micrometer.core.instrument.distribution.HistogramSupport
takeSnapshotMethods inherited from interface io.micrometer.core.instrument.LongTaskTimer
duration, mean, measure, record, record, record, recordCallable, stop
-
Constructor Details
-
DefaultLongTaskTimer
Deprecated.Create aDefaultLongTaskTimerinstance.- Parameters:
id- IDclock- clock
-
DefaultLongTaskTimer
public DefaultLongTaskTimer(Meter.Id id, Clock clock, java.util.concurrent.TimeUnit baseTimeUnit, DistributionStatisticConfig distributionStatisticConfig, boolean supportsAggregablePercentiles)Create aDefaultLongTaskTimerinstance.- Parameters:
id- IDclock- clockbaseTimeUnit- base time unitdistributionStatisticConfig- distribution statistic configurationsupportsAggregablePercentiles- whether it supports aggregable percentiles- Since:
- 1.5.0
-
-
Method Details
-
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.
-
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.
-
max
public double max(java.util.concurrent.TimeUnit unit)Description copied from interface:LongTaskTimerThe amount of time the longest running task has been running- Specified by:
maxin interfaceLongTaskTimer- Parameters:
unit- The time unit to scale the max to.- Returns:
- The maximum active task duration.
-
activeTasks
public int activeTasks()- Specified by:
activeTasksin interfaceLongTaskTimer- Returns:
- The current number of tasks being executed.
-
forEachActive
-
baseTimeUnit
public java.util.concurrent.TimeUnit baseTimeUnit()- Specified by:
baseTimeUnitin interfaceLongTaskTimer- Returns:
- The base time unit of the long task timer to which all published metrics will be scaled
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
takeSnapshot
Description copied from interface:HistogramSupportSummary statistics should be published off of a single snapshot instance so that, for example, there isn't disagreement between the distribution's bucket counts because more events continue to stream in.- Specified by:
takeSnapshotin interfaceHistogramSupport- Returns:
- A snapshot of all distribution statistics at a point in time.
-