Class Collector

java.lang.Object
zipkin2.collector.Collector

public class Collector extends Object
This component takes action on spans received from a transport. This includes deserializing, sampling and scheduling for storage.

Callbacks passed do not propagate to the storage layer. They only return success or failures before storage is attempted. This ensures that calling threads are disconnected from storage threads.

  • Method Details

    • newBuilder

      public static Collector.Builder newBuilder(Class<?> loggingClass)
      Needed to scope this to the correct logging category
    • accept

      public void accept(List<zipkin2.Span> spans, zipkin2.Callback<Void> callback)
    • accept

      public void accept(List<zipkin2.Span> spans, zipkin2.Callback<Void> callback, Executor executor)
      Calls to get the storage component could be blocking. This ensures requests that block callers (such as http or gRPC) do not add additional load during such events.
      Parameters:
      executor - the executor used to enqueue the storage request.
    • acceptSpans

      public void acceptSpans(ByteBuffer encoded, zipkin2.codec.SpanBytesDecoder decoder, zipkin2.Callback<Void> callback, Executor executor)
      Like acceptSpans(byte[], BytesDecoder, Callback), except using a byte buffer.
    • acceptSpans

      public void acceptSpans(byte[] serialized, zipkin2.Callback<Void> callback)
      Before calling this, call CollectorMetrics.incrementMessages(), and CollectorMetrics.incrementBytes(int). Do not call any other metrics callbacks as those are handled internal to this method.
      Parameters:
      serialized - not empty message
    • acceptSpans

      public void acceptSpans(byte[] serializedSpans, zipkin2.codec.BytesDecoder<zipkin2.Span> decoder, zipkin2.Callback<Void> callback)
      Before calling this, call CollectorMetrics.incrementMessages(), and CollectorMetrics.incrementBytes(int). Do not call any other metrics callbacks as those are handled internal to this method.
      Parameters:
      serializedSpans - not empty message