Search code examples
springspring-bootopentracingjaeger

Service dependencies not shown in Jaeger between Spring Boot Applications


I'm currently trying to trace two Spring Boot (2.1.1) applications with Jaeger using https://github.com/opentracing-contrib/java-spring-web

<dependency>
  <groupId>io.opentracing.contrib</groupId>
  <artifactId>opentracing-spring-web-starter</artifactId>
</dependency> 

also tryed with no success

<dependency>
  <groupId>io.opentracing.contrib</groupId>
  <artifactId>opentracing-spring-jaeger-cloud-starter</artifactId>
</dependency>

The tracing of the Spans for every single service / app works fine, but not over REST requests on a global level. There is no dependency shown between the services like you can see in the image.

Missing App in trace between 2 Apps

Shouldn't this work out of the box through the library? Or do I have to implement some interceptors and request filters by my own and if so, how?

You can CHECKOUT a minimalistic project containing the problem here

Btw: Jaeger runs as all-in-one via docker and works as expected

docker run \
--rm \
--name jaeger \
-p5775:5775/udp \
-p6831:6831/udp \
-p6832:6832/udp \
-p5778:5778 \
-p16686:16686 \
-p14268:14268 \
-p9411:9411 \
jaegertracing/all-in-one:latest

Solution

  • The problem is that you are using RestTemplate template = new RestTemplate(); to get an instance of the RestTemplate to make a REST call.

    Doing that means that Opentracing cannot instrument the call to add necessary HTTP headers.

    Please consider using @Autowired RestTemplate restTemplate