0

I have a spring application that accepts long-lived connections - each request starts a kafka consumer, which then writes consumed and processed messages to a requesting client. Each consumed kafka message contains sleuth tracing headers, e.g:

X-B3-TraceId===>efe036b5569eb25d
X-B3-SpanId===>1a31eeb97e01b0a8
X-B3-ParentSpanId===>f9ced586d6d47db1
X-B3-Sampled===>0

However, because kafka consumer is generated dynamically on incoming request, each incoming request generates another set of span/id.

As a result, all logs generated during processing kafka messages before they are pushed to the client are traced with a trace/span of the request, which in my case is not desired. I'd like to be able to see traces of the kafka message instead so one could easily track flow of a message. Is it possible to enforce sleuth to use tracing from consumed messages instead of the connection's one?

Nav
  • 437
  • 1
  • 8
  • 16

1 Answers1

0

you can just overwrite them to MDC to be whatever you want

neorus
  • 477
  • 1
  • 6
  • 19