public final class MeterRegistryHolder extends Object implements MeterRegistry
hierarchicalNamePrefix(String)
method)
MeterRegistry
For adding tags, a simple rule of thumb is to add component names as tags.
Generally, tag pairs (keys + values) are also used in the Dn
of the monitor
provider. Most of the Rdn
s will typically use cn
attribute type, but
for some of them you might want to use another attribute type. A simple rule of thumb is: whatever used as tag could
have its own attribute type.
The various *Gauge
factory methods help create gauges in the underlying MeterRegistry.
The monitoringGauge(String, Supplier)
method may be used to only output a metric to cn=monitor
and
derived monitoring systems (and NOT to the following endpoints: prometheus, graphite, crest metrics, etc.).
MeterRegistry.Config, MeterRegistry.More
Modifier and Type | Field and Description |
---|---|
static String |
TAG_ATTRIBUTE_NAME
The tag to use to map the ldap name.
|
Constructor and Description |
---|
MeterRegistryHolder(String dimensionalNamePrefix,
MeterRegistry registry)
Constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
void |
booleanGauge(String name,
String ldapAttributeName,
Supplier<Boolean> valueFunction)
Creates both an object gauge that is never added to the parent meter registry (it only appears in ldap meters),
and a gauge returning a double that will be added to the parent meter registry converting the
Boolean to a double. |
void |
booleanGauge(String name,
Supplier<Boolean> valueFunction)
Creates both an object gauge that is never added to the parent meter registry (it only appears in ldap meters),
and a gauge returning a double that will be added to the parent meter registry converting the
Boolean to a double. |
MeterRegistry.Config |
config() |
Counter |
counter(Meter.Id id)
Only used by
Counter.builder(String) . |
Counter |
counter(String name)
Tracks a monotonically increasing value.
|
void |
dateTimeGauge(String name,
String ldapAttributeName,
Supplier<GeneralizedTime> valueFunction)
Creates both an object gauge that is never added to the parent meter registry (it only appears in ldap meters),
and a gauge returning a double that will be added to the parent meter registry converting the
GeneralizedTime to a double by using the GeneralizedTime.getTimeInMillis() function. |
void |
dateTimeGauge(String name,
Supplier<GeneralizedTime> valueFunction)
Creates both an object gauge that is never added to the parent meter registry (it only appears in ldap meters),
and a gauge returning a double that will be added to the parent meter registry converting the
GeneralizedTime to a double by using the GeneralizedTime.getTimeInMillis() function. |
void |
deregisterAll()
Deregisters all the meters registered through this registry.
|
void |
deregisterMatching(MeterFilter filter)
Deregister meters matching the provided filter.
|
void |
doubleGauge(String name,
DoubleSupplier valueFunction)
Convenience method that creates a gauge returning a double that will be added to the parent meter
registry.
|
void |
durationGauge(String name,
Supplier<Duration> valueFunction)
Creates both an object gauge that is never added to the parent meter registry (it only appears in ldap meters),
and a gauge returning a double that will be added to the parent meter registry converting the
Duration using the Duration.toMillis() method. |
<T> Gauge |
gauge(Meter.Id id,
T obj,
ToDoubleFunction<T> valueFunction)
Only used by
Gauge.builder(String, Object, ToDoubleFunction) . |
<T extends Number> |
gauge(String name,
T number)
Register a gauge that reports the value of the
Number . |
static String |
getAttributeName(String meterName)
Returns the LDAP attribute name corresponding to this meter name.
|
Map<String,Meter> |
getLdapMeters()
Returns a Map from ldap attribute names to the corresponding meters.
|
List<Meter> |
getMeters() |
MeterRegistryHolder |
hierarchicalNamePrefix(String hierarchicalNamePrefix)
Sets the prefix for the hierarchical metric names.
|
<V> void |
monitoringGauge(String name,
Supplier<V> valueFunction)
Creates an object gauge that is never added to the parent meter registry (it only appears in ldap meters).
|
MeterRegistry.More |
more()
Access to less frequently used meter types and patterns.
|
<V extends Number> |
numberGauge(String name,
Supplier<V> valueFunction)
Creates both an object gauge that is never added to the parent meter registry (it only appears in ldap meters),
and a gauge returning a double that will be added to the parent meter registry converting the
Number to a double by using the Number.doubleValue() function. |
Meter |
register(Meter.Id id,
Meter.Type type,
Iterable<Measurement> measurements)
Register a custom meter type.
|
DistributionSummary |
summary(Meter.Id id,
HistogramConfig histogramConfig)
Only used by
DistributionSummary.builder(String) . |
DistributionSummary |
summary(String name)
Measures the distribution of samples.
|
MeterRegistryHolder |
tag(String key,
String value)
Adds a tag that will be automatically added to all meters registered against this meter registry.
|
Timer |
timer(Meter.Id id,
HistogramConfig histogramConfig,
PauseDetector pauseDetectorOverride)
Only used by
Timer.builder(String) . |
Timer |
timer(String name)
Measures the time taken for short tasks and the count of these tasks.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
find, forEachMeter, get
public static final String TAG_ATTRIBUTE_NAME
public MeterRegistryHolder(String dimensionalNamePrefix, MeterRegistry registry)
dimensionalNamePrefix
- prefix for the dimensional metric names. It will be used as a prefix for the hierarchical metric
names, unless a different one is set using hierarchicalNamePrefix(String)
.registry
- the decorated registrypublic MeterRegistryHolder hierarchicalNamePrefix(String hierarchicalNamePrefix)
hierarchicalNamePrefix
- the hierarchical name prefix to usepublic MeterRegistryHolder tag(String key, String value)
key
- the tag's keyvalue
- the tag's valuepublic Counter counter(Meter.Id id)
MeterRegistry
Counter.builder(String)
.counter
in interface MeterRegistry
id
- The identifier for this counter.public static String getAttributeName(String meterName)
meterName
with ds-mon-.meterName
- the meter name to prefixpublic void booleanGauge(String name, Supplier<Boolean> valueFunction)
Boolean
to a double.
name
- the metric namevalueFunction
- a function which returns any object which will be converted to Stringpublic void booleanGauge(String name, String ldapAttributeName, Supplier<Boolean> valueFunction)
Boolean
to a double.
name
- the metric nameldapAttributeName
- the LDAP attribute namevalueFunction
- a function which returns any object which will be converted to Stringpublic void dateTimeGauge(String name, Supplier<GeneralizedTime> valueFunction)
GeneralizedTime
to a double by using the GeneralizedTime.getTimeInMillis()
function.name
- the metric namevalueFunction
- a function which returns a GeneralizedTime
object that will be converted to Stringpublic void dateTimeGauge(String name, String ldapAttributeName, Supplier<GeneralizedTime> valueFunction)
GeneralizedTime
to a double by using the GeneralizedTime.getTimeInMillis()
function.name
- the metric nameldapAttributeName
- the LDAP attribute namevalueFunction
- a function which returns a GeneralizedTime
object that will be converted to Stringpublic void durationGauge(String name, Supplier<Duration> valueFunction)
Duration
using the Duration.toMillis()
method.name
- the metric namevalueFunction
- a function which returns a Duration
object that will be converted to Stringpublic void doubleGauge(String name, DoubleSupplier valueFunction)
name
- the metric namevalueFunction
- a function which returns any object which will be converted to Stringpublic <V extends Number> void numberGauge(String name, Supplier<V> valueFunction)
Number
to a double by using the Number.doubleValue()
function.V
- type of the value returned by the valueFunction
providedname
- the metric namevalueFunction
- a function which returns any object which will be converted to Stringpublic <V> void monitoringGauge(String name, Supplier<V> valueFunction)
In particular, this method may be used to only output a metric to cn=monitor
and derived monitoring
systems (rather than the following endpoints: prometheus, graphite, crest metrics, etc.).
V
- type of the value returned by the valueFunction
providedname
- the metric namevalueFunction
- a function which returns any object which will be converted to Stringpublic <T> Gauge gauge(Meter.Id id, T obj, ToDoubleFunction<T> valueFunction)
MeterRegistry
Gauge.builder(String, Object, ToDoubleFunction)
.gauge
in interface MeterRegistry
T
- The type of the state object from which the gauge value is extracted.id
- The identifier for this gauge.obj
- State object used to compute a value.valueFunction
- Function that is applied on the value for the number.public <T extends Number> Gauge gauge(String name, T number)
Number
.T
- The type of the state object from which the gauge value is extracted.name
- Name of the gauge being registered.number
- Thread-safe implementation of Number
used to access the value.public Counter counter(String name)
name
- The base metric namepublic Timer timer(String name)
name
- The base metric namepublic Timer timer(Meter.Id id, HistogramConfig histogramConfig, PauseDetector pauseDetectorOverride)
MeterRegistry
Timer.builder(String)
.timer
in interface MeterRegistry
id
- The identifier for this timer.histogramConfig
- Configuration that governs how distribution statistics are computed.public DistributionSummary summary(String name)
name
- The base metric namepublic DistributionSummary summary(Meter.Id id, HistogramConfig histogramConfig)
MeterRegistry
DistributionSummary.builder(String)
.summary
in interface MeterRegistry
id
- The identifier for this distribution summary.histogramConfig
- Configuration that governs how distribution statistics are computed.public Meter register(Meter.Id id, Meter.Type type, Iterable<Measurement> measurements)
MeterRegistry
register
in interface MeterRegistry
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.public void deregisterMatching(MeterFilter filter)
MeterRegistry
deregisterMatching
in interface MeterRegistry
filter
- a non-null meter filterpublic MeterRegistry.Config config()
config
in interface MeterRegistry
public MeterRegistry.More more()
MeterRegistry
more
in interface MeterRegistry
public List<Meter> getMeters()
getMeters
in interface MeterRegistry
public Map<String,Meter> getLdapMeters()
public void deregisterAll()
Copyright 2010-2022 ForgeRock AS.