Class KafkaStreamsTracing


  • public final class KafkaStreamsTracing
    extends Object
    Use this class to decorate Kafka Stream Topologies and enable Tracing.
    • Method Detail

      • kafkaClientSupplier

        public org.apache.kafka.streams.KafkaClientSupplier kafkaClientSupplier()
        Provides a KafkaClientSupplier with tracing enabled, hence Producer and Consumer operations will be traced.

        This is meant to be used in scenarios KafkaStreams creation is not controlled by the user but framework (e.g. Spring Kafka Streams) creates it, and KafkaClientSupplier is accepted.

      • kafkaStreams

        public org.apache.kafka.streams.KafkaStreams kafkaStreams​(org.apache.kafka.streams.Topology topology,
                                                                  Properties streamsConfig)
        Creates a KafkaStreams instance with a tracing-enabled KafkaClientSupplier. All Topology Sources and Sinks (including internal Topics) will create Spans on records processed (i.e. send or consumed).

        Use this instead of KafkaStreams constructor.

        Simple example:

        
         // KafkaStreams with tracing-enabled KafkaClientSupplier
         KafkaStreams kafkaStreams = kafkaStreamsTracing.kafkaStreams(topology, streamsConfig);
         
        See Also:
        TracingKafkaClientSupplier
      • process

        public <KIn,​VIn,​KOut,​VOut> org.apache.kafka.streams.processor.api.ProcessorSupplier<KIn,​VIn,​KOut,​VOut> process​(String spanName,
                                                                                                                                                           org.apache.kafka.streams.processor.api.ProcessorSupplier<KIn,​VIn,​KOut,​VOut> processorSupplier)
        Create a tracing-decorated ProcessorSupplier

        Simple example using Kafka Streams DSL:

        
         StreamsBuilder builder = new StreamsBuilder();
         builder.stream(inputTopic)
                .process(kafkaStreamsTracing.process("my-processor", myProcessorSupplier);
         
        See Also:
        TracingKafkaClientSupplier
      • processValues

        public <KIn,​VIn,​VOut> org.apache.kafka.streams.processor.api.FixedKeyProcessorSupplier<KIn,​VIn,​VOut> processValues​(String spanName,
                                                                                                                                                   org.apache.kafka.streams.processor.api.FixedKeyProcessorSupplier<KIn,​VIn,​VOut> processorSupplier)
        Create a tracing-decorated FixedKeyProcessorSupplier

        Simple example using Kafka Streams DSL:

        
         StreamsBuilder builder = new StreamsBuilder();
         builder.stream(inputTopic)
                .processValues(kafkaStreamsTracing.processValues("my-processor", myFixedKeyProcessorSupplier);
         
        See Also:
        TracingKafkaClientSupplier