Package brave.kafka.clients
Class KafkaTracing
- java.lang.Object
-
- brave.kafka.clients.KafkaTracing
-
public final class KafkaTracing extends Object
Use this class to decorate your Kafka consumer / producer and enable Tracing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KafkaTracing.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.CONSUMER
span for each message received.static KafkaTracing
create(MessagingTracing messagingTracing)
static KafkaTracing
create(Tracing tracing)
MessagingTracing
messagingTracing()
static KafkaTracing.Builder
newBuilder(MessagingTracing messagingTracing)
static KafkaTracing.Builder
newBuilder(Tracing tracing)
Span
nextSpan(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.PRODUCER
span for each message sent.KafkaTracing.Builder
toBuilder()
-
-
-
Method Detail
-
create
public static KafkaTracing create(Tracing tracing)
-
create
public static KafkaTracing create(MessagingTracing messagingTracing)
- Since:
- 5.9
-
newBuilder
public static KafkaTracing.Builder newBuilder(Tracing tracing)
-
newBuilder
public static KafkaTracing.Builder newBuilder(MessagingTracing messagingTracing)
- Since:
- 5.9
-
toBuilder
public KafkaTracing.Builder toBuilder()
- Since:
- 5.10
-
messagingTracing
public MessagingTracing messagingTracing()
- Since:
- 5.9 exposed for Kafka Streams 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.CONSUMER
span 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.PRODUCER
span for each message sent.
-
nextSpan
public 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.
-
-