public abstract class AbstractTimer extends AbstractMeter implements Timer
Timer.Builder, Timer.SampleMeter.Id, Meter.Type| Modifier and Type | Field and Description |
|---|---|
protected Clock |
clock |
protected Histogram |
histogram |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTimer(Meter.Id id,
Clock clock,
DistributionStatisticConfig distributionStatisticConfig,
PauseDetector pauseDetector,
TimeUnit baseTimeUnit)
Deprecated.
Timer implementations should now declare at construction time whether they support aggregable percentiles or not.
By declaring it up front, Micrometer can memory optimize the histogram structure used to store distribution statistics.
|
protected |
AbstractTimer(Meter.Id id,
Clock clock,
DistributionStatisticConfig distributionStatisticConfig,
PauseDetector pauseDetector,
TimeUnit baseTimeUnit,
boolean supportsAggregablePercentiles)
Creates a new timer.
|
| Modifier and Type | Method and Description |
|---|---|
TimeUnit |
baseTimeUnit() |
void |
close() |
boolean |
equals(Object o) |
int |
hashCode() |
void |
record(long amount,
TimeUnit unit)
Updates the statistics kept by the timer with the specified amount.
|
void |
record(Runnable f)
Executes the runnable
f and records the time taken. |
<T> T |
record(Supplier<T> f)
Executes the Supplier
f and records the time taken. |
<T> T |
recordCallable(Callable<T> f)
Executes the callable
f and records the time taken. |
protected abstract void |
recordNonNegative(long amount,
TimeUnit unit) |
HistogramSnapshot |
takeSnapshot()
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.
|
getIdclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitbuilder, builder, count, histogramCountAtValue, max, mean, measure, percentile, record, start, start, start, totalTime, wrap, wrap, wraptakeSnapshot@Deprecated protected AbstractTimer(Meter.Id id, Clock clock, DistributionStatisticConfig distributionStatisticConfig, PauseDetector pauseDetector, TimeUnit baseTimeUnit)
id - The timer's name and tags.clock - The clock used to measure latency.distributionStatisticConfig - Configuration determining which distribution statistics are sent.pauseDetector - Compensation for coordinated omission.baseTimeUnit - The time scale of this timer.protected AbstractTimer(Meter.Id id, Clock clock, DistributionStatisticConfig distributionStatisticConfig, PauseDetector pauseDetector, TimeUnit baseTimeUnit, boolean supportsAggregablePercentiles)
id - The timer's name and tags.clock - The clock used to measure latency.distributionStatisticConfig - Configuration determining which distribution statistics are sent.pauseDetector - Compensation for coordinated omission.baseTimeUnit - The time scale of this timer.supportsAggregablePercentiles - Indicates whether the registry supports percentile approximations from histograms.public <T> T recordCallable(Callable<T> f) throws Exception
Timerf and records the time taken.recordCallable in interface TimerT - The return type of the Callable.f - Function to execute and measure the execution time.f.Exception - Any exception bubbling up from the callable.public <T> T record(Supplier<T> f)
Timerf and records the time taken.public void record(Runnable f)
Timerf and records the time taken.public final void record(long amount,
TimeUnit unit)
Timerprotected abstract void recordNonNegative(long amount,
TimeUnit unit)
public HistogramSnapshot takeSnapshot()
HistogramSupporttakeSnapshot in interface HistogramSupportpublic TimeUnit baseTimeUnit()
baseTimeUnit in interface TimerCopyright © 2020 LeanCloud. All rights reserved.