Class GlobalMetricRegistry

java.lang.Object
org.axonframework.extension.metrics.micrometer.GlobalMetricRegistry

public class GlobalMetricRegistry extends Object
Registry for application metrics with convenient ways to register Axon components.
Since:
4.1
Author:
Rene de Waele, Marijn van Zelst
  • Constructor Details

    • GlobalMetricRegistry

      public GlobalMetricRegistry()
      Initializes a new GlobalMetricRegistry delegating to a new MeterRegistry with default settings.
    • GlobalMetricRegistry

      public GlobalMetricRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Initializes a GlobalMetricRegistry delegating to the given meterRegistry.
      Parameters:
      meterRegistry - the MeterRegistry which will record the metrics
  • Method Details

    • registerComponent

      public MessageMonitor<? extends Message> registerComponent(Class<?> componentType, String componentName)
      Registers new metrics to the registry to monitor a component of the given componentType. The monitor will be registered with the MeterRegistry under the given componentName. The returned MessageMonitor can be installed on the component to initiate the monitoring.
      Parameters:
      componentType - the type of component to register
      componentName - the name under which the component should be registered to the registry
      Returns:
      a MessageMonitor to monitor the behavior of a given componentType
    • registerEventProcessor

      public MessageMonitor<? super EventMessage> registerEventProcessor(String eventProcessorName)
      Registers new metrics to the registry to monitor an EventProcessor. The monitor will be registered with the registry under the given eventProcessorName. The returned MessageMonitor can be installed on the EventProcessor to initiate the monitoring.
      Parameters:
      eventProcessorName - the name under which the EventProcessor should be registered to the registry
      Returns:
      a MessageMonitor to monitor the behavior of an EventProcessor
    • registerCommandBus

      public MessageMonitor<? super CommandMessage> registerCommandBus(String commandBusName)
      Registers new metrics to the registry to monitor a CommandBus. The monitor will be registered with the registry under the given commandBusName. The returned MessageMonitor can be installed on the CommandBus to initiate the monitoring.
      Parameters:
      commandBusName - the name under which the CommandBus should be registered to the registry
      Returns:
      a MessageMonitor to monitor the behavior of a CommandBus
    • registerEventBus

      public MessageMonitor<? super EventMessage> registerEventBus(String eventBusName)
      Registers new metrics to the registry to monitor an EventBus. The monitor will be registered with the registry under the given eventBusName. The returned MessageMonitor can be installed on the EventBus to initiate the monitoring.
      Parameters:
      eventBusName - the name under which the EventBus should be registered to the registry
      Returns:
      a MessageMonitor to monitor the behavior of an EventBus
    • registerQueryBus

      public MessageMonitor<? super QueryMessage> registerQueryBus(String queryBusName)
      Registers new metrics to the registry to monitor a QueryBus. The monitor will be registered with the registry under the given queryBusName. The returned MessageMonitor can be installed on the QueryBus to initiate the monitoring.
      Parameters:
      queryBusName - the name under which the QueryBus should be registered to the registry
      Returns:
      a MessageMonitor to monitor the behavior of a QueryBus
    • registerComponentWithDefaultTags

      public MessageMonitor<? extends Message> registerComponentWithDefaultTags(Class<?> componentType, String componentName)
      Registers new metrics to the registry to monitor a component of the given componentType. The monitor will be registered with the registry under the given componentName, utilizing Tags. The default set of Tags includes the 'message payload type' and additionally the 'processor name' for the EventProcessor instances. The returned MessageMonitor can be installed on the component to initiate the monitoring.
      Parameters:
      componentType - the type of component to register
      componentName - the name under which the component should be registered to the registry
      Returns:
      a MessageMonitor with Tags enabled to monitor the behavior of the given componentType
    • registerEventProcessor

      public MessageMonitor<? super EventMessage> registerEventProcessor(String eventProcessorName, Function<Message,Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder, Function<Message,Iterable<io.micrometer.core.instrument.Tag>> latencyTagsBuilder)
      Registers new metrics to the registry to monitor an EventProcessor using Tags through the given tagsBuilder. The monitor will be registered with the registry under the given eventProcessorName. The returned MessageMonitor can be installed on the EventProcessor to initiate the monitoring.

      The second tags builder parameter is specifically for the latency metric. These tags might be wanted to be less specific than the others. For example, the MessageTimerMonitor makes sense per payload type, but the latency makes sense only for the event processor as a whole.

      Parameters:
      eventProcessorName - the name under which the EventProcessor should be registered to the registry
      tagsBuilder - the function used to construct the list of Tag, based on the ingested message
      Returns:
      a MessageMonitor to monitor the behavior of an EventProcessor
    • registerCommandBus

      public MessageMonitor<? super CommandMessage> registerCommandBus(String commandBusName, Function<Message,Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder)
      Registers new metrics to the registry to monitor a CommandBus using Tags through the given tagsBuilder. The monitor will be registered with the registry under the given commandBusName. The returned MessageMonitor can be installed on the CommandBus to initiate the monitoring.
      Parameters:
      commandBusName - the name under which the CommandBus should be registered to the registry
      tagsBuilder - the function used to construct the list of Tag, based on the ingested message
      Returns:
      a MessageMonitor to monitor the behavior of a CommandBus
    • registerEventBus

      public MessageMonitor<? super EventMessage> registerEventBus(String eventBusName, Function<Message,Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder)
      Registers new metrics to the registry to monitor an EventBus using Tags through the given tagsBuilder. The monitor will be registered with the registry under the given eventBusName. The returned MessageMonitor can be installed on the EventBus to initiate the monitoring.
      Parameters:
      eventBusName - the name under which the EventBus should be registered to the registry
      tagsBuilder - the function used to construct the list of Tag, based on the ingested message
      Returns:
      a MessageMonitor to monitor the behavior of an EventBus
    • registerQueryBus

      public MessageMonitor<? super QueryMessage> registerQueryBus(String queryBusName, Function<Message,Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder)
      Registers new metrics to the registry to monitor a QueryBus using Tags through the given tagsBuilder. The monitor will be registered with the registry under the given queryBusName. The returned MessageMonitor can be installed on the QueryBus to initiate the monitoring.
      Parameters:
      queryBusName - the name under which the QueryBus should be registered to the registry
      tagsBuilder - the function used to construct the list of Tag, based on the ingested message
      Returns:
      a MessageMonitor to monitor the behavior of a QueryBus
    • getRegistry

      public io.micrometer.core.instrument.MeterRegistry getRegistry()
      Returns the global MeterRegistry to which components are registered.
      Returns:
      the global registry