micrometer-metrics / tracing

Provides tracing abstractions over tracers and tracing system reporters.
https://micrometer.io
Apache License 2.0
247 stars 45 forks source link

How to migrate so that our Spring Boot 3 works with the multitude of Spring Boot 2.x in our network #272

Closed jmart1 closed 1 year ago

jmart1 commented 1 year ago

We upgraded one of our apps to Spring Boot 3. Now the tracing is no longer working. We looked at the migration guide, but the guide doesn't really give steps for how to get our upgraded app to work as it was before. Remember, apps get upgraded one at a time in a network that typically contains many more Spring Boot apps. So it has to work with all the existing apps that are not in Spring Boot 3.

How can I get our newly upgraded Spring Boot 3 app to do the same exact thing it did before so that it works as expected with the many Spring Boot 2.x apps? I'm referring to the tracing ID (with span and parent IDs) being generated or passed along on all inbound REAST API requests and all outbound RestTemplate API calls.

jmart1 commented 1 year ago

Doing this partially worked. https://stackoverflow.com/a/76373792/1490322

We are able to now see the traces logged on the upgraded app. But, calls from the upgraded app to the non-upgraded, do not lead to the older app using the trace from the upgraded app. Maybe the RestTemplate client is not sending it. Or it is sending the trace info, but not in a format that the older app understands.

shakuzen commented 1 year ago

It sounds like your Spring Boot 2 / Sleuth applications may not be extracting the tracing context that is being propagated by the Spring Boot 3 apps. Have you seen the section in the migration guide on Context Propagation?

kioyong commented 1 year ago

Hi @jmart1 ,i have similar issue when upgrade to SpringBoot 3.1.x, please find below my config change when upgrade to 3.x hope can help you~

SpringBoot 2.7.x config:

spring:
  sleuth:
    baggage:
      correlation-enabled: true
      correlation-fields: testId
      remote-fields: testId
    propagation:
      type: CUSTOM #B3,W3C e.tc

dependency:

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

Spring Boot 3.1.x config:

management:
  tracing:
    enabled: true
    baggage:
      correlation:
        enabled: true
        fields: testId
      remote-fields: testId
    propagation:
      type: B3

dependency:

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

i am using OpenFeign to call downstream SpringBoot client and need to do additional step

marcingrzejszczak commented 1 year ago

I don't see anything happening in the issue so I'll close it.