Package io.micrometer.prometheus
Class PrometheusTimer
java.lang.Object
io.micrometer.core.instrument.AbstractMeter
io.micrometer.core.instrument.AbstractTimer
io.micrometer.prometheus.PrometheusTimer
- All Implemented Interfaces:
io.micrometer.core.instrument.distribution.HistogramSupport
,io.micrometer.core.instrument.Meter
,io.micrometer.core.instrument.Timer
public class PrometheusTimer
extends io.micrometer.core.instrument.AbstractTimer
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and Type Method Description long
count()
io.micrometer.core.instrument.distribution.CountAtBucket[]
histogramCounts()
For Prometheus we cannot use the histogram counts from HistogramSnapshot, as it is based on a rolling histogram.HistogramFlavor
histogramFlavor()
double
max(java.util.concurrent.TimeUnit unit)
protected void
recordNonNegative(long amount, java.util.concurrent.TimeUnit unit)
io.micrometer.core.instrument.distribution.HistogramSnapshot
takeSnapshot()
double
totalTime(java.util.concurrent.TimeUnit unit)
Methods inherited from class io.micrometer.core.instrument.AbstractTimer
baseTimeUnit, close, equals, hashCode, record, record, record, recordCallable
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
recordNonNegative
protected void recordNonNegative(long amount, java.util.concurrent.TimeUnit unit)- Specified by:
recordNonNegative
in classio.micrometer.core.instrument.AbstractTimer
-
count
public long count() -
totalTime
public double totalTime(java.util.concurrent.TimeUnit unit) -
max
public double max(java.util.concurrent.TimeUnit unit) -
histogramFlavor
-
histogramCounts
public io.micrometer.core.instrument.distribution.CountAtBucket[] histogramCounts()For Prometheus we cannot use the histogram counts from HistogramSnapshot, as it is based on a rolling histogram. Prometheus requires a histogram that accumulates values over the lifetime of the app.- Returns:
- Cumulative histogram buckets.
-
takeSnapshot
public io.micrometer.core.instrument.distribution.HistogramSnapshot takeSnapshot()- Specified by:
takeSnapshot
in interfaceio.micrometer.core.instrument.distribution.HistogramSupport
- Overrides:
takeSnapshot
in classio.micrometer.core.instrument.AbstractTimer
-