Class CompositeMeterRegistry
java.lang.Object
io.micrometer.core.instrument.MeterRegistry
io.micrometer.core.instrument.composite.CompositeMeterRegistry
The clock of the composite effectively overrides the clocks of the registries it
manages without actually replacing the state of the clock in these registries with the
exception of long task timers, whose clock cannot be overridden.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.micrometer.core.instrument.MeterRegistry
MeterRegistry.Config, MeterRegistry.More -
Field Summary
Fields inherited from class io.micrometer.core.instrument.MeterRegistry
clock -
Constructor Summary
ConstructorsConstructorDescriptionCompositeMeterRegistry(Clock clock) CompositeMeterRegistry(Clock clock, Iterable<MeterRegistry> registries) -
Method Summary
Modifier and TypeMethodDescriptionadd(MeterRegistry registry) voidclose()Closes this registry, releasing any resources in the process.protected DistributionStatisticConfigEvery custom registry implementation should define a default histogram expiry at a minimum:protected TimeUnitprotected CounternewCounter(Meter.Id id) Build a new counter to be added to the registry.protected DistributionSummarynewDistributionSummary(Meter.Id id, DistributionStatisticConfig distributionStatisticConfig, double scale) Build a new distribution summary to be added to the registry.protected <T> FunctionCounternewFunctionCounter(Meter.Id id, T obj, ToDoubleFunction<T> countFunction) Build a new function counter to be added to the registry.protected <T> FunctionTimernewFunctionTimer(Meter.Id id, T obj, ToLongFunction<T> countFunction, ToDoubleFunction<T> totalTimeFunction, TimeUnit totalTimeFunctionUnit) Build a new function timer to be added to the registry.protected <T> GaugenewGauge(Meter.Id id, T obj, ToDoubleFunction<T> valueFunction) Build a new gauge to be added to the registry.protected LongTaskTimernewLongTaskTimer(Meter.Id id, DistributionStatisticConfig distributionStatisticConfig) Build a new long task timer to be added to the registry.protected MeternewMeter(Meter.Id id, Meter.Type type, Iterable<Measurement> measurements) Build a new custom meter to be added to the registry.protected <T> TimeGaugenewTimeGauge(Meter.Id id, T obj, TimeUnit valueFunctionUnit, ToDoubleFunction<T> valueFunction) Build a new time gauge to be added to the registry.protected TimernewTimer(Meter.Id id, DistributionStatisticConfig distributionStatisticConfig, PauseDetector pauseDetector) Build a new timer to be added to the registry.remove(MeterRegistry registry) Methods inherited from class io.micrometer.core.instrument.MeterRegistry
clear, config, counter, counter, find, forEachMeter, gauge, gauge, gauge, gauge, gaugeCollectionSize, gaugeMapSize, get, getConventionName, getConventionTags, getMeters, isClosed, meterRegistrationFailed, more, newLongTaskTimer, remove, remove, removeByPreFilterId, summary, summary, timer, timer
-
Constructor Details
-
CompositeMeterRegistry
public CompositeMeterRegistry() -
CompositeMeterRegistry
-
CompositeMeterRegistry
-
-
Method Details
-
newTimer
protected Timer newTimer(Meter.Id id, DistributionStatisticConfig distributionStatisticConfig, PauseDetector pauseDetector) Description copied from class:MeterRegistryBuild a new timer to be added to the registry. This is guaranteed to only be called if the timer doesn't already exist.- Specified by:
newTimerin classMeterRegistry- Parameters:
id- The id that uniquely identifies the timer.distributionStatisticConfig- Configuration for published distribution statistics.pauseDetector- The pause detector to use for coordinated omission compensation.- Returns:
- A new timer.
-
newDistributionSummary
protected DistributionSummary newDistributionSummary(Meter.Id id, DistributionStatisticConfig distributionStatisticConfig, double scale) Description copied from class:MeterRegistryBuild 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.- Specified by:
newDistributionSummaryin classMeterRegistry- Parameters:
id- The id that uniquely identifies the distribution summary.distributionStatisticConfig- Configuration for published distribution statistics.scale- Multiply every recorded sample by this factor.- Returns:
- A new distribution summary.
-
newCounter
Description copied from class:MeterRegistryBuild a new counter to be added to the registry. This is guaranteed to only be called if the counter doesn't already exist.- Specified by:
newCounterin classMeterRegistry- Parameters:
id- The id that uniquely identifies the counter.- Returns:
- A new counter.
-
newLongTaskTimer
protected LongTaskTimer newLongTaskTimer(Meter.Id id, DistributionStatisticConfig distributionStatisticConfig) Description copied from class:MeterRegistryBuild a new long task timer to be added to the registry. This is guaranteed to only be called if the long task timer doesn't already exist.- Overrides:
newLongTaskTimerin classMeterRegistry- Parameters:
id- The id that uniquely identifies the long task timer.distributionStatisticConfig- Configuration for published distribution statistics.- Returns:
- A new long task timer.
-
newGauge
Description copied from class:MeterRegistryBuild a new gauge to be added to the registry. This is guaranteed to only be called if the gauge doesn't already exist.- Specified by:
newGaugein classMeterRegistry- 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.
-
newTimeGauge
protected <T> TimeGauge newTimeGauge(Meter.Id id, @Nullable T obj, TimeUnit valueFunctionUnit, ToDoubleFunction<T> valueFunction) Description copied from class:MeterRegistryBuild 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.- Overrides:
newTimeGaugein classMeterRegistry- Type Parameters:
T- The type of the object upon which the value function derives a measurement.- Parameters:
id- The id that uniquely identifies the time gauge.obj- The state object from which the value function derives a measurement.valueFunctionUnit- The base unit of time returned by the value function.valueFunction- A function returning a time value that can go up or down.- Returns:
- A new time gauge.
-
newFunctionTimer
protected <T> FunctionTimer newFunctionTimer(Meter.Id id, T obj, ToLongFunction<T> countFunction, ToDoubleFunction<T> totalTimeFunction, TimeUnit totalTimeFunctionUnit) Description copied from class:MeterRegistryBuild a new function timer to be added to the registry. This is guaranteed to only be called if the function timer doesn't already exist.- Specified by:
newFunctionTimerin classMeterRegistry- Type Parameters:
T- The type of the object upon which the value functions derives their measurements.- Parameters:
id- The id that uniquely identifies the function timer.obj- The state object from which the count and total functions derive measurements.countFunction- A monotonically increasing count function.totalTimeFunction- A monotonically increasing total time function.totalTimeFunctionUnit- The base unit of time of the totals returned by the total time function.- Returns:
- A new function timer.
-
newFunctionCounter
protected <T> FunctionCounter newFunctionCounter(Meter.Id id, T obj, ToDoubleFunction<T> countFunction) Description copied from class:MeterRegistryBuild a new function counter to be added to the registry. This is guaranteed to only be called if the function counter doesn't already exist.- Specified by:
newFunctionCounterin classMeterRegistry- Type Parameters:
T- The type of the object upon which the value function derives a measurement.- Parameters:
id- The id that uniquely identifies the function counter.obj- The state object from which the count function derives a measurement.countFunction- A monotonically increasing count function.- Returns:
- A new function counter.
-
getBaseTimeUnit
- Specified by:
getBaseTimeUnitin classMeterRegistry- Returns:
- the registry's base TimeUnit. Must not be null.
-
defaultHistogramConfig
Description copied from class:MeterRegistryEvery custom registry implementation should define a default histogram expiry at a minimum:DistributionStatisticConfig.builder() .expiry(defaultStep) .build() .merge(DistributionStatisticConfig.DEFAULT);- Specified by:
defaultHistogramConfigin classMeterRegistry- Returns:
- The default distribution statistics config.
-
newMeter
Description copied from class:MeterRegistryBuild 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.- Specified by:
newMeterin classMeterRegistry- Parameters:
id- The id that uniquely identifies the custom meter.type- What kind of meter this is.measurements- A set of measurements describing how to sample this meter.- Returns:
- A new custom meter.
-
add
-
remove
-
getRegistries
-
close
public void close()Description copied from class:MeterRegistryCloses this registry, releasing any resources in the process. Once closed, this registry will no longer accept new meters and any publishing activity will cease.- Overrides:
closein classMeterRegistry
-