Package io.micrometer.prometheus
Class PrometheusMeterRegistry
- java.lang.Object
-
- io.micrometer.core.instrument.MeterRegistry
-
- io.micrometer.prometheus.PrometheusMeterRegistry
-
public class PrometheusMeterRegistry extends io.micrometer.core.instrument.MeterRegistry
-
-
Constructor Summary
Constructors Constructor Description PrometheusMeterRegistry(PrometheusConfig config)
PrometheusMeterRegistry(PrometheusConfig config, io.prometheus.client.CollectorRegistry registry, io.micrometer.core.instrument.Clock clock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected io.micrometer.core.instrument.distribution.DistributionStatisticConfig
defaultHistogramConfig()
protected java.util.concurrent.TimeUnit
getBaseTimeUnit()
io.prometheus.client.CollectorRegistry
getPrometheusRegistry()
io.micrometer.core.instrument.Counter
newCounter(io.micrometer.core.instrument.Meter.Id id)
io.micrometer.core.instrument.DistributionSummary
newDistributionSummary(io.micrometer.core.instrument.Meter.Id id, io.micrometer.core.instrument.distribution.DistributionStatisticConfig distributionStatisticConfig, double scale)
protected <T> io.micrometer.core.instrument.FunctionCounter
newFunctionCounter(io.micrometer.core.instrument.Meter.Id id, T obj, java.util.function.ToDoubleFunction<T> countFunction)
protected <T> io.micrometer.core.instrument.FunctionTimer
newFunctionTimer(io.micrometer.core.instrument.Meter.Id id, T obj, java.util.function.ToLongFunction<T> countFunction, java.util.function.ToDoubleFunction<T> totalTimeFunction, java.util.concurrent.TimeUnit totalTimeFunctionUnit)
protected <T> io.micrometer.core.instrument.Gauge
newGauge(io.micrometer.core.instrument.Meter.Id id, T obj, java.util.function.ToDoubleFunction<T> valueFunction)
protected io.micrometer.core.instrument.LongTaskTimer
newLongTaskTimer(io.micrometer.core.instrument.Meter.Id id)
protected io.micrometer.core.instrument.Meter
newMeter(io.micrometer.core.instrument.Meter.Id id, io.micrometer.core.instrument.Meter.Type type, java.lang.Iterable<io.micrometer.core.instrument.Measurement> measurements)
protected io.micrometer.core.instrument.Timer
newTimer(io.micrometer.core.instrument.Meter.Id id, io.micrometer.core.instrument.distribution.DistributionStatisticConfig distributionStatisticConfig, io.micrometer.core.instrument.distribution.pause.PauseDetector pauseDetector)
java.lang.String
scrape()
void
scrape(java.io.Writer writer)
Scrape to the specified writer.-
Methods inherited from class io.micrometer.core.instrument.MeterRegistry
clear, close, config, counter, counter, find, forEachMeter, gauge, gauge, gauge, gauge, gaugeCollectionSize, gaugeMapSize, get, getConventionName, getConventionTags, getMeters, isClosed, more, newTimeGauge, remove, remove, removeByPreFilterId, summary, summary, timer, timer
-
-
-
-
Constructor Detail
-
PrometheusMeterRegistry
public PrometheusMeterRegistry(PrometheusConfig config)
-
PrometheusMeterRegistry
public PrometheusMeterRegistry(PrometheusConfig config, io.prometheus.client.CollectorRegistry registry, io.micrometer.core.instrument.Clock clock)
-
-
Method Detail
-
scrape
public java.lang.String scrape()
- Returns:
- Content that should be included in the response body for an endpoint designated for Prometheus to scrape from.
-
scrape
public void scrape(java.io.Writer writer) throws java.io.IOException
Scrape to the specified writer.- Parameters:
writer
- Target that serves the content to be scraped by Prometheus.- Throws:
java.io.IOException
- if writing fails- Since:
- 1.2.0
-
newCounter
public io.micrometer.core.instrument.Counter newCounter(io.micrometer.core.instrument.Meter.Id id)
- Specified by:
newCounter
in classio.micrometer.core.instrument.MeterRegistry
-
newDistributionSummary
public io.micrometer.core.instrument.DistributionSummary newDistributionSummary(io.micrometer.core.instrument.Meter.Id id, io.micrometer.core.instrument.distribution.DistributionStatisticConfig distributionStatisticConfig, double scale)
- Specified by:
newDistributionSummary
in classio.micrometer.core.instrument.MeterRegistry
-
newTimer
protected io.micrometer.core.instrument.Timer newTimer(io.micrometer.core.instrument.Meter.Id id, io.micrometer.core.instrument.distribution.DistributionStatisticConfig distributionStatisticConfig, io.micrometer.core.instrument.distribution.pause.PauseDetector pauseDetector)
- Specified by:
newTimer
in classio.micrometer.core.instrument.MeterRegistry
-
newGauge
protected <T> io.micrometer.core.instrument.Gauge newGauge(io.micrometer.core.instrument.Meter.Id id, @Nullable T obj, java.util.function.ToDoubleFunction<T> valueFunction)
- Specified by:
newGauge
in classio.micrometer.core.instrument.MeterRegistry
-
newLongTaskTimer
protected io.micrometer.core.instrument.LongTaskTimer newLongTaskTimer(io.micrometer.core.instrument.Meter.Id id)
- Specified by:
newLongTaskTimer
in classio.micrometer.core.instrument.MeterRegistry
-
newFunctionTimer
protected <T> io.micrometer.core.instrument.FunctionTimer newFunctionTimer(io.micrometer.core.instrument.Meter.Id id, T obj, java.util.function.ToLongFunction<T> countFunction, java.util.function.ToDoubleFunction<T> totalTimeFunction, java.util.concurrent.TimeUnit totalTimeFunctionUnit)
- Specified by:
newFunctionTimer
in classio.micrometer.core.instrument.MeterRegistry
-
newFunctionCounter
protected <T> io.micrometer.core.instrument.FunctionCounter newFunctionCounter(io.micrometer.core.instrument.Meter.Id id, T obj, java.util.function.ToDoubleFunction<T> countFunction)
- Specified by:
newFunctionCounter
in classio.micrometer.core.instrument.MeterRegistry
-
newMeter
protected io.micrometer.core.instrument.Meter newMeter(io.micrometer.core.instrument.Meter.Id id, io.micrometer.core.instrument.Meter.Type type, java.lang.Iterable<io.micrometer.core.instrument.Measurement> measurements)
- Specified by:
newMeter
in classio.micrometer.core.instrument.MeterRegistry
-
getBaseTimeUnit
protected java.util.concurrent.TimeUnit getBaseTimeUnit()
- Specified by:
getBaseTimeUnit
in classio.micrometer.core.instrument.MeterRegistry
-
getPrometheusRegistry
public io.prometheus.client.CollectorRegistry getPrometheusRegistry()
- Returns:
- The underlying Prometheus
CollectorRegistry
.
-
defaultHistogramConfig
protected io.micrometer.core.instrument.distribution.DistributionStatisticConfig defaultHistogramConfig()
- Specified by:
defaultHistogramConfig
in classio.micrometer.core.instrument.MeterRegistry
-
-