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

标签 spring spring-boot opentracing jaeger

我目前正在尝试使用 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 请求上。 服务之间没有显示依赖关系,就像您在图像中看到的那样。

Missing App in trace between 2 Apps

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

您可以检查包含问题的简约项目 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/

相关文章:

istio - 方法调用的 Micronaut 和 OpenTracing

java - 我们可以避免将所有字段都映射到springdata中用于Elasticsearch的实体类,因为json文档中有100多个字段吗?

java - 使用 Spring Boot 2.0.2 进行 OpenTracing 不会在 Jaeger 中产生任何跟踪

spring - 自定义 Spring @Profile 注释

spring - JPA 事务未提交到数据库

spring - 是否有任何解决方法可以避免调用/刷新以重新加载客户端 spring boot 中的属性?

java - 为 Consul、网关和微服务配置 HTTPS 会导致 ZuulException : Forwarding error

log4j2 - 将 jaeger trace id 和 span id 添加到 log4j2 日志

spring - 所需的请求部分 'file' 不存在 - Angular2 发布请求

java - IntelliJ 中的 Spring 项目中的 gradle 存在 java 版本控制问题