Class EventProcessorLatencyMonitor

java.lang.Object
org.axonframework.extension.metrics.dropwizard.EventProcessorLatencyMonitor
All Implemented Interfaces:
io.dropwizard.metrics5.Metric, io.dropwizard.metrics5.MetricSet, MessageMonitor<EventMessage>

public class EventProcessorLatencyMonitor extends Object implements MessageMonitor<EventMessage>, io.dropwizard.metrics5.MetricSet
A MessageMonitor implementation dedicated to EventMessages.

This monitor defines the latency between the EventMessage.timestamp() and the Clock.instant(). Doing so, it depicts the latency from when an event was published compared to when an EventProcessor processes the event to clarify how far behind an EventProcessor is.

Do note that a replay (as triggered through StreamingEventProcessor.resetTokens(), for example) will cause this metric to bump up due to the processor handling old events.

Since:
3.0
Author:
Marijn van Zelst, Allard Buijze
  • Constructor Details

    • EventProcessorLatencyMonitor

      public EventProcessorLatencyMonitor()
      Construct an EventProcessorLatencyMonitor using ClockUtils.get().
    • EventProcessorLatencyMonitor

      @Deprecated(forRemoval=true, since="5.2.0") public EventProcessorLatencyMonitor(Clock clock)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use ClockUtils.set(Clock) if you have to provide a non-default Clock instance.
      Construct an EventProcessorLatencyMonitor using the given clock.
      Parameters:
      clock - defines the Clock used by this MessageMonitor implementation
  • Method Details

    • onMessageIngested

      public MessageMonitor.MonitorCallback onMessageIngested(EventMessage 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<EventMessage>
      Parameters:
      message - the message to monitor
      Returns:
      the callback
    • getMetrics

      public Map<io.dropwizard.metrics5.MetricName,io.dropwizard.metrics5.Metric> getMetrics()
      Specified by:
      getMetrics in interface io.dropwizard.metrics5.MetricSet