0

I started the migration of a service to SpringBoot 3 and now I have a problem code that used org.springframework.cloud.sleuth.instrument.web.mvc.TracingInterceptor

 restTemplate.getInterceptors().add(0,tracingInterceptor);

I didn't find the analogy of org.springframework.cloud.sleuth.instrument.web.mvc.TracingInterceptor in the new Micrometer Tracing API. How to propagate traceId and spanId during calls to other services with restTemplate?

Sonka
  • 92
  • 5
  • I believe this is already auto configured https://github.com/spring-projects/spring-boot/blob/26e39b26f59f77eef3c3efaaee72dd4c2505a667/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/RestTemplateObservationConfiguration.java#L44 – spencergibb Feb 01 '23 at 22:04

1 Answers1

0

RestTemplate is natively using micrometer observation api. You don't need to add anything on RestTemplate to have observability

Marcin Grzejszczak
  • 10,624
  • 1
  • 16
  • 32