Distributed tracing library - Custom trace id

830 Views Asked by At

As part of our spring application, we are using Spring Sleuth to inject traceid & spanid into the requests. This neatly works with SL4J via MDC integration to propagate to the logs as well.

But running into issues with our organization not using B3 headers that Sleuth is tightly coupled with. So looking at alternatives for using custom request header like "x-trace-id" that could be injected into the traces.

Our traceability is still via centralized logging like splunk. We do not yet have a centralized collector like zipkin & hence sampling is not relevant yet. So the immediate usecase is to ensure log traceability and once we have a central collector for tracing, hoping sampling is available out of the box to use.

1

There are 1 best solutions below

0
Jonatan Ivanov On

Sleuth is not tightly coupled with B3, it supports AWS, B3, W3C, and custom (B3 is the default): see the docs about Context Propagation

You can change the context propagation mechanism, see docs: How to Change The Context Propagation Mechanism?