public class PrometheusMeterRegistry extends AbstractMeterRegistry
clock, commonTags| Constructor and Description |
|---|
PrometheusMeterRegistry() |
PrometheusMeterRegistry(io.prometheus.client.CollectorRegistry registry) |
PrometheusMeterRegistry(io.prometheus.client.CollectorRegistry registry,
Clock clock) |
| Modifier and Type | Method and Description |
|---|---|
Counter |
counter(java.lang.String name,
java.lang.Iterable<Tag> tags)
Tracks a monotonically increasing value.
|
<T> T |
counter(java.lang.String name,
java.lang.Iterable<Tag> tags,
T obj,
java.util.function.ToDoubleFunction<T> f)
Tracks a monotonically increasing value, automatically incrementing the counter whenever
the value is observed.
|
DistributionSummary |
distributionSummary(java.lang.String name,
java.lang.Iterable<Tag> tags,
Quantiles quantiles,
Histogram<?> histogram) |
<M extends Meter> |
findMeter(java.lang.Class<M> mClass,
java.lang.String name,
java.lang.Iterable<Tag> tags) |
java.util.Optional<Meter> |
findMeter(Meter.Type type,
java.lang.String name,
java.lang.Iterable<Tag> tags) |
<T> T |
gauge(java.lang.String name,
java.lang.Iterable<Tag> tags,
T obj,
java.util.function.ToDoubleFunction<T> f)
Register a gauge that reports the value of the object after the function
f is applied. |
java.util.Collection<Meter> |
getMeters() |
io.prometheus.client.CollectorRegistry |
getPrometheusRegistry() |
LongTaskTimer |
longTaskTimer(java.lang.String name,
java.lang.Iterable<Tag> tags)
Measures the time taken for short tasks.
|
MeterRegistry |
register(Meter meter) |
java.lang.String |
scrape()
Content that should be included in the response body for an endpoint designate for
Prometheus to scrape from.
|
protected Timer |
timer(java.lang.String name,
java.lang.Iterable<Tag> tags,
Quantiles quantiles,
Histogram<?> histogram) |
commonTags, getClock, summaryBuilder, timerBuilder, withCommonTagsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcollectionSize, collectionSize, commonTags, counter, counter, counter, counter, findMeter, findMeter, gauge, gauge, gauge, longTaskTimer, mapSize, mapSize, summary, summary, timer, timerpublic PrometheusMeterRegistry()
public PrometheusMeterRegistry(io.prometheus.client.CollectorRegistry registry)
public PrometheusMeterRegistry(io.prometheus.client.CollectorRegistry registry,
Clock clock)
public java.util.Collection<Meter> getMeters()
public java.lang.String scrape()
public <M extends Meter> java.util.Optional<M> findMeter(java.lang.Class<M> mClass, java.lang.String name, java.lang.Iterable<Tag> tags)
public java.util.Optional<Meter> findMeter(Meter.Type type, java.lang.String name, java.lang.Iterable<Tag> tags)
public Counter counter(java.lang.String name, java.lang.Iterable<Tag> tags)
MeterRegistrypublic <T> T counter(java.lang.String name,
java.lang.Iterable<Tag> tags,
T obj,
java.util.function.ToDoubleFunction<T> f)
MeterRegistrypublic DistributionSummary distributionSummary(java.lang.String name, java.lang.Iterable<Tag> tags, Quantiles quantiles, Histogram<?> histogram)
distributionSummary in class AbstractMeterRegistryprotected Timer timer(java.lang.String name, java.lang.Iterable<Tag> tags, Quantiles quantiles, Histogram<?> histogram)
timer in class AbstractMeterRegistrypublic LongTaskTimer longTaskTimer(java.lang.String name, java.lang.Iterable<Tag> tags)
MeterRegistrypublic <T> T gauge(java.lang.String name,
java.lang.Iterable<Tag> tags,
T obj,
java.util.function.ToDoubleFunction<T> f)
MeterRegistryf is applied. The registration will keep a weak reference to the object so it will
not prevent garbage collection. Applying f on the object should be thread safe.
If multiple gauges are registered with the same id, then the values will be aggregated and the sum will be reported. For example, registering multiple gauges for active threads in a thread pool with the same id would produce a value that is the overall number of active threads. For other behaviors, manage it on the user side and avoid multiple registrations.
name - Name of the gauge being registered.tags - Sequence of dimensions for breaking down the getName.obj - Object used to compute a value.f - Function that is applied on the value for the number.public MeterRegistry register(Meter meter)
public io.prometheus.client.CollectorRegistry getPrometheusRegistry()
CollectorRegistry.