public interface Registry extends Iterable<Meter>
Modifier and Type | Method and Description |
---|---|
Clock |
clock()
The clock used by the registry for timing events.
|
default <T extends Collection<?>> |
collectionSize(Id id,
T collection)
Register a gauge that reports the size of the
Collection . |
default <T extends Collection<?>> |
collectionSize(String name,
T collection)
Register a gauge that reports the size of the
Collection . |
Counter |
counter(Id id)
Measures the rate of some activity.
|
default Counter |
counter(String name)
Measures the rate of some activity.
|
default Counter |
counter(String name,
Iterable<Tag> tags)
Measures the rate of some activity.
|
default Counter |
counter(String name,
String... tags)
Measures the rate of some activity.
|
Id |
createId(String name)
Creates an identifier for a meter.
|
Id |
createId(String name,
Iterable<Tag> tags)
Creates an identifier for a meter.
|
default Id |
createId(String name,
Map<String,String> tags)
Creates an identifier for a meter.
|
default Id |
createId(String name,
String... tags)
Creates an identifier for a meter.
|
DistributionSummary |
distributionSummary(Id id)
Measures the rate and variation in amount for some activity.
|
default DistributionSummary |
distributionSummary(String name)
Measures the sample distribution of events.
|
default DistributionSummary |
distributionSummary(String name,
Iterable<Tag> tags)
Measures the sample distribution of events.
|
default DistributionSummary |
distributionSummary(String name,
String... tags)
Measures the sample distribution of events.
|
default <T extends Number> |
gauge(Id id,
T number)
Register a gauge that reports the value of the
Number . |
default <T> T |
gauge(Id id,
T obj,
ValueFunction f)
Register a gauge that reports the value of the object after the function
f is applied. |
default <T extends Number> |
gauge(String name,
Iterable<Tag> tags,
T number)
Register a gauge that reports the value of the
Number . |
default <T extends Number> |
gauge(String name,
T number)
Register a gauge that reports the value of the
Number . |
default <T> T |
gauge(String name,
T obj,
ValueFunction f)
Register a gauge that reports the value of the object.
|
Meter |
get(Id id)
Returns the meter associated with a given id.
|
Iterator<Meter> |
iterator()
Iterator for traversing the set of meters in the registry.
|
default LongTaskTimer |
longTaskTimer(Id id)
Measures the time taken for long tasks.
|
default LongTaskTimer |
longTaskTimer(String name)
Measures the time taken for long tasks.
|
default LongTaskTimer |
longTaskTimer(String name,
Iterable<Tag> tags)
Measures the time taken for long tasks.
|
default LongTaskTimer |
longTaskTimer(String name,
String... tags)
Measures the time taken for long tasks.
|
default <T extends Map<?,?>> |
mapSize(Id id,
T collection)
Register a gauge that reports the size of the
Map . |
default <T extends Map<?,?>> |
mapSize(String name,
T collection)
Register a gauge that reports the size of the
Map . |
default void |
methodValue(Id id,
Object obj,
String method)
Register a gauge that reports the return value of invoking the method on the object.
|
default void |
methodValue(String name,
Object obj,
String method)
Register a gauge that reports the return value of invoking the method on the object.
|
void |
register(Meter meter)
Add a custom meter to the registry.
|
Timer |
timer(Id id)
Measures the rate and time taken for short running tasks.
|
default Timer |
timer(String name)
Measures the time taken for short tasks.
|
default Timer |
timer(String name,
Iterable<Tag> tags)
Measures the time taken for short tasks.
|
default Timer |
timer(String name,
String... tags)
Measures the time taken for short tasks.
|
default <T extends Registry> |
underlying(Class<T> c)
Returns the first underlying registry that is an instance of
c . |
forEach, spliterator
Clock clock()
Id createId(String name)
name
- Description of the measurement that is being collected.Id createId(String name, Iterable<Tag> tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.void register(Meter meter)
Counter counter(Id id)
id
- Identifier created by a call to createId(java.lang.String)
DistributionSummary distributionSummary(Id id)
id
- Identifier created by a call to createId(java.lang.String)
Timer timer(Id id)
id
- Identifier created by a call to createId(java.lang.String)
Meter get(Id id)
id
- Identifier for the meter.default <T extends Registry> T underlying(Class<T> c)
c
.default Id createId(String name, String... tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.default Id createId(String name, Map<String,String> tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.default Counter counter(String name)
name
- Description of the measurement that is being collected.default Counter counter(String name, Iterable<Tag> tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.default Counter counter(String name, String... tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.default DistributionSummary distributionSummary(String name)
name
- Description of the measurement that is being collected.default DistributionSummary distributionSummary(String name, Iterable<Tag> tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.default DistributionSummary distributionSummary(String name, String... tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.default Timer timer(String name)
name
- Description of the measurement that is being collected.default Timer timer(String name, Iterable<Tag> tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.default Timer timer(String name, String... tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.default LongTaskTimer longTaskTimer(Id id)
id
- Identifier for the metric being registered.default LongTaskTimer longTaskTimer(String name)
name
- Description of the measurement that is being collected.default LongTaskTimer longTaskTimer(String name, Iterable<Tag> tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.default LongTaskTimer longTaskTimer(String name, String... tags)
name
- Description of the measurement that is being collected.tags
- Other dimensions that can be used to classify the measurement.default <T extends Number> T gauge(Id id, T number)
Number
. The registration
will keep a weak reference to the number so it will not prevent garbage collection.
The number implementation used should be thread safe.id
- Identifier for the metric being registered.number
- Thread-safe implementation of Number
used to access the value.default <T extends Number> T gauge(String name, T number)
Number
. See
gauge(Id, Number)
.name
- Name of the metric being registered.number
- Thread-safe implementation of Number
used to access the value.default <T extends Number> T gauge(String name, Iterable<Tag> tags, T number)
Number
. See
gauge(Id, Number)
.name
- Name of the metric being registered.tags
- Sequence of dimensions for breaking down the name.number
- Thread-safe implementation of Number
used to access the value.default <T> T gauge(Id id, T obj, ValueFunction f)
f
is applied. The registration will keep a weak reference to the number so it will
not prevent garbage collection. The number implementation used should be thread safe.id
- Identifier for the metric being registered.obj
- Object used to compute a value.f
- Function that is applied on the value for the number.default <T> T gauge(String name, T obj, ValueFunction f)
gauge(Id, Object, ValueFunction)
.name
- Name of the metric being registered.obj
- Object used to compute a value.f
- Function that is applied on the value for the number.default <T extends Collection<?>> T collectionSize(Id id, 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.id
- Identifier for the metric being registered.collection
- Thread-safe implementation of Collection
used to access the value.default <T extends Collection<?>> T collectionSize(String name, 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 metric being registered.collection
- Thread-safe implementation of Collection
used to access the value.default <T extends Map<?,?>> T mapSize(Id id, T collection)
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.id
- Identifier for the metric being registered.collection
- Thread-safe implementation of Map
used to access the value.default <T extends Map<?,?>> T mapSize(String name, T collection)
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 metric being registered.collection
- Thread-safe implementation of Map
used to access the value.default void methodValue(Id id, Object obj, String method)
id
- Identifier for the metric being registered.obj
- Object used to compute a value.method
- Name of the method to invoke on the object.default void methodValue(String name, Object obj, String method)
name
- Name of the metric being registered.obj
- Object used to compute a value.method
- Name of the method to invoke on the object.