public interface MeterRegistry
Modifier and Type | Interface and Description |
---|---|
static interface |
MeterRegistry.Config |
static interface |
MeterRegistry.More |
static interface |
MeterRegistry.Search |
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.
|
default Counter |
counter(java.lang.String name,
java.lang.Iterable<Tag> tags)
Tracks a monotonically increasing value.
|
default Counter |
counter(java.lang.String name,
java.lang.String... tags)
Tracks a monotonically increasing value.
|
default Meter.Id |
createId(java.lang.String name,
java.lang.Iterable<Tag> tags,
java.lang.String description) |
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. |
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 . |
default <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.
|
default <T extends java.util.Collection<?>> |
gaugeCollectionSize(java.lang.String name,
java.lang.Iterable<Tag> tags,
T collection)
Register a gauge that reports the size of the
Collection . |
default <T extends java.util.Map<?,?>> |
gaugeMapSize(java.lang.String name,
java.lang.Iterable<Tag> tags,
T map)
Register a gauge that reports the size of the
Map . |
java.util.Collection<Meter> |
getMeters() |
MeterRegistry.More |
more()
Access to less frequently used meter types and patterns.
|
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.
|
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.
|
Timer |
timer(Meter.Id id,
Histogram.Builder<?> histogram,
Quantiles quantiles)
Measures the time taken for short tasks and the count of these tasks.
|
default Timer |
timer(java.lang.String name,
java.lang.Iterable<Tag> tags)
Measures the time taken for short tasks and the count of these tasks.
|
default Timer |
timer(java.lang.String name,
java.lang.String... tags)
Measures the time taken for short tasks and the count of these tasks.
|
java.util.Collection<Meter> getMeters()
MeterRegistry.Config config()
MeterRegistry.Search find(java.lang.String name)
default Counter counter(java.lang.String name, java.lang.Iterable<Tag> tags)
default Counter counter(java.lang.String name, java.lang.String... tags)
name
- The base metric nametags
- MUST be an even number of arguments representing key/value pairs of tags.DistributionSummary summary(Meter.Id id, Histogram.Builder<?> histogram, Quantiles quantiles)
default DistributionSummary summary(java.lang.String name, java.lang.Iterable<Tag> tags)
default DistributionSummary summary(java.lang.String name, java.lang.String... tags)
name
- The base metric nametags
- MUST be an even number of arguments representing key/value pairs of tags.Timer timer(Meter.Id id, Histogram.Builder<?> histogram, Quantiles quantiles)
default Timer timer(java.lang.String name, java.lang.Iterable<Tag> tags)
default Timer timer(java.lang.String name, java.lang.String... tags)
name
- The base metric nametags
- MUST be an even number of arguments representing key/value pairs of tags.MeterRegistry.More more()
Meter register(Meter.Id id, Meter.Type type, java.lang.Iterable<Measurement> measurements)
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.<T> Gauge gauge(Meter.Id id, 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.
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.default <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 name.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 name.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 gaugeCollectionSize(java.lang.String name, java.lang.Iterable<Tag> tags, T collection)
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.tags
- Sequence of dimensions for breaking down the name.collection
- Thread-safe implementation of Collection
used to access the value.default <T extends java.util.Map<?,?>> T gaugeMapSize(java.lang.String name, java.lang.Iterable<Tag> tags, T map)
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 name.map
- Thread-safe implementation of Map
used to access the value.default Meter.Id createId(java.lang.String name, java.lang.Iterable<Tag> tags, java.lang.String description)