Package com.arpnetworking.metrics.impl
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 Summary
ConstructorsConstructorDescriptionInstrumentedApacheHttpSinkEventHandler
(Supplier<Optional<com.arpnetworking.metrics.MetricsFactory>> metricsFactorySupplier) Public constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
attemptComplete
(long records, long bytes, boolean success, long elapasedTime, TimeUnit elapsedTimeUnit) Callback invoked when a request to send samples has completed.void
droppedEvent
(com.arpnetworking.metrics.Event event) Callback invoked when anEvent
is dropped from the queue.
-
Constructor Details
-
InstrumentedApacheHttpSinkEventHandler
public InstrumentedApacheHttpSinkEventHandler(Supplier<Optional<com.arpnetworking.metrics.MetricsFactory>> metricsFactorySupplier) Public constructor.- Parameters:
metricsFactorySupplier
-Supplier
that providesOptional
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 interfaceApacheHttpSinkEventHandler
- Parameters:
records
- the number of records sentbytes
- the number of bytes sentsuccess
- success or failureelapasedTime
- the elapsed timeelapsedTimeUnit
- the elapsed time unit
-
droppedEvent
public void droppedEvent(com.arpnetworking.metrics.Event event) Description copied from interface:ApacheHttpSinkEventHandler
Callback invoked when anEvent
is dropped from the queue.- Specified by:
droppedEvent
in interfaceApacheHttpSinkEventHandler
- Parameters:
event
- theEvent
dropped from the queue
-