Class KafkaTracing


  • public final class KafkaTracing
    extends Object
    Use this class to decorate your Kafka consumer / producer and enable Tracing.
    • Method Detail

      • 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 a Span.Kind.CONSUMER span for each message received. This span is injected onto each message so it becomes the parent when a processor later calls nextSpan(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 propagates Span.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.