spring-cloud-sleuth 与第三方服务的服务集成

spring-cloud-sleuth services integration with 3rd party services

我有几个微服务:A 和 B。A 调用 B,B 调用一些外部服务。 A 和 B 使用 Sleuth。 Sleuth 定义了 header X-B3-TraceId 和 X-B3-SpanId。

因此 A 将 headers 传播给 B,B 传播给外部服务...

问题:服务 B 是否存储他的 headers 直到响应?如果外部服务以某种方式破坏了我的 headers 并且作为响应我将在 headers 中得到错误的 ids... 会发生什么? 定义我自己的 headers 以避免此类冲突会更好吗?与外部服务交互的最佳方式是什么?

Question: does service B stores his headers till response? I don't really follow but I assume that the question is that if the response comes back and some additional processing takes place, whether the tracing information will be kept. The answer is yes, it will be propagated.

And if external service somehow breaks my headers and as a response I will get wrong ids in headers... what would happen?

回复headers对我们来说并不重要。请求的包含所有跟踪信息。外部服务不会在您的系统内部看到,因为您不会从他们那里获得 SR 和 SS 注释到您的 Zipkin 实例。所以在向他们发送请求后,你显然不知道他们那边发生了什么。

Would is be better to define my own headers to avoid such kind of collisions? What is the best way to interact with external service?

我想我已经设法通过解释请求 headers 很重要而不是回应来回应它。