0
votes

We incorporated spring cloud sleuth (1.1.3 RELEASE) in our spring boot 1.x application and had no problems with header propagation over rest.

However we upgraded our application to spring boot 2.0.4 and added cloud sleuth 2.0.1 RELEASE. Now, trace and Span Ids are not propagated over rest calls.

Debug points inside of B3Propagation and TracingClientHttpRequestInterceptor are not being invoked at all.

Has something changed in the newer versions of sleuth or is any additional configuration required for the TracingClientHttpRequestInterceptor?

Any pointers would be greatly appreciated.

Thanks.

2

2 Answers

2
votes

In your bean you need to inject the interceptor, for example with a RestTemplateBuilder:

@Bean public RestTemplateBuilder clientRestTemplateBuilder(TracingClientHttpRequestInterceptor tracingClientHttpRequestInterceptor) { return new RestTemplateBuilder() .additionalInterceptors(tracingClientHttpRequestInterceptor) .(additional config); }

0
votes

This was happening because the rest template was not available at the time of hooking the TracingClientHttpRequestInterceptor. (was created much before the injection)

Changing the way the rest template was being injected fixed this issue. Thanks.