Class Sender
- java.lang.Object
-
- zipkin2.reporter.Component
-
- zipkin2.reporter.Sender
-
- All Implemented Interfaces:
Closeable,BytesMessageSender
@Deprecated public abstract class Sender extends Component implements BytesMessageSender
Deprecated.since 3.2, useBytesMessageSenderinstead. 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 likezipkin2.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface zipkin2.reporter.BytesMessageSender
BytesMessageSender.Base
-
-
Constructor Summary
Constructors Constructor Description Sender()Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intmessageSizeInBytes(int encodedSizeInBytes)Deprecated.LikeBytesMessageSender.messageSizeInBytes(List), except for a single-span.voidsend(List<byte[]> encodedSpans)Deprecated.Sends a list of encoded spans to a transport such as HTTP or Kafka.abstract Call<Void>sendSpans(List<byte[]> encodedSpans)Deprecated.since 3.2, useBytesMessageSenderinstead.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface zipkin2.reporter.BytesMessageSender
encoding, messageMaxBytes, messageSizeInBytes
-
-
-
-
Method Detail
-
messageSizeInBytes
public int messageSizeInBytes(int encodedSizeInBytes)
Deprecated.LikeBytesMessageSender.messageSizeInBytes(List), except for a single-span. This is used to ensure a span is never accepted that can never be sent.Note this is not always
Encoding.listSizeInBytes(int), as some senders have inefficient list encoding. For example, Stackdriver's proto message contains other fields.- Specified by:
messageSizeInBytesin interfaceBytesMessageSender- Parameters:
encodedSizeInBytes- theencoded sizeof a span
-
sendSpans
@Deprecated public abstract Call<Void> sendSpans(List<byte[]> encodedSpans)
Deprecated.since 3.2, useBytesMessageSenderinstead. 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- ifclosewas 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:
sendin interfaceBytesMessageSender- Parameters:
encodedSpans- a potentially empty list of encoded spans.- Throws:
IOException
-
-