Constructor and Description |
---|
ExtendedRegistry(Registry impl)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
Clock |
clock()
The clock used by the registry for timing events.
|
<T extends Collection<?>> |
collectionSize(Id id,
T collection)
Register a gauge that reports the size of the
Collection . |
<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.
|
Counter |
counter(String name)
Measures the rate of some activity.
|
Counter |
counter(String name,
Iterable<Tag> tags)
Measures the rate of some activity.
|
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.
|
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.
|
DistributionSummary |
distributionSummary(String name)
Measures the sample distribution of events.
|
DistributionSummary |
distributionSummary(String name,
Iterable<Tag> tags)
Measures the sample distribution of events.
|
DistributionSummary |
distributionSummary(String name,
String... tags)
Measures the sample distribution of events.
|
<T extends Number> |
gauge(Id id,
T number)
Register a gauge that reports the value of the
Number . |
<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. |
<T extends Number> |
gauge(String name,
Iterable<Tag> tags,
T number)
Register a gauge that reports the value of the
Number . |
<T extends Number> |
gauge(String name,
T number)
Register a gauge that reports the value of the
Number . |
<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.
|
LongTaskTimer |
longTaskTimer(Id id)
Measures the time taken for long tasks.
|
LongTaskTimer |
longTaskTimer(String name)
Measures the time taken for long tasks.
|
LongTaskTimer |
longTaskTimer(String name,
Iterable<Tag> tags)
Measures the time taken for long tasks.
|
LongTaskTimer |
longTaskTimer(String name,
String... tags)
Measures the time taken for long tasks.
|
<T extends Map<?,?>> |
mapSize(Id id,
T collection)
Register a gauge that reports the size of the
Map . |
<T extends Map<?,?>> |
mapSize(String name,
T collection)
Register a gauge that reports the size of the
Map . |
void |
methodValue(Id id,
Object obj,
String method)
Register a gauge that reports the return value of invoking the method on the object.
|
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.
|
Timer |
timer(String name)
Measures the time taken for short tasks.
|
Timer |
timer(String name,
Iterable<Tag> tags)
Measures the time taken for short tasks.
|
Timer |
timer(String name,
String... tags)
Measures the time taken for short tasks.
|
String |
toString() |
Registry |
underlying()
Returns the underlying registry implementation that is being wrapped.
|
<T extends Registry> |
underlying(Class<T> c)
Returns the first underlying registry that is an instance of
c . |
public ExtendedRegistry(Registry impl)
public Registry underlying()
public <T extends Registry> T underlying(Class<T> c)
c
.public Clock clock()
Registry
public Id createId(String name)
Registry
public Id createId(String name, Iterable<Tag> tags)
Registry
public void register(Meter meter)
Registry
public Counter counter(Id id)
Registry
counter
in interface Registry
id
- Identifier created by a call to Registry.createId(java.lang.String)
public DistributionSummary distributionSummary(Id id)
Registry
distributionSummary
in interface Registry
id
- Identifier created by a call to Registry.createId(java.lang.String)
public Timer timer(Id id)
Registry
timer
in interface Registry
id
- Identifier created by a call to Registry.createId(java.lang.String)
public Meter get(Id id)
Registry
public Iterator<Meter> iterator()
Registry
public 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.public Counter counter(String name)
name
- Description of the measurement that is being collected.public 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.public 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.public DistributionSummary distributionSummary(String name)
name
- Description of the measurement that is being collected.public 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.public 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.public Timer timer(String name)
name
- Description of the measurement that is being collected.public 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.public 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.public LongTaskTimer longTaskTimer(Id id)
id
- Identifier for the metric being registered.public LongTaskTimer longTaskTimer(String name)
name
- Description of the measurement that is being collected.public 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.public 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.public <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.public <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.public <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.public <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.public <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.public <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.public <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.public <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.public <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.public 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.public 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.