Class CapacityMonitor

java.lang.Object
org.axonframework.extension.metrics.dropwizard.CapacityMonitor
All Implemented Interfaces:
com.codahale.metrics.Metric, com.codahale.metrics.MetricSet, MessageMonitor<Message>

public class CapacityMonitor extends Object implements MessageMonitor<Message>, com.codahale.metrics.MetricSet
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:
3.0
Author:
Marijn van Zelst
  • Constructor Details

    • CapacityMonitor

      public CapacityMonitor()
      Creates a capacity monitor with the default time window 10 minutes
    • CapacityMonitor

      public CapacityMonitor(long window, TimeUnit timeUnit)
      Creates a capacity monitor with the default time window 10 minutes
      Parameters:
      window - The length of the window to measure the capacity over
      timeUnit - The time unit of the time window
    • CapacityMonitor

      public CapacityMonitor(long window, TimeUnit timeUnit, com.codahale.metrics.Clock clock)
      Creates a capacity monitor with the given time window. Uses the provided clock to measure process time per message.
      Parameters:
      window - The length of the window to measure the capacity over
      timeUnit - The time unit of the time window
      clock - The clock used to measure the process time per message
  • Method Details

    • onMessageIngested

      public MessageMonitor.MonitorCallback onMessageIngested(@Nonnull Message message)
      Description copied from interface: MessageMonitor
      Takes a message and returns a callback that should be used to inform the message monitor about the result of processing the message
      Specified by:
      onMessageIngested in interface MessageMonitor<Message>
      Parameters:
      message - the message to monitor
      Returns:
      the callback
    • getMetrics

      public Map<String,com.codahale.metrics.Metric> getMetrics()
      Specified by:
      getMetrics in interface com.codahale.metrics.MetricSet