Class AbstractMeterRegistry
java.lang.Object
org.forgerock.monitoring.dropwizard.AbstractMeterRegistry
- All Implemented Interfaces:
MeterRegistry
- Direct Known Subclasses:
DropwizardMeterRegistry
Creates and manages your application's set of meters. Exporters use the meter registry to iterate
over the set of meters instrumenting your application, and then further iterate over each meter's metrics, generally
resulting in a time series in the metrics backend for each combination of metrics and dimensions.
MeterRegistry may be used in a reactive context. As such, implementations must not negatively impact the calling thread, e.g. it should respond immediately by avoiding IO call, deep stack recursion or any coordination.
ForgeRock changes:
- Split this abstract class from the MeterRegister interface
- Fix checkstyle errors
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Access to configuration options for this registry.Nested classes/interfaces inherited from interface org.forgerock.monitoring.api.instrument.MeterRegistry
MeterRegistry.Config, MeterRegistry.More
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractMeterRegistry
(Clock clock) Creates an abstract meter registry. -
Method Summary
Modifier and TypeMethodDescriptionconfig()
Only used byCounter.builder(String)
.protected abstract HistogramConfig
Every custom registry implementation should define a default histogram expiry.void
deregisterMatching
(MeterFilter filter) Deregister meters matching the provided filter.<T> Gauge
gauge
(Meter.Id id, T obj, ToDoubleFunction<T> valueFunction) Only used byGauge.builder(String, Object, ToDoubleFunction)
.protected abstract TimeUnit
The registry's base TimeUnit.more()
Access to less frequently used meter types and patterns.protected abstract Counter
newCounter
(Meter.Id id) Build a new counter to be added to the registry.protected abstract DistributionSummary
newDistributionSummary
(Meter.Id id, HistogramConfig histogramConfig) Build a new distribution summary to be added to the registry.protected abstract <T> Gauge
newGauge
(Meter.Id id, T obj, ToDoubleFunction<T> valueFunction) Build a new gauge to be added to the registry.protected abstract Meter
newMeter
(Meter.Id id, Meter.Type type, Iterable<Measurement> measurements) Build a new custom meter to be added to the registry.protected <T> TimeGauge
newTimeGauge
(Meter.Id id, T obj, TimeUnit valueFunctionUnit, ToDoubleFunction<T> valueFunction) Build a new time gauge to be added to the registry.protected abstract Timer
newTimer
(Meter.Id id, HistogramConfig histogramConfig, PauseDetector pauseDetector) Build a new timer to be added to the registry.register
(Meter.Id id, Meter.Type type, Iterable<Measurement> measurements) Register a custom meter type.summary
(Meter.Id id, HistogramConfig histogramConfig) Only used byDistributionSummary.builder(String)
.timer
(Meter.Id id, HistogramConfig histogramConfig, PauseDetector pauseDetectorOverride) Only used byTimer.builder(String)
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.forgerock.monitoring.api.instrument.MeterRegistry
find, forEachMeter, get
-
Constructor Details
-
AbstractMeterRegistry
Creates an abstract meter registry.- Parameters:
clock
- the clock to use for this meter registry
-
-
Method Details
-
newGauge
protected abstract <T> Gauge newGauge(Meter.Id id, @Nullable T obj, ToDoubleFunction<T> valueFunction) Build a new gauge to be added to the registry. This is guaranteed to only be called if the gauge doesn't already exist.- Type Parameters:
T
- The type of the state object from which the gauge value is extracted.- Parameters:
id
- The id that uniquely identifies the gauge.obj
- State object used to compute a value.valueFunction
- Function that is applied on the value for the number.- Returns:
- A new gauge.
-
newCounter
Build a new counter to be added to the registry. This is guaranteed to only be called if the counter doesn't already exist.- Parameters:
id
- The id that uniquely identifies the counter.- Returns:
- A new counter.
-
newTimer
protected abstract Timer newTimer(Meter.Id id, HistogramConfig histogramConfig, PauseDetector pauseDetector) Build a new timer to be added to the registry. This is guaranteed to only be called if the timer doesn't already exist.- Parameters:
id
- The id that uniquely identifies the timer.histogramConfig
- the configuration for the histogram.pauseDetector
- the pause detector.- Returns:
- A new timer.
-
newDistributionSummary
protected abstract DistributionSummary newDistributionSummary(Meter.Id id, HistogramConfig histogramConfig) Build a new distribution summary to be added to the registry. This is guaranteed to only be called if the distribution summary doesn't already exist.- Parameters:
id
- The id that uniquely identifies the distribution summary.histogramConfig
- the configuration for the histogram.- Returns:
- A new distribution summary.
-
newMeter
Build a new custom meter to be added to the registry. This is guaranteed to only be called if the custom meter doesn't already exist.- Parameters:
id
- The id that uniquely identifies the custom meter.type
- The type of meter.measurements
- the measurements.- Returns:
- A new custom meter.
-
newTimeGauge
protected <T> TimeGauge newTimeGauge(Meter.Id id, T obj, TimeUnit valueFunctionUnit, ToDoubleFunction<T> valueFunction) Build a new time gauge to be added to the registry. This is guaranteed to only be called if the time gauge doesn't already exist.- Type Parameters:
T
- The type of the state object from which the gauge value is extracted.- Parameters:
id
- The id that uniquely identifies the time gauge.obj
- State object used to compute a value.valueFunction
- Function that is applied on the value for the number.valueFunctionUnit
- the time unit of the value returned by the value function.- Returns:
- A new time gauge.
-
getBaseTimeUnit
The registry's base TimeUnit.- Returns:
- the non-null registry's base TimeUnit.
-
defaultHistogramConfig
Every custom registry implementation should define a default histogram expiry.histogramConfig.builder().histogramExpiry(defaultStep).build().merge(HistogramConfig.DEFAULT);
- Returns:
- the configuration for the histogram.
-
counter
Description copied from interface:MeterRegistry
Only used byCounter.builder(String)
.- Specified by:
counter
in interfaceMeterRegistry
- Parameters:
id
- The identifier for this counter.- Returns:
- A new or existing counter.
-
gauge
Description copied from interface:MeterRegistry
Only used byGauge.builder(String, Object, ToDoubleFunction)
.- Specified by:
gauge
in interfaceMeterRegistry
- Type Parameters:
T
- The type of the state object from which the gauge value is extracted.- Parameters:
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.- Returns:
- A new or existing long task timer.
-
timer
public Timer timer(Meter.Id id, HistogramConfig histogramConfig, PauseDetector pauseDetectorOverride) Description copied from interface:MeterRegistry
Only used byTimer.builder(String)
.- Specified by:
timer
in interfaceMeterRegistry
- Parameters:
id
- The identifier for this timer.histogramConfig
- Configuration that governs how distribution statistics are computed.- Returns:
- A new or existing timer.
-
summary
Description copied from interface:MeterRegistry
Only used byDistributionSummary.builder(String)
.- Specified by:
summary
in interfaceMeterRegistry
- Parameters:
id
- The identifier for this distribution summary.histogramConfig
- Configuration that governs how distribution statistics are computed.- Returns:
- A new or existing distribution summary.
-
register
Description copied from interface:MeterRegistry
Register a custom meter type.- Specified by:
register
in interfaceMeterRegistry
- Parameters:
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.- Returns:
- The registry.
-
deregisterMatching
Description copied from interface:MeterRegistry
Deregister meters matching the provided filter.- Specified by:
deregisterMatching
in interfaceMeterRegistry
- Parameters:
filter
- a non-null meter filter
-
getMeters
- Specified by:
getMeters
in interfaceMeterRegistry
- Returns:
- The set of registered meters.
-
config
- Specified by:
config
in interfaceMeterRegistry
- Returns:
- A configuration object used to change the behavior of this registry.
-
more
Description copied from interface:MeterRegistry
Access to less frequently used meter types and patterns.- Specified by:
more
in interfaceMeterRegistry
- Returns:
- Access to additional meter types and patterns.
-