Class MessageTimerMonitor.Builder

java.lang.Object
org.axonframework.extension.metrics.micrometer.MessageTimerMonitor.Builder
Enclosing class:
MessageTimerMonitor

public static class MessageTimerMonitor.Builder extends Object
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 Details

    • Builder

      public Builder()
  • Method Details

    • meterNamePrefix

      public MessageTimerMonitor.Builder meterNamePrefix(String meterNamePrefix)
      Sets the name used to prefix the names of the Timer instances created by this MessageMonitor.
      Parameters:
      meterNamePrefix - a String used to prefix the names of the Timer instances created by this MessageMonitor
      Returns:
      the current Builder instance, for fluent interfacing
    • meterRegistry

      public MessageTimerMonitor.Builder meterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Specifies the MeterRegistry used to registered the Timer instances to.
      Parameters:
      meterRegistry - the MeterRegistry used to registered the Timer instances to
      Returns:
      the current Builder instance, for fluent interfacing
    • clock

      public MessageTimerMonitor.Builder clock(io.micrometer.core.instrument.Clock clock)
      Sets the Clock used to define the processing duration of a given message being pushed through this MessageMonitor. Defaults to the Clock.SYSTEM.
      Parameters:
      clock - the Clock used 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 the Function used to deduce what the Tags should be for a message being monitored. Defaults to a Function returning Tags.empty().
      Parameters:
      tagsBuilder - a Function used to deduce what the Tags 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 the Timer. Defaults to a no-op. This for example allows more fine-grained control over the published percentiles used by the Timer.

      Without any customization, a Timer define the Timer.Builder.distributionStatisticExpiry(Duration) with a Duration of 10 minutes and Timer.Builder.publishPercentiles(double...) with the percentiles 0.5, 0.75, 0.95, 0.98, 0.99 and 0.999.

      Parameters:
      timerCustomization - a UnaryOperator taking in and returning a Timer.Builder forming a customization on the Timer being created
      Returns:
      the current Builder instance, for fluent interfacing
    • build

      public MessageTimerMonitor build()
      Initializes a MessageTimerMonitor as specified through this Builder.
      Returns:
      a MessageTimerMonitor as 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