public abstract class AbstractMeterRegistry extends java.lang.Object implements MeterRegistry
MeterRegistry.Config, MeterRegistry.More, MeterRegistry.Search
Constructor and Description |
---|
AbstractMeterRegistry(Clock clock) |
Modifier and Type | Method and Description |
---|---|
MeterRegistry.Config |
config()
Access to configuration options for this registry.
|
Counter |
counter(Meter.Id id)
Tracks a monotonically increasing value.
|
Meter.Id |
createId(java.lang.String name,
java.lang.Iterable<Tag> tags,
java.lang.String description,
java.lang.String baseUnit) |
MeterRegistry.Search |
find(java.lang.String name) |
<T> Gauge |
gauge(Meter.Id id,
T obj,
java.util.function.ToDoubleFunction<T> f)
Register a gauge that reports the value of the object after the function
f is applied. |
protected java.lang.String |
getConventionName(Meter.Id id) |
protected java.util.List<Tag> |
getConventionTags(Meter.Id id) |
java.util.Collection<Meter> |
getMeters() |
MeterRegistry.More |
more()
Access to less frequently used meter types and patterns.
|
protected abstract Counter |
newCounter(Meter.Id id) |
protected abstract DistributionSummary |
newDistributionSummary(Meter.Id id,
Histogram.Builder<?> histogram,
Quantiles quantiles) |
protected abstract <T> Gauge |
newGauge(Meter.Id id,
T obj,
java.util.function.ToDoubleFunction<T> f) |
protected abstract LongTaskTimer |
newLongTaskTimer(Meter.Id id) |
protected abstract void |
newMeter(Meter.Id id,
Meter.Type type,
java.lang.Iterable<Measurement> measurements) |
protected abstract <T> Gauge |
newTimeGauge(Meter.Id id,
T obj,
java.util.concurrent.TimeUnit fUnit,
java.util.function.ToDoubleFunction<T> f) |
protected abstract Timer |
newTimer(Meter.Id id,
Histogram.Builder<?> histogram,
Quantiles quantiles) |
Meter |
register(Meter.Id id,
Meter.Type type,
java.lang.Iterable<Measurement> measurements)
Register a custom meter type.
|
DistributionSummary |
summary(Meter.Id id,
Histogram.Builder<?> histogram,
Quantiles quantiles)
Measures the sample distribution of events.
|
Timer |
timer(Meter.Id id,
Histogram.Builder<?> histogram,
Quantiles quantiles)
Measures the time taken for short tasks and the count of these tasks.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
counter, counter, createId, gauge, gauge, gauge, gauge, gaugeCollectionSize, gaugeMapSize, summary, summary, timer, timer
protected final Clock clock
public AbstractMeterRegistry(Clock clock)
public MeterRegistry.Config config()
MeterRegistry
config
in interface MeterRegistry
protected abstract <T> Gauge newGauge(Meter.Id id, T obj, java.util.function.ToDoubleFunction<T> f)
protected abstract LongTaskTimer newLongTaskTimer(Meter.Id id)
protected abstract Timer newTimer(Meter.Id id, Histogram.Builder<?> histogram, Quantiles quantiles)
protected abstract DistributionSummary newDistributionSummary(Meter.Id id, Histogram.Builder<?> histogram, Quantiles quantiles)
protected abstract void newMeter(Meter.Id id, Meter.Type type, java.lang.Iterable<Measurement> measurements)
protected abstract <T> Gauge newTimeGauge(Meter.Id id, T obj, java.util.concurrent.TimeUnit fUnit, java.util.function.ToDoubleFunction<T> f)
protected java.lang.String getConventionName(Meter.Id id)
public Meter register(Meter.Id id, Meter.Type type, java.lang.Iterable<Measurement> measurements)
MeterRegistry
register
in interface MeterRegistry
id
- Id of the meter being registered.type
- Meter type, which may be used by naming conventions to normalize the name.measurements
- A sequence of measurements describing how to sample the meter.public Counter counter(Meter.Id id)
MeterRegistry
counter
in interface MeterRegistry
public <T> Gauge gauge(Meter.Id id, T obj, java.util.function.ToDoubleFunction<T> f)
MeterRegistry
f
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.
gauge
in interface MeterRegistry
id
- Id of the gauge being registered.obj
- Object used to compute a value.f
- Function that is applied on the value for the number.public Timer timer(Meter.Id id, Histogram.Builder<?> histogram, Quantiles quantiles)
MeterRegistry
timer
in interface MeterRegistry
public DistributionSummary summary(Meter.Id id, Histogram.Builder<?> histogram, Quantiles quantiles)
MeterRegistry
summary
in interface MeterRegistry
public MeterRegistry.More more()
MeterRegistry
more
in interface MeterRegistry
public MeterRegistry.Search find(java.lang.String name)
find
in interface MeterRegistry
public java.util.Collection<Meter> getMeters()
getMeters
in interface MeterRegistry
public Meter.Id createId(java.lang.String name, java.lang.Iterable<Tag> tags, java.lang.String description, java.lang.String baseUnit)
createId
in interface MeterRegistry