Package brave.kafka.clients
Class KafkaTracing
- java.lang.Object
-
- brave.kafka.clients.KafkaTracing
-
public final class KafkaTracing extends java.lang.ObjectUse this class to decorate your Kafka consumer / producer and enable Tracing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKafkaTracing.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <K,V>
org.apache.kafka.clients.consumer.Consumer<K,V>consumer(org.apache.kafka.clients.consumer.Consumer<K,V> consumer)Extracts or creates aSpan.Kind.CONSUMERspan for each message received.static KafkaTracingcreate(brave.Tracing tracing)static KafkaTracing.BuildernewBuilder(brave.Tracing tracing)brave.SpannextSpan(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record)Use this to create a span for processing the given record.<K,V>
org.apache.kafka.clients.producer.Producer<K,V>producer(org.apache.kafka.clients.producer.Producer<K,V> producer)Starts and propagatesSpan.Kind.PRODUCERspan for each message sent.
-
-
-
Method Detail
-
create
public static KafkaTracing create(brave.Tracing tracing)
-
newBuilder
public static KafkaTracing.Builder newBuilder(brave.Tracing tracing)
-
consumer
public <K,V> org.apache.kafka.clients.consumer.Consumer<K,V> consumer(org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Extracts or creates aSpan.Kind.CONSUMERspan for each message received. This span is injected onto each message so it becomes the parent when a processor later callsnextSpan(ConsumerRecord).
-
producer
public <K,V> org.apache.kafka.clients.producer.Producer<K,V> producer(org.apache.kafka.clients.producer.Producer<K,V> producer)
Starts and propagatesSpan.Kind.PRODUCERspan for each message sent.
-
nextSpan
public brave.Span nextSpan(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record)
Use this to create a span for processing the given record. Note: the result has no name and is not started.This creates a child from identifiers extracted from the record headers, or a new span if one couldn't be extracted.
-
-