public interface MeterRegistry
Modifier and Type | Method and Description |
---|---|
default <T extends java.util.Collection<?>> |
collectionSize(T collection,
java.lang.String name,
java.lang.Iterable<Tag> tags)
Register a gauge that reports the size of the
Collection . |
default <T extends java.util.Collection<?>> |
collectionSize(T collection,
java.lang.String name,
Tag... tags)
Register a gauge that reports the size of the
Collection . |
void |
commonTags(java.lang.Iterable<Tag> tags)
Append a list of common tags to apply to all metrics reported to the monitoring system.
|
default void |
commonTags(java.lang.String... tags)
Append a list of common tags to apply to all metrics reported to the monitoring system.
|
Counter |
counter(java.lang.String name,
java.lang.Iterable<Tag> tags)
Measures the rate of some activity.
|
default Counter |
counter(java.lang.String name,
java.lang.String... tags)
Measures the rate of some activity.
|
<M extends Meter> |
findMeter(java.lang.Class<M> mClass,
java.lang.String name,
java.lang.Iterable<Tag> tags) |
default <M extends Meter> |
findMeter(java.lang.Class<M> mClass,
java.lang.String name,
java.lang.String... tags) |
java.util.Optional<Meter> |
findMeter(Meter.Type type,
java.lang.String name,
java.lang.Iterable<Tag> tags) |
default java.util.Optional<Meter> |
findMeter(Meter.Type type,
java.lang.String name,
java.lang.String... tags) |
default <T extends java.lang.Number> |
gauge(java.lang.String name,
java.lang.Iterable<Tag> tags,
T number)
Register a gauge that reports the value of the
Number . |
<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. |
default <T extends java.lang.Number> |
gauge(java.lang.String name,
T number)
Register a gauge that reports the value of the
Number . |
default <T> T |
gauge(java.lang.String name,
T obj,
java.util.function.ToDoubleFunction<T> f)
Register a gauge that reports the value of the object.
|
Clock |
getClock() |
java.util.Collection<Meter> |
getMeters() |
LongTaskTimer |
longTaskTimer(java.lang.String name,
java.lang.Iterable<Tag> tags)
Measures the time taken for short tasks.
|
default LongTaskTimer |
longTaskTimer(java.lang.String name,
java.lang.String... tags)
Measures the time taken for short tasks.
|
default <T extends java.util.Map<?,?>> |
mapSize(T map,
java.lang.String name,
java.lang.Iterable<Tag> tags)
Register a gauge that reports the size of the
Map . |
default <T extends java.util.Map<?,?>> |
mapSize(T map,
java.lang.String name,
java.lang.String... tags)
Register a gauge that reports the size of the
Map . |
MeterRegistry |
register(Meter meter) |
default DistributionSummary |
summary(java.lang.String name,
java.lang.Iterable<Tag> tags)
Measures the sample distribution of events.
|
default DistributionSummary |
summary(java.lang.String name,
java.lang.String... tags)
Measures the sample distribution of events.
|
DistributionSummary.Builder |
summaryBuilder(java.lang.String name)
Build a new Distribution Summary, which is registered with this registry once
DistributionSummary.Builder.create() is called. |
default Timer |
timer(java.lang.String name,
java.lang.Iterable<Tag> tags)
Measures the time taken for short tasks.
|
default Timer |
timer(java.lang.String name,
java.lang.String... tags)
Measures the time taken for short tasks.
|
Timer.Builder |
timerBuilder(java.lang.String name)
Build a new Timer, which is registered with this registry once
Timer.Builder.create() is called. |
java.util.Collection<Meter> getMeters()
void commonTags(java.lang.Iterable<Tag> tags)
default void commonTags(java.lang.String... tags)
default <M extends Meter> java.util.Optional<M> findMeter(java.lang.Class<M> mClass, java.lang.String name, java.lang.String... tags)
<M extends Meter> java.util.Optional<M> findMeter(java.lang.Class<M> mClass, java.lang.String name, java.lang.Iterable<Tag> tags)
default java.util.Optional<Meter> findMeter(Meter.Type type, java.lang.String name, java.lang.String... tags)
java.util.Optional<Meter> findMeter(Meter.Type type, java.lang.String name, java.lang.Iterable<Tag> tags)
Clock getClock()
Counter counter(java.lang.String name, java.lang.Iterable<Tag> tags)
default Counter counter(java.lang.String name, java.lang.String... tags)
DistributionSummary.Builder summaryBuilder(java.lang.String name)
DistributionSummary.Builder.create()
is called.name
- The name of the distribution summary (which is the only requirement for a new distribution summary).default DistributionSummary summary(java.lang.String name, java.lang.Iterable<Tag> tags)
default DistributionSummary summary(java.lang.String name, java.lang.String... tags)
Timer.Builder timerBuilder(java.lang.String name)
Timer.Builder.create()
is called.name
- The name of the timer (which is the only requirement for a new timer).default Timer timer(java.lang.String name, java.lang.Iterable<Tag> tags)
default Timer timer(java.lang.String name, java.lang.String... tags)
LongTaskTimer longTaskTimer(java.lang.String name, java.lang.Iterable<Tag> tags)
default LongTaskTimer longTaskTimer(java.lang.String name, java.lang.String... tags)
MeterRegistry register(Meter meter)
<T> T gauge(java.lang.String name, java.lang.Iterable<Tag> tags, T obj, java.util.function.ToDoubleFunction<T> f)
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.
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.default <T extends java.lang.Number> T gauge(java.lang.String name, java.lang.Iterable<Tag> tags, T number)
Number
.name
- Name of the gauge being registered.tags
- Sequence of dimensions for breaking down the getName.number
- Thread-safe implementation of Number
used to access the value.default <T extends java.lang.Number> T gauge(java.lang.String name, T number)
Number
.name
- Name of the gauge being registered.number
- Thread-safe implementation of Number
used to access the value.default <T> T gauge(java.lang.String name, T obj, java.util.function.ToDoubleFunction<T> f)
name
- Name of the gauge being registered.obj
- Object used to compute a value.f
- Function that is applied on the value for the number.default <T extends java.util.Collection<?>> T collectionSize(T collection, java.lang.String name, java.lang.Iterable<Tag> tags)
Collection
. The registration
will keep a weak reference to the collection so it will not prevent garbage collection.
The collection implementation used should be thread safe. Note that calling
Collection.size()
can be expensive for some collection implementations
and should be considered before registering.collection
- Thread-safe implementation of Collection
used to access the value.name
- Name of the gauge being registered.tags
- Sequence of dimensions for breaking down the getName.default <T extends java.util.Collection<?>> T collectionSize(T collection, java.lang.String name, Tag... tags)
Collection
. The registration
will keep a weak reference to the collection so it will not prevent garbage collection.
The collection implementation used should be thread safe. Note that calling
Collection.size()
can be expensive for some collection implementations
and should be considered before registering.name
- Name of the gauge being registered.collection
- Thread-safe implementation of Collection
used to access the value.tags
- Tags to apply to the gauge.default <T extends java.util.Map<?,?>> T mapSize(T map, java.lang.String name, java.lang.Iterable<Tag> tags)
Map
. The registration
will keep a weak reference to the collection so it will not prevent garbage collection.
The collection implementation used should be thread safe. Note that calling
Map.size()
can be expensive for some collection implementations
and should be considered before registering.name
- Name of the gauge being registered.tags
- Sequence of dimensions for breaking down the getName.map
- Thread-safe implementation of Map
used to access the value.default <T extends java.util.Map<?,?>> T mapSize(T map, java.lang.String name, java.lang.String... tags)
Map
. The registration
will keep a weak reference to the collection so it will not prevent garbage collection.
The collection implementation used should be thread safe. Note that calling
Map.size()
can be expensive for some collection implementations
and should be considered before registering.map
- Thread-safe implementation of Map
used to access the value.name
- Name of the gauge being registered.tags
- Tags to apply to the gauge.