Skip to content

Spring Cloud Sleuth 3.1 Migration Guide

Marcin Grzejszczak edited this page Nov 10, 2022 · 25 revisions

High-Level Overview

We've moved the API code from Sleuth to Micrometer Tracing. The Brave and OpenTelemetry bridges have their respective modules in Micrometer Tracing.

The Autoconfiguration of Brave and OpenTelemetry Tracer got moved to Spring Boot. So did autoconfiguration for Zipkin and Wavefront reporters for both tracers.

The default Tracer now is OpenTelemetry tracer, the default Trace Id format is 128 bit and default Context Propagation format is W3C.

The instrumentation code and its autoconfiguration got moved to respective projects (e.g. Web instrumentation is now in Spring Web and Spring Boot autconfigures that).

Spring Cloud Sleuth API migration

The whole Spring Cloud Sleuth API module got pretty much moved to Micrometer Tracing. That means that in the vast majority of places you should just change the package from org.springframework.cloud.sleuth to io.micrometer.tracing.

Autoconfiguration

Parts of the Spring Cloud Sleuth Autoconfigure and Spring Cloud Sleuth OTel Autoconfigure modules got moved to:

Instrumentations

You have to check each project for their Micrometer Observation configuration.

Async Instrumentation

Spring Cloud Sleuth came with a bunch of executor / executor service instrumentations that would propagate the tracing context together with a creation of a span. With the new releases of Micrometer we come to the conclusion that we have to separate those two approaches.

This is why we have the Context Propagation library that will propagate objects (thread locals) through various means of communication (you can read more about it in the Context Propagation Docs.

To wrap executors just use the ContextExecutorService.wrap() or ContextScheduledExecutorService.wrap() methods. You can also use ContextSnapshot.wrap() methods to wrap Runnables or Callables.

Samples

Spring Cloud Sleuth Samples got migrated to Micrometer Samples.

Clone this wiki locally