Class HttpPostSink

java.lang.Object
com.arpnetworking.tsdcore.sinks.BaseSink
com.arpnetworking.tsdcore.sinks.HttpPostSink
All Implemented Interfaces:
Sink
Direct Known Subclasses:
DataDogSink, InfluxDbSink, KairosDbSink, KMonDSink, MonitordSink, SignalFxSink

public abstract class HttpPostSink extends BaseSink
Publishes to an HTTP endpoint. This class is thread safe.
Author:
Brandon Arp (brandon dot arp at inscopemetrics dot com)
  • Constructor Details

  • Method Details

    • recordAggregateData

      public void recordAggregateData(PeriodicData data)
      Description copied from interface: Sink
      Called when additional PeriodicData instances are available for publication.
      Parameters:
      data - The {PeriodicData to be published.
    • close

      public void close()
      Description copied from interface: Sink
      Called to allow the publisher to clean-up. No further calls to recordAggregation will be made after a call to close.
    • toLogValue

      public Object toLogValue()
      Description copied from class: BaseSink
      Generate a Steno log compatible representation.
      Overrides:
      toLogValue in class BaseSink
      Returns:
      Steno log compatible representation.
    • createRequest

      protected org.asynchttpclient.Request createRequest(org.asynchttpclient.AsyncHttpClient client, byte[] serializedData)
      Creates an HTTP request from a serialized data entry. Default is an POST containing serializedData as the body with content type of application/json
      Parameters:
      client - The http client to build the request with.
      serializedData - The serialized data.
      Returns:
      Request to execute
    • createRequests

      protected Collection<RequestEntry.Builder> createRequests(org.asynchttpclient.AsyncHttpClient client, PeriodicData periodicData)
      Create HTTP requests for each serialized data entry. The list is guaranteed to be non-empty.
      Parameters:
      client - The http client to build the request with.
      periodicData - The PeriodicData to be serialized.
      Returns:
      The Request instance to execute.
    • getUri

      protected URI getUri()
      Accessor for the URI.
      Returns:
      The URI.
    • getAysncHttpClientUri

      protected org.asynchttpclient.uri.Uri getAysncHttpClientUri()
      Accessor for the AysncHttpClient Uri.
      Returns:
      The AysncHttpClient Uri.
    • getMaximumAttempts

      protected int getMaximumAttempts()
      Accessor for the MaximumAttempts.
      Returns:
      The MaximumAttempts.
    • getRetryBaseBackoff

      protected Duration getRetryBaseBackoff()
      Accessor for the BaseBackoff of retries Duration.
      Returns:
      The BaseBackoff Duration.
    • getRetryMaximumDelay

      protected Duration getRetryMaximumDelay()
      Accessor for the MaximumDelay of retries Duration.
      Returns:
      The MaximumDelay Duration.
    • serialize

      protected abstract Collection<com.arpnetworking.tsdcore.sinks.HttpPostSink.SerializedDatum> serialize(PeriodicData periodicData)
      Serialize the PeriodicData instance for posting.
      Parameters:
      periodicData - The PeriodicData to be serialized.
      Returns:
      The serialized representation of PeriodicData.