Class Sender

  • All Implemented Interfaces:
    Closeable, BytesMessageSender

    @Deprecated
    public abstract class Sender
    extends Component
    implements BytesMessageSender
    Deprecated.
    since 3.2, use BytesMessageSender instead. This will be removed in v4.0.
    Sends a list of encoded spans to a transport such as http or Kafka. Usually, this involves encoding them into a message and enqueueing them for transport over http or Kafka. The typical end recipient is a zipkin collector.

    Unless mentioned otherwise, senders are not thread-safe. They were designed to be used by a single reporting thread.

    Those looking to initialize eagerly should call Component.check(). This can be used to reduce latency on the first send operation, or to fail fast.

    Implementation notes

    The parameter is a list of encoded spans as opposed to an encoded message. This allows implementations flexibility on how to encode spans into a message. For example, a large span might need to be sent as a separate message to avoid kafka limits. Also, logging transports like scribe will likely write each span as a separate log line.

    This accepts a list of encoded spans, as opposed a list of spans like zipkin2.Span. This allows senders to be re-usable as model shapes change. This also allows them to use their most natural message type. For example, kafka would more naturally send messages as byte arrays.

    Since:
    3.0
    • Constructor Detail

      • Sender

        public Sender()
        Deprecated.
    • Method Detail

      • sendSpans

        @Deprecated
        public abstract Call<Void> sendSpans​(List<byte[]> encodedSpans)
        Deprecated.
        since 3.2, use BytesMessageSender instead. This will be removed in v4.0.
        Sends a list of encoded spans to a transport such as http or Kafka.
        Parameters:
        encodedSpans - list of encoded spans.
        Throws:
        IllegalStateException - if close was called.
      • send

        public void send​(List<byte[]> encodedSpans)
                  throws IOException
        Deprecated.
        Sends a list of encoded spans to a transport such as HTTP or Kafka.

        Empty input is permitted. While async reporters in this repository will always send a non-empty list. Some external callers might use an empty send for fail-fast checking. If you obviate empty lists, you might break them. See /RATIONALE.md for more.

        Specified by:
        send in interface BytesMessageSender
        Parameters:
        encodedSpans - a potentially empty list of encoded spans.
        Throws:
        IOException