springspring-bootmicrometerspring-cloud-sleuthmicrometer-tracing

SpringBoot 3.2.4: sleuth.reactor.instrumentation-type: decorate-queues replacement in micrometer


How to migrate/replace the below sleuth property in spring boot 3 with micrometer tracing?

sleuth:
  reactor:
    instrumentation-type: decorate-queues

The application is a webflux project

On doing the spring boot 3 migration, could not find a proper one on one mapping for the above property in micrometer tracing. Looking to find a replacement.

Previously, the application was using sleuth dependency.

<dependency> 
<groupId>org.springframework.cloud</groupId> 
<artifactId>spring-cloud-starter-sleuth</artifactId> 
</dependency> 

Currently, the below micrometer tracing dependencies are added.

<dependency> 
<groupId>io.micrometer</groupId> 
<artifactId>micrometer-tracing-bridge-brave</artifactId> 
</dependency> 
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> 
</dependency>

Solution

  • TL;DR:
    Depending on your needs and the Boot version you use, you can either:

    1. Do nothing since there are some context propagation enabled by default
    2. Set spring.reactor.context-propagation to AUTO
    3. Use Hooks.enableAutomaticContextPropagation() for older versions of Boot 3.x

    I think you can get the behavior you want setting spring.reactor.context-propagation=AUTO.

    Details:
    Micrometer Tracing was born from the codebase of Spring Cloud Sleuth, but we removed the Spring bits, including the instrumentation, so that it can be used in any Java project. This means that the Reactor instrumentation (that lived in Spring Cloud Sleuth before) is now in Reactor. :)

    You can read about the Context Propagation support in the Reactor docs. Also, I recommend this series of blog posts by Dariusz: Context Propagation with Project Reactor. Boot offers auto-configuration and property support for this feature, you can read about it in the Observability section of the Spring Boot docs and in the Appendix about spring.reactor.context-propagation.