2

I need to implement Zipkin tracing in one java-based service which is using Project Reactor Kafka for reactive streams and non-blocking IO operations. I could not find any brave instrumentation library which supports reactive-Kafka.

The standard Kafka-client brave instrumentation:

https://github.com/openzipkin/brave/tree/master/instrumentation/kafka-clients

has no support for Reactive-Kafka.

Is there a library or repo which can help me with Zipkin tracing for reactive-Kafka in java?

ASHISH TEWARI
  • 75
  • 1
  • 6

1 Answers1

0

On my project, we generated the spans manually before sending the events.

var span = tracing.tracer().nextSpanWithParent(req -> true, Void.class, ctx.get(Span.class).context());

span.name("yourSpanName").start();

return sendEventPublisher.doOnError(span::error).doOnTerminate(span::finish);

This way, we also link the span to the publisher lifecycle as we had problems with webflux sharing spans between threads.

Basically, we create a span and link it to the parent context created by Spring for the request (either from an incoming B3 HTTP header, or generated if absent). "ctx" is the subscriber context here.

This also implied to tell sleuth not to generate the spans for async operations in application.properties:

spring.sleuth.async.enabled=false

Community
  • 1
  • 1
Sancho
  • 417
  • 4
  • 20