Spring Boot 3 is not creating spans based on Traceparent Header

518 views Asked by At

I have a Go service and a Spring Boot 3 service. The Go service is instrumented with Opentelementry and sending it's HTTP requests with the Traceparent header for example: Traceparent:"00-60ddd5aefce1d5112a8570f92d937877-2780e8b27b08b56e-01" My Spring Boot service gets receives the request and in my logs I can see the Traceparent Header but Micrometer Tracing is not using this to further trace. Instead it generated a new trace and a new span. For example: 654273465a1653427f44840dc3229a3d and 7b78e9d60790e95d I am using Google Cloud Trace with the Spring Boot Starter GCP Dependencies. Within the GCP Console I can see both traces but my expectation would be one trace across both services.

I've already gone ultra verbose in my yaml by specifiing everthin related to tracing explicitly:

management:
  tracing:
    sampling:
      probability: 1.0
    propagation:
      type: w3c
      consume: w3c
      produce: w3c
    enabled: true
    baggage:
      correlation:
        enabled: true
      remote-fields: traceId,spanId,traceparent,tracestate

I've tried different solutions I had found online like https://programmingtechie.com/2023/09/09/spring-boot3-observability-grafana-stack/ and https://stacktobasics.com/adding-correlation-ids-to-easily-track-down-errors-spring-boot-3-edition#heading-adding-a-simple-controller-and-service which always seems to be really simple. I couldn't also find nothing special in the Micrometer Samples which could help.

My Controller looks like this:

@Slf4j
@RestController
public class ServiceAController {
    private final ServiceA service;


    public ServiceAController(ServiceA service) {
        this.service = service;
    }

    @PostMapping(path = Routes.routeA)
    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    public Response callServiceA(
            @Validated @RequestBody RequestDTO request,
            @RequestHeader Map<String, String> headers
    ) {
        headers.forEach((key, value) -> log.info("Header '{}': {}", key, value));
        log.info("Request on route: {}", Routes.routeA);
        return service.process(request);
    }

}

What am I missing? Does the Spring Cloud GCP Tracing Dependency not support traces across multiple services?

0

There are 0 answers