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
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.2</version>
</parent>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-otel</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-sender-urlconnection</artifactId>
</dependency>