Search code examples
zipkinspring-cloud-sleuth

How to pass the traceid, spanid in threads used in threadpool in zipkin?


I am using zipkin to track the requests across microservices. One of my service is running jobs using a thread pool. How do I transfer the zipkin header values to the threads? is there a Zipkin wrapped thread pool/executor available?


Solution

  • We have a LazyTraceExecutor that you can use - https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceExecutor.java .