Spring boot 3 issue with micrometer tracing with handling Traceparent header
14:00 24 Jan 2023

I have below code which handle requests from other apps which pass the traceId through Traceparent header. I expect it will hydrate the parent traceId from the request, and in zipkin dashboard I should see the connection between this app and other apps. It used to work with spring-cloud-sleuth-zipkin. Now I migrated to spring boot 3 and the package is changed to micrometer-tracing-bridge-otel (See pom.xml). Now it no longer hydrate the parent traceId from the request but generate a default parent traceId which is all 0 instead, causing the app to disconnect from other apps in the zipkin dashboard

I tested with a simple curl request with the header Traceparent: curl --location --request GET 'http://localhost:8080/test' --header 'Traceparent: 00-63cf0173620c57b0aed605ee94255089-1444ca74c3d2133a-01' but this code does not extract the parent context from the header. Any idea how to make this work?

@RestController
public class Test {

    @Autowired
    private Tracer tracer;

    @GetMapping(path="/test")
    public ResponseEntity handleTest() {
        ScopedSpan span = tracer.startScopedSpan("test span");
        return ResponseEntity.ok();
    }
}

pom.xml

    
        org.springframework.boot
        spring-boot-starter-parent
        3.0.2
    

        
            io.micrometer
            micrometer-tracing-bridge-otel
        
        
            io.opentelemetry
            opentelemetry-exporter-zipkin
        
        
            io.zipkin.reporter2
            zipkin-sender-urlconnection
        

spring-boot spring-cloud-sleuth micrometer spring-micrometer micrometer-tracing