Sleuth instrumentation of Spring cloud stream messages is lost when using zipkin + kafka

I have the following setup :

There used to be a StreamEnvironmentPostProcessor that did the job of adding the trace headers to the kafka bindings when I included the spring-cloud-sleuth-stream dependendy in the past. But the doc clearly states now :

Note: spring-cloud-sleuth-stream is deprecated and incompatible with these destinations

What should I do to make this work properly now ? Add the headers to the bindings configuration myself ? Or is there something I'm missing ?

Upvotes: 1

Views: 871

Answers (1)

Marcin Grzejszczak
Marcin Grzejszczak

Reputation: 11189

That was a bug in Spring Cloud Sleuth in Edgware. The Stream Kafka Binder in Edgware required explicit passing of headers that should get propagated. The side effect of adding sleuth-stream on the classpath was exactly that feature. By fixing the https://github.com/spring-cloud/spring-cloud-sleuth/issues/1005 issue we're adding back the missing feature to core. This is not ported to Finchley since Stream Kafka Binder in Finchley passes all headers by default.

The workaround for Edgware is to pass a list of headers in the following manner:

spring:
  cloud:
    stream:
      kafka:
        binder:
          headers:
            - spanId
            - spanSampled
            - spanProcessId
            - spanParentSpanId
            - spanTraceId
            - spanName
            - messageSent

Upvotes: 1

Related Questions