Class MessageTimerMonitor.Builder
java.lang.Object
org.axonframework.extension.metrics.micrometer.MessageTimerMonitor.Builder
- Enclosing class:
MessageTimerMonitor
Builder class to instantiate a
MessageTimerMonitor.
The Clock is defaulted to a Clock.SYSTEM, the tagsBuilder to a Function returning
Tags.empty() and the timerCustomization to a no-op. The meterNamePrefix and
MeterRegistry are hard requirements and as such should be provided.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aMessageTimerMonitoras specified through this Builder.clock(io.micrometer.core.instrument.Clock clock) Sets theClockused to define the processing duration of a given message being pushed through thisMessageMonitor.meterNamePrefix(String meterNamePrefix) Sets the name used to prefix the names of theTimerinstances created by thisMessageMonitor.meterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Specifies theMeterRegistryused to registered theTimerinstances to.tagsBuilder(Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Configures theFunctionused to deduce what theTags should be for a message being monitored.timerCustomization(UnaryOperator<io.micrometer.core.instrument.Timer.Builder> timerCustomization) Allows for specifying a customization which will be added during the creation of theTimer.protected voidvalidate()Validate whether the fields contained in this Builder as set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
meterNamePrefix
Sets the name used to prefix the names of theTimerinstances created by thisMessageMonitor.- Parameters:
meterNamePrefix- aStringused to prefix the names of theTimerinstances created by thisMessageMonitor- Returns:
- the current Builder instance, for fluent interfacing
-
meterRegistry
public MessageTimerMonitor.Builder meterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Specifies theMeterRegistryused to registered theTimerinstances to.- Parameters:
meterRegistry- theMeterRegistryused to registered theTimerinstances to- Returns:
- the current Builder instance, for fluent interfacing
-
clock
Sets theClockused to define the processing duration of a given message being pushed through thisMessageMonitor. Defaults to theClock.SYSTEM.- Parameters:
clock- theClockused to define the processing duration of a given message- Returns:
- the current Builder instance, for fluent interfacing
-
tagsBuilder
public MessageTimerMonitor.Builder tagsBuilder(Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Configures theFunctionused to deduce what theTags should be for a message being monitored. Defaults to aFunctionreturningTags.empty().- Parameters:
tagsBuilder- aFunctionused to deduce what theTags should be for a message being monitored- Returns:
- the current Builder instance, for fluent interfacing
-
timerCustomization
public MessageTimerMonitor.Builder timerCustomization(UnaryOperator<io.micrometer.core.instrument.Timer.Builder> timerCustomization) Allows for specifying a customization which will be added during the creation of theTimer. Defaults to a no-op. This for example allows more fine-grained control over the published percentiles used by theTimer.Without any customization, a
Timerdefine theTimer.Builder.distributionStatisticExpiry(Duration)with aDurationof 10 minutes andTimer.Builder.publishPercentiles(double...)with the percentiles0.5,0.75,0.95,0.98,0.99and0.999.- Parameters:
timerCustomization- aUnaryOperatortaking in and returning aTimer.Builderforming a customization on theTimerbeing created- Returns:
- the current Builder instance, for fluent interfacing
-
build
Initializes aMessageTimerMonitoras specified through this Builder.- Returns:
- a
MessageTimerMonitoras specified through this Builder
-
validate
protected void validate()Validate whether the fields contained in this Builder as set accordingly.- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-