我目前正在尝试使用 Jaeger 使用 https://github.com/opentracing-contrib/java-spring-web 跟踪两个 Spring Boot (2.1.1) 应用程序
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-web-starter</artifactId>
</dependency>
也试过没有成功
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-jaeger-cloud-starter</artifactId>
</dependency>
每个服务/应用程序的跨度跟踪工作正常,但不是在全局级别的 REST 请求上。 服务之间没有显示依赖关系,就像您在图像中看到的那样。
这不应该通过图书馆开箱即用吗?或者我是否必须自己实现一些拦截器和请求过滤器,如果是这样,怎么做?
您可以检查包含问题的简约项目 here
顺便说一句: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
最佳答案
问题是您正在使用 RestTemplate template = new RestTemplate();
获取 RestTemplate
的实例以进行 REST 调用。
这样做意味着 Opentracing 无法检测调用以添加必要的 HTTP header 。
请考虑使用@Autowired RestTemplate restTemplate
关于spring - Spring Boot 应用程序之间的 Jaeger 中未显示服务依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55239593/