opentracing-contrib / java-kafka-client

OpenTracing Instrumentation for Apache Kafka Client
Apache License 2.0
125 stars 64 forks source link

Get current trace scope for calling span.log() with opentracing-kafka-streams? #68

Open kevinhooke opened 4 years ago

kevinhooke commented 4 years ago

If I pass TracingKafkaClientSupplier into new KafkaStreams(), e.g.

KafkaStreams streams = new KafkaStreams(builder.build(), this.properties, kafkaClientSupplier);

.. how can I get hold of the current/parent/root span in order to add calls to span.log() in my code? At best I have 1 trace across producers and consumers underneath my Stream which looks like it's constructed by TracingKafkaClientSupplier , and then in an attempt to create new spans in order to call span.log() I end up with another separate trace with my log spans in it. What I'm expecting to see is a single trace with the spans from the producers and consumers, and my calls to span.log() in the same trace, but I can't work out how to get this working?