public abstract class AbstractRegistry extends Object implements Registry
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger
Logger instance for the class.
|
| Constructor and Description |
|---|
AbstractRegistry(Clock clock)
Create a new instance.
|
AbstractRegistry(Clock clock,
RegistryConfig config)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
Clock |
clock()
The clock used by the registry for timing events.
|
RegistryConfig |
config()
Configuration settings used for this registry.
|
Counter |
counter(Id id)
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.
|
DistributionSummary |
distributionSummary(Id id)
Measures the rate and variation in amount for some activity.
|
Gauge |
gauge(Id id)
Represents a value sampled from another source.
|
Meter |
get(Id id)
Returns the meter associated with a given id.
|
protected <T extends Meter> |
getOrCreate(Id id,
Class<T> cls,
T dflt,
Function<Id,T> factory)
Helper used to get or create an instance of a core meter type.
|
Iterator<Meter> |
iterator()
Iterator for traversing the set of meters in the registry.
|
Gauge |
maxGauge(Id id)
Measures the maximum value recorded since the last reset.
|
protected abstract Counter |
newCounter(Id id)
Create a new counter instance for a given id.
|
protected abstract DistributionSummary |
newDistributionSummary(Id id)
Create a new distribution summary instance for a given id.
|
protected abstract Gauge |
newGauge(Id id)
Create a new gauge instance for a given id.
|
protected abstract Gauge |
newMaxGauge(Id id)
Create a new max gauge instance for a given id.
|
protected abstract Timer |
newTimer(Id id)
Create a new timer instance for a given id.
|
void |
register(Meter meter)
Register a passive gauge.
|
protected void |
removeExpiredMeters()
Can be called by sub-classes to remove expired meters from the internal map.
|
protected void |
reset()
This can be called be sub-classes to reset all state for the registry.
|
ConcurrentMap<Id,Object> |
state()
Returns a map that can be used to associate state with the registry.
|
Timer |
timer(Id id)
Measures the rate and time taken for short running tasks.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcollectionSize, collectionSize, counter, counter, counter, counters, createId, createId, distributionSummaries, distributionSummary, distributionSummary, distributionSummary, gauge, gauge, gauge, gauge, gauge, gauge, gauge, gauge, gauges, longTaskTimer, longTaskTimer, longTaskTimer, longTaskTimer, mapSize, mapSize, maxGauge, maxGauge, maxGauge, measurements, methodValue, methodValue, propagate, propagate, stream, timer, timer, timer, timers, underlyingforEach, spliteratorpublic AbstractRegistry(Clock clock)
clock - Clock used for performing all timing measurements.public AbstractRegistry(Clock clock, RegistryConfig config)
clock - Clock used for performing all timing measurements.config - Configuration settings for the registry.protected abstract Counter newCounter(Id id)
id - Identifier used to lookup this meter in the registry.protected abstract DistributionSummary newDistributionSummary(Id id)
id - Identifier used to lookup this meter in the registry.protected abstract Timer newTimer(Id id)
id - Identifier used to lookup this meter in the registry.protected abstract Gauge newGauge(Id id)
id - Identifier used to lookup this meter in the registry.protected abstract Gauge newMaxGauge(Id id)
id - Identifier used to lookup this meter in the registry.public final Clock clock()
Registrypublic final RegistryConfig config()
Registrypublic final Id createId(String name)
Registrypublic final Id createId(String name, Iterable<Tag> tags)
Registrypublic void register(Meter meter)
Registryregister in interface RegistryRegistry.gauge(Id, Number),
Registry.gauge(Id, Object, ToDoubleFunction),
Registry.collectionSize(Id, Collection),
Registry.mapSize(Id, Map)public ConcurrentMap<Id,Object> state()
RegistryLongTaskTimer.public final Counter counter(Id id)
Registrycounter in interface Registryid - Identifier created by a call to Registry.createId(java.lang.String)public final DistributionSummary distributionSummary(Id id)
RegistrydistributionSummary in interface Registryid - Identifier created by a call to Registry.createId(java.lang.String)public final Timer timer(Id id)
Registrytimer in interface Registryid - Identifier created by a call to Registry.createId(java.lang.String)public final Gauge gauge(Id id)
RegistryGauge.set(double).
Registry implementations are free to expire the gauge if it has not been updated in the
last minute. If you do not want to worry about the sampling, then use PolledMeter
instead.gauge in interface Registryid - Identifier created by a call to Registry.createId(java.lang.String)public final Gauge maxGauge(Id id)
RegistryRegistry.distributionSummary(Id) which provides a max along with other stats for most
registry implementations.maxGauge in interface Registryid - Identifier created by a call to Registry.createId(java.lang.String)protected <T extends Meter> T getOrCreate(Id id, Class<T> cls, T dflt, Function<Id,T> factory)
id - Identifier used to lookup this meter in the registry.cls - Type of the meter.dflt - Default value used if there is a failure during the lookup and it is not configured
to propagate.factory - Function for creating a new instance of the meter type if one is not already available
in the registry.public final Meter get(Id id)
Registrypublic final Iterator<Meter> iterator()
Registryprotected void removeExpiredMeters()
protected void reset()