Package brave.kafka.streams
Class KafkaStreamsTracing
- java.lang.Object
-
- brave.kafka.streams.KafkaStreamsTracing
-
public final class KafkaStreamsTracing extends Object
Use this class to decorate Kafka Stream Topologies and enable Tracing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKafkaStreamsTracing.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KafkaStreamsTracingcreate(KafkaTracing kafkaTracing)static KafkaStreamsTracingcreate(MessagingTracing messagingTracing)static KafkaStreamsTracingcreate(brave.Tracing tracing)org.apache.kafka.streams.KafkaClientSupplierkafkaClientSupplier()Provides aKafkaClientSupplierwith tracing enabled, hence Producer and Consumer operations will be traced.org.apache.kafka.streams.KafkaStreamskafkaStreams(org.apache.kafka.streams.Topology topology, Properties streamsConfig)Creates aKafkaStreamsinstance with a tracing-enabledKafkaClientSupplier.static KafkaStreamsTracing.BuildernewBuilder(MessagingTracing messagingTracing)static KafkaStreamsTracing.BuildernewBuilder(brave.Tracing tracing)<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-decoratedProcessorSupplier<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-decoratedFixedKeyProcessorSupplier
-
-
-
Method Detail
-
create
public static KafkaStreamsTracing create(brave.Tracing tracing)
-
create
public static KafkaStreamsTracing create(MessagingTracing messagingTracing)
- Since:
- 5.10
-
create
public static KafkaStreamsTracing create(KafkaTracing kafkaTracing)
- Since:
- 5.9
-
newBuilder
public static KafkaStreamsTracing.Builder newBuilder(brave.Tracing tracing)
- Since:
- 5.10
-
newBuilder
public static KafkaStreamsTracing.Builder newBuilder(MessagingTracing messagingTracing)
- Since:
- 5.10
-
kafkaClientSupplier
public org.apache.kafka.streams.KafkaClientSupplier kafkaClientSupplier()
Provides aKafkaClientSupplierwith tracing enabled, hence Producer and Consumer operations will be traced.This is meant to be used in scenarios
KafkaStreamscreation is not controlled by the user but framework (e.g. Spring Kafka Streams) creates it, andKafkaClientSupplieris accepted.
-
kafkaStreams
public org.apache.kafka.streams.KafkaStreams kafkaStreams(org.apache.kafka.streams.Topology topology, Properties streamsConfig)Creates aKafkaStreamsinstance with a tracing-enabledKafkaClientSupplier. All Topology Sources and Sinks (including internal Topics) will create Spans on records processed (i.e. send or consumed).Use this instead of
KafkaStreamsconstructor.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-decoratedProcessorSupplierSimple 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-decoratedFixedKeyProcessorSupplierSimple example using Kafka Streams DSL:
StreamsBuilder builder = new StreamsBuilder(); builder.stream(inputTopic) .processValues(kafkaStreamsTracing.processValues("my-processor", myFixedKeyProcessorSupplier);- See Also:
TracingKafkaClientSupplier
-
-