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 class
KafkaStreamsTracing.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KafkaStreamsTracing
create(KafkaTracing kafkaTracing)
static KafkaStreamsTracing
create(MessagingTracing messagingTracing)
static KafkaStreamsTracing
create(brave.Tracing tracing)
org.apache.kafka.streams.KafkaClientSupplier
kafkaClientSupplier()
Provides aKafkaClientSupplier
with tracing enabled, hence Producer and Consumer operations will be traced.org.apache.kafka.streams.KafkaStreams
kafkaStreams(org.apache.kafka.streams.Topology topology, Properties streamsConfig)
Creates aKafkaStreams
instance with a tracing-enabledKafkaClientSupplier
.static KafkaStreamsTracing.Builder
newBuilder(MessagingTracing messagingTracing)
static KafkaStreamsTracing.Builder
newBuilder(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 aKafkaClientSupplier
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, andKafkaClientSupplier
is accepted.
-
kafkaStreams
public org.apache.kafka.streams.KafkaStreams kafkaStreams(org.apache.kafka.streams.Topology topology, Properties streamsConfig)
Creates aKafkaStreams
instance 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
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-decoratedProcessorSupplier
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-decoratedFixedKeyProcessorSupplier
Simple example using Kafka Streams DSL:
StreamsBuilder builder = new StreamsBuilder(); builder.stream(inputTopic) .processValues(kafkaStreamsTracing.processValues("my-processor", myFixedKeyProcessorSupplier);
- See Also:
TracingKafkaClientSupplier
-
-