Class InstrumentedApacheHttpSinkEventHandler

java.lang.Object
com.arpnetworking.metrics.impl.InstrumentedApacheHttpSinkEventHandler
All Implemented Interfaces:
ApacheHttpSinkEventHandler

public final class InstrumentedApacheHttpSinkEventHandler extends Object implements ApacheHttpSinkEventHandler
Implementation of ApacheHttpSinkEventHandler which emits metrics periodically about the performance of the ApacheHttpSink. Although you cannot extend it through inheritance because it is final, you can extend it by encapsulating it within your own ApacheHttpSinkEventHandler implementation. TODO(ville): Convert to using PeriodicMetrics from the incubator project. TODO(ville): Add queue length metric by periodically polling the sink.
Author:
Ville Koskela (ville dot koskela at inscopemetrics dot io)
  • Constructor Details

    • InstrumentedApacheHttpSinkEventHandler

      public InstrumentedApacheHttpSinkEventHandler(Supplier<Optional<com.arpnetworking.metrics.MetricsFactory>> metricsFactorySupplier)
      Public constructor.
      Parameters:
      metricsFactorySupplier - Supplier that provides Optional MetricsFactory instance. Decouples the circular reference between this event handler and the metrics factory.
  • Method Details

    • attemptComplete

      public void attemptComplete(long records, long bytes, boolean success, long elapasedTime, TimeUnit elapsedTimeUnit)
      Description copied from interface: ApacheHttpSinkEventHandler
      Callback invoked when a request to send samples has completed.
      Specified by:
      attemptComplete in interface ApacheHttpSinkEventHandler
      Parameters:
      records - the number of records sent
      bytes - the number of bytes sent
      success - success or failure
      elapasedTime - the elapsed time
      elapsedTimeUnit - the elapsed time unit
    • droppedEvent

      public void droppedEvent(com.arpnetworking.metrics.Event event)
      Description copied from interface: ApacheHttpSinkEventHandler
      Callback invoked when an Event is dropped from the queue.
      Specified by:
      droppedEvent in interface ApacheHttpSinkEventHandler
      Parameters:
      event - the Event dropped from the queue