Class OkHttpSender

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public final class OkHttpSender
    extends Sender
    Reports spans to Zipkin, using its POST endpoint.

    This sender is thread-safe.

    • Method Detail

      • create

        public static OkHttpSender create​(java.lang.String endpoint)
        Creates a sender that posts Encoding.JSON messages.
      • messageSizeInBytes

        public int messageSizeInBytes​(java.util.List<byte[]> encodedSpans)
        Specified by:
        messageSizeInBytes in class Sender
      • messageSizeInBytes

        public int messageSizeInBytes​(int encodedSizeInBytes)
        Overrides:
        messageSizeInBytes in class Sender
      • encoding

        public zipkin2.codec.Encoding encoding()
        Specified by:
        encoding in class Sender
      • check

        public zipkin2.CheckResult check()
        Sends an empty json message to the configured endpoint.
        Overrides:
        check in class zipkin2.Component
      • close

        public void close()
        Waits up to a second for in-flight requests to finish before cancelling them
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class zipkin2.Component
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object