Jaeger 中未显示 Spring Boot 应用程序之间的服务依赖项

Xea*_*ear 2 spring spring-boot opentracing jaeger

我目前正在尝试使用https://github.com/opentracing-contrib/java-spring-web使用 Jaeger 跟踪两个 Spring Boot (2.1.1) 应用程序

<dependency>
  <groupId>io.opentracing.contrib</groupId>
  <artifactId>opentracing-spring-web-starter</artifactId>
</dependency> 
Run Code Online (Sandbox Code Playgroud)

也试过没有成功

<dependency>
  <groupId>io.opentracing.contrib</groupId>
  <artifactId>opentracing-spring-jaeger-cloud-starter</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)

跟踪每个服务/应用程序的 Span 工作正常,但不能在全局级别超过 REST 请求。正如您在图像中看到的那样,服务之间没有显示任何依赖关系。

在 2 个应用程序之间的跟踪中缺少应用程序

这不应该通过图书馆开箱即用吗?或者我是否必须自己实现一些拦截器和请求过滤器,如果是这样,如何实现?

您可以在 此处查看包含问题的简约项目

顺便说一句:Jaeger 通过 docker 作为一体机运行并按预期工作

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
Run Code Online (Sandbox Code Playgroud)

geo*_*and 5

问题是您正在使用RestTemplate template = new RestTemplate();获取 的实例RestTemplate来进行 REST 调用。

这样做意味着 Opentracing 无法检测调用以添加必要的 HTTP 标头。

请考虑使用 @Autowired RestTemplate restTemplate