Search code examples
spring-cloudspring-cloud-sleuth

Spring Sleuth Tracer not there in spring-cloud-sleuth - What is the alternative?


I have used org.springframework.cloud.sleuth.Tracer (1.3.x) to get the current Span and Trace ids. It looks like the 2.x releases of spring-cloud-sleuth-core got rid of it and after a lot of search no replacement is obvious. Please help.


Solution

  • Sleuth 2.x was built on top of Brave. You can check the 1.3 -> 2.x Migration Guide to see how to migrate.

    To answer your exact question: Sleuth's Tracer was replaced to brave.Tracer, you can inject and use it.

    Please notice that Sleuth 3.x has been already released, there is a 2.x -> 3.x Migration-Guide. In 3.0, Sleuth abstracts the tracing libraries away so there is a Sleuth Tracer in 3.x.

    I suggest to upgrade to the latest version of Sleuth (this also means upgrading to the lates Spring Boot and Spring Cloud too).