Class GlobalMetricRegistry
java.lang.Object
org.axonframework.extension.metrics.micrometer.GlobalMetricRegistry
Registry for application metrics with convenient ways to register Axon components.
- Since:
- 4.1
- Author:
- Rene de Waele, Marijn van Zelst
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a newGlobalMetricRegistrydelegating to a newMeterRegistrywith default settings.GlobalMetricRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Initializes aGlobalMetricRegistrydelegating to the givenmeterRegistry. -
Method Summary
Modifier and TypeMethodDescriptionio.micrometer.core.instrument.MeterRegistryReturns the globalMeterRegistryto which components are registered.MessageMonitor<? super CommandMessage> registerCommandBus(String commandBusName) Registers new metrics to the registry to monitor aCommandBus.MessageMonitor<? super CommandMessage> registerCommandBus(String commandBusName, Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Registers new metrics to the registry to monitor aCommandBususingTags through the giventagsBuilder.MessageMonitor<? extends Message> registerComponent(Class<?> componentType, String componentName) Registers new metrics to the registry to monitor a component of the givencomponentType.MessageMonitor<? extends Message> registerComponentWithDefaultTags(Class<?> componentType, String componentName) Registers new metrics to the registry to monitor a component of the givencomponentType.MessageMonitor<? super EventMessage> registerEventBus(String eventBusName) Registers new metrics to the registry to monitor anEventBus.MessageMonitor<? super EventMessage> registerEventBus(String eventBusName, Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Registers new metrics to the registry to monitor anEventBususingTags through the giventagsBuilder.MessageMonitor<? super EventMessage> registerEventProcessor(String eventProcessorName) Registers new metrics to the registry to monitor anEventProcessor.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 anEventProcessorusingTags through the giventagsBuilder.MessageMonitor<? super QueryMessage> registerQueryBus(String queryBusName) Registers new metrics to the registry to monitor aQueryBus.MessageMonitor<? super QueryMessage> registerQueryBus(String queryBusName, Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Registers new metrics to the registry to monitor aQueryBususingTags through the giventagsBuilder.
-
Constructor Details
-
GlobalMetricRegistry
public GlobalMetricRegistry()Initializes a newGlobalMetricRegistrydelegating to a newMeterRegistrywith default settings. -
GlobalMetricRegistry
public GlobalMetricRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Initializes aGlobalMetricRegistrydelegating to the givenmeterRegistry.- Parameters:
meterRegistry- theMeterRegistrywhich 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 givencomponentType. The monitor will be registered with theMeterRegistryunder the givencomponentName. The returnedMessageMonitorcan be installed on the component to initiate the monitoring.- Parameters:
componentType- the type of component to registercomponentName- the name under which the component should be registered to the registry- Returns:
- a
MessageMonitorto monitor the behavior of a givencomponentType
-
registerEventProcessor
Registers new metrics to the registry to monitor anEventProcessor. The monitor will be registered with the registry under the giveneventProcessorName. The returnedMessageMonitorcan be installed on theEventProcessorto initiate the monitoring.- Parameters:
eventProcessorName- the name under which theEventProcessorshould be registered to the registry- Returns:
- a
MessageMonitorto monitor the behavior of anEventProcessor
-
registerCommandBus
Registers new metrics to the registry to monitor aCommandBus. The monitor will be registered with the registry under the givencommandBusName. The returnedMessageMonitorcan be installed on theCommandBusto initiate the monitoring.- Parameters:
commandBusName- the name under which theCommandBusshould be registered to the registry- Returns:
- a
MessageMonitorto monitor the behavior of aCommandBus
-
registerEventBus
Registers new metrics to the registry to monitor anEventBus. The monitor will be registered with the registry under the giveneventBusName. The returnedMessageMonitorcan be installed on theEventBusto initiate the monitoring.- Parameters:
eventBusName- the name under which theEventBusshould be registered to the registry- Returns:
- a
MessageMonitorto monitor the behavior of anEventBus
-
registerQueryBus
Registers new metrics to the registry to monitor aQueryBus. The monitor will be registered with the registry under the givenqueryBusName. The returnedMessageMonitorcan be installed on theQueryBusto initiate the monitoring.- Parameters:
queryBusName- the name under which theQueryBusshould be registered to the registry- Returns:
- a
MessageMonitorto monitor the behavior of aQueryBus
-
registerComponentWithDefaultTags
public MessageMonitor<? extends Message> registerComponentWithDefaultTags(Class<?> componentType, String componentName) Registers new metrics to the registry to monitor a component of the givencomponentType. The monitor will be registered with the registry under the givencomponentName, utilizingTags. The default set ofTags includes the 'message payload type' and additionally the 'processor name' for theEventProcessorinstances. The returnedMessageMonitorcan be installed on the component to initiate the monitoring.- Parameters:
componentType- the type of component to registercomponentName- the name under which the component should be registered to the registry- Returns:
- a
MessageMonitorwithTags enabled to monitor the behavior of the givencomponentType
-
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 anEventProcessorusingTags through the giventagsBuilder. The monitor will be registered with the registry under the giveneventProcessorName. The returnedMessageMonitorcan be installed on theEventProcessorto 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
MessageTimerMonitormakes sense per payload type, but the latency makes sense only for the event processor as a whole.- Parameters:
eventProcessorName- the name under which theEventProcessorshould be registered to the registrytagsBuilder- the function used to construct the list ofTag, based on the ingested message- Returns:
- a
MessageMonitorto monitor the behavior of anEventProcessor
-
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 aCommandBususingTags through the giventagsBuilder. The monitor will be registered with the registry under the givencommandBusName. The returnedMessageMonitorcan be installed on theCommandBusto initiate the monitoring.- Parameters:
commandBusName- the name under which theCommandBusshould be registered to the registrytagsBuilder- the function used to construct the list ofTag, based on the ingested message- Returns:
- a
MessageMonitorto monitor the behavior of aCommandBus
-
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 anEventBususingTags through the giventagsBuilder. The monitor will be registered with the registry under the giveneventBusName. The returnedMessageMonitorcan be installed on theEventBusto initiate the monitoring.- Parameters:
eventBusName- the name under which theEventBusshould be registered to the registrytagsBuilder- the function used to construct the list ofTag, based on the ingested message- Returns:
- a
MessageMonitorto monitor the behavior of anEventBus
-
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 aQueryBususingTags through the giventagsBuilder. The monitor will be registered with the registry under the givenqueryBusName. The returnedMessageMonitorcan be installed on theQueryBusto initiate the monitoring.- Parameters:
queryBusName- the name under which theQueryBusshould be registered to the registrytagsBuilder- the function used to construct the list ofTag, based on the ingested message- Returns:
- a
MessageMonitorto monitor the behavior of aQueryBus
-
getRegistry
public io.micrometer.core.instrument.MeterRegistry getRegistry()Returns the globalMeterRegistryto which components are registered.- Returns:
- the global registry
-