我正在使用 spring Cloud openFeign 来从 service#1 向 service#2 发出请求
当我使用restTemplate时,我可以在jaeger跟踪中正确地看到2个请求。但是当使用 openFeign 时我只看到 1 个请求。有没有办法整合jaeger和openFeign?
我发现了这个:
https://www.baeldung.com/spring-cloud-openfeign
https://github.com/OpenFeign/feign-opentracing
最佳答案
spring-cloud-openfeign
因为来自 spring-cloud 系列,一旦添加 opentracing-spring-jaeger-cloud-starter
,就应该自动检测,如所述 here 。
但有时(取决于您创建 Feign 客户端 bean 的方式)您需要显式地将 bean 暴露给 spring 上下文,以便自动配置可以检测您的 Feign 客户端。
类似这样的事情:
@Scope("prototype")
fun feignClient() : Client {
return Client.Default(null, null)
}
它是 kotlin,但你可以适应。
关于java - jaeger 跟踪和 Spring Cloud OpenFeign,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58504344/