Spring 启动应用程序之间的 Jaeger 中未显示服务依赖项
Service dependencies not shown in Jaeger between Spring Boot Applications
我目前正在尝试使用 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>
也试过没有成功
<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
您能否尝试使用更新版本的 Jaeger:https://www.jaegertracing.io/docs/latest/getting-started/#all-in-one - 实际上 1.11 现已发布,所以可以试试。
问题是您正在使用 RestTemplate template = new RestTemplate();
获取 RestTemplate
的实例以进行 REST 调用。
这样做意味着 Opentracing 无法检测添加必要 HTTP 的调用 headers。
请考虑使用@Autowired RestTemplate restTemplate
我目前正在尝试使用 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>
也试过没有成功
<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
您能否尝试使用更新版本的 Jaeger:https://www.jaegertracing.io/docs/latest/getting-started/#all-in-one - 实际上 1.11 现已发布,所以可以试试。
问题是您正在使用 RestTemplate template = new RestTemplate();
获取 RestTemplate
的实例以进行 REST 调用。
这样做意味着 Opentracing 无法检测添加必要 HTTP 的调用 headers。
请考虑使用@Autowired RestTemplate restTemplate