Class CapacityMonitor
java.lang.Object
org.axonframework.extension.metrics.micrometer.CapacityMonitor
- All Implemented Interfaces:
MessageMonitor<Message>
Calculates capacity by tracking, within the configured time window, the average message processing time
and multiplying that by the amount of messages processed.
The capacity can be more than 1 if the monitored message handler processes the messages in parallel. The capacity for a single threaded message handler will be a value between 0 and 1.
If the value for a single threaded message handler is 1 the component is active 100% of the time. This means that messages will have to wait to be processed.
- Since:
- 4.1
- Author:
- Marijn van Zelst, Ivan Dugalic
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.axonframework.messaging.monitoring.MessageMonitor
MessageMonitor.MonitorCallback -
Method Summary
Modifier and TypeMethodDescriptionstatic CapacityMonitorbuildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry) Creates a capacity monitor with the default time window 10 minutesstatic CapacityMonitorbuildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit) Creates a capacity monitor with the default system clock.static CapacityMonitorbuildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit, io.micrometer.core.instrument.Clock clock) Creates a capacity monitor with the given time window.static CapacityMonitorbuildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit, io.micrometer.core.instrument.Clock clock, Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Creates a capacity monitor with the given time window.static CapacityMonitorbuildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit, Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Creates a capacity monitor with the default system clock.static CapacityMonitorbuildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Creates a capacity monitor with the default time window 10 minutesonMessageIngested(Message message) Takes a message and returns a callback that should be used to inform the message monitor about the result of processing the messageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.monitoring.MessageMonitor
onMessagesIngested
-
Method Details
-
buildMonitor
public static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry) Creates a capacity monitor with the default time window 10 minutes- Parameters:
meterNamePrefix- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry- The meter registry used to create and register the meters- Returns:
- The created capacity monitor
-
buildMonitor
public static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Creates a capacity monitor with the default time window 10 minutes- Parameters:
meterNamePrefix- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry- The meter registry used to create and register the meterstagsBuilder- The function used to construct the list of micrometerTag, based on the ingested message- Returns:
- The created capacity monitor
-
buildMonitor
public static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit) Creates a capacity monitor with the default system clock.- Parameters:
meterNamePrefix- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry- The meter registry used to create and register the meterswindow- The length of the window to measure the capacity overtimeUnit- The temporal unit of the time window- Returns:
- The created capacity monitor
-
buildMonitor
public static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit, Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Creates a capacity monitor with the default system clock.- Parameters:
meterNamePrefix- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry- The meter registry used to create and register the meterswindow- The length of the window to measure the capacity overtimeUnit- The temporal unit of the time windowtagsBuilder- The function used to construct the list of micrometerTag, based on the ingested message- Returns:
- The created capacity monitor
-
buildMonitor
public static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit, io.micrometer.core.instrument.Clock clock) Creates a capacity monitor with the given time window. Uses the provided clock to measure process time per message.- Parameters:
meterNamePrefix- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry- The meter registry used to create and register the meterswindow- The length of the window to measure the capacity overtimeUnit- The temporal unit of the time windowclock- The clock used to measure the process time per message- Returns:
- The created capacity monitor
-
buildMonitor
public static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit, io.micrometer.core.instrument.Clock clock, Function<Message, Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder) Creates a capacity monitor with the given time window. Uses the provided clock to measure process time per message.- Parameters:
meterNamePrefix- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry- The meter registry used to create and register the meterswindow- The length of the window to measure the capacity overtimeUnit- The temporal unit of the time windowclock- The clock used to measure the process time per messagetagsBuilder- The function used to construct the list of micrometerTag, based on the ingested message- Returns:
- The created capacity monitor
-
onMessageIngested
Description copied from interface:MessageMonitorTakes a message and returns a callback that should be used to inform the message monitor about the result of processing the message- Specified by:
onMessageIngestedin interfaceMessageMonitor<Message>- Parameters:
message- the message to monitor- Returns:
- the callback
-