Class MetricsConfigurationEnhancer

java.lang.Object
org.axonframework.extension.metrics.micrometer.MetricsConfigurationEnhancer
All Implemented Interfaces:
ConfigurationEnhancer

public class MetricsConfigurationEnhancer extends Object implements ConfigurationEnhancer
Implementation of the ConfigurationEnhancer that uses the MeterRegistry to decorate several components with MessageMonitors with unique MetricRegistries by registering MessageMonitorFactories with the MessageMonitorRegistry.

Components that are decorated are:

  • Any CommandBus implementation present in the ComponentRegistry receives a
    invalid @link
    {@link MessageCountingMonitor), {@link MessageTimerMonitor
    }, and CapacityMonitor.
  • Any EventSink implementation present in the ComponentRegistry receives a invalid input: '{@code MessageCountingMonitor) and {@code MessageTimerMonitor}.</li> <li>Any {@link EventProcessor} implementation present in the {@link ComponentRegistry} receives a {@code MessageCountingMonitor), {@code MessageTimerMonitor}, {@code CapacityMonitor}, and {@link EventProcessorLatencyMonitor}.</li> <li>Any {@link QueryBus} implementation present in the {@link ComponentRegistry} receives a {@code MessageCountingMonitor), {@code MessageTimerMonitor}, and {@code CapacityMonitor}.</li> </ul> <p> When constructing the {@code MetricsConfigurationEnhancer}, users can choose to add dimensionality to the measurements. When enabled, Micrometer {@link Tag tags} are added by default for the {@link Message#type() message type} {@link MessageType#name() name} and {@link EventProcessor} names, when applicable. @author Steven van Beelen @author Marijn van Zelst @author Ivan Dugalic @since 4.1.0'
  • Field Details

    • ENHANCER_ORDER

      public static final int ENHANCER_ORDER
      The order of this enhancer, set to -1024.
      See Also:
  • Constructor Details

    • MetricsConfigurationEnhancer

      public MetricsConfigurationEnhancer()
      Initializes a new MetricsConfigurerModule constructing MessageMonitors that are registered with a new MeterRegistry with default settings.

      Will have dimensionality enabled, which will add tags to measurements.

    • MetricsConfigurationEnhancer

      public MetricsConfigurationEnhancer(io.micrometer.core.instrument.MeterRegistry registry)
      Initializes a new MetricsConfigurerModule constructing MessageMonitors that are registered with the given registry.

      Will have dimensionality enabled, which will add tags to measurements.

      Parameters:
      registry - the MeterRegistry which will record the metrics
    • MetricsConfigurationEnhancer

      public MetricsConfigurationEnhancer(io.micrometer.core.instrument.MeterRegistry registry, boolean useDimensions)
      Initializes a new MetricsConfigurerModule constructing MessageMonitors that are registered with the given registry and useDimensions toggle.
      Parameters:
      registry - the MeterRegistry which will record the metrics
      useDimensions - when set to true will add tags to measurements
  • Method Details

    • enhance

      public void enhance(ComponentRegistry registry)
      Description copied from interface: ConfigurationEnhancer
      Enhances the given registry with, for example, additional components and decorators.
      Specified by:
      enhance in interface ConfigurationEnhancer
      Parameters:
      registry - The registry instance to enhance.
    • order

      public int order()
      Description copied from interface: ConfigurationEnhancer
      Returns the relative order this enhancer should be invoked in, compared to other instances.

      Use lower (negative) values for enhancers providing sensible defaults, and higher values for enhancers that should be able to override values potentially previously set. Defaults to 0 when not set.

      Specified by:
      order in interface ConfigurationEnhancer
      Returns:
      The order in which this enhancer should be invoked.