【问题标题】:Spring boot 2.0 and Spring Cloud Sleuth 2.x Working SampleSpring boot 2.0 和 Spring Cloud Sleuth 2.x 工作示例
【发布时间】:2018-08-03 02:17:26
【问题描述】:

我一直试图让 Spring boot 2.0 和 Spring Cloud Slueth 2.x (POM=>Finchley.M6) 工作,但无济于事。我有一个service1 呼叫service2service3。我看到每当在service1 中收到请求但未传递给Service2Service3 时都会创建一个新的traceId,而是每次在Service2Service3 上创建一个新的traceid

这是否与 this defect 相关?

注意:我不需要 zipkin 支持,我需要 sleuth 来进行分布式跟踪,并将使用 Splunk 作为日志聚合器。

源代码https://github.com/trmsmy/springboot-cloud-examples/tree/springboot2

【问题讨论】:

  • 我正在尝试将我的示例发布到 github,当我拥有它时会更新摘要。同样的例子适用于 Spring boot 1.5.x 版本和 spring-cloud 1.x 版本。
  • 你可以试试最新的快照吗?
  • @MarcinGrzejszczak 所以我更新了 Spring Boot 和 Cloud 的最新快照。还是一样的结果。可以在此处找到日志 - gist.github.com/trmsmy/322beeb245183466b1c2b4181c7e77a4 看起来标头 X-B3-Sampled=0 正在使此日志“收到不应采样的 uri [/service2] 请求 [true]”,每当发生这种情况时,调用方不使用 TraceID。

标签: spring spring-cloud spring-cloud-sleuth


【解决方案1】:

这是一个通过此提交修复的错误 - https://github.com/spring-cloud/spring-cloud-sleuth/commit/d7a0747907f4ab7201f67e7d0c762a324fbe0668 。请查看最新快照

【讨论】:

  • 使用 Finchley.BUILD-SNAPSHOT 版本的 spring cloud sleuth 的 feign 客户端仍然会发生这种情况。如果我打开日志记录,我会看到没有发送标头,并且为下游服务调用创建了一个新的跟踪 ID。就我而言,尽管我根据cloud.spring.io/spring-cloud-netflix/multi/… 在构建器上使用“目标”方法手动创建了一个假装客户端
猜你喜欢
  • 2023-02-03
  • 2018-07-22
  • 2017-09-13
  • 1970-01-01
  • 2021-12-30
  • 1970-01-01
  • 2021-07-28
  • 2018-08-29
  • 2022-11-14
相关资源
最近更新 更多