使用 B3 / Zipkin 和 Spring Cloud Sleuth 传播行李

Propagating Baggage using B3 / Zipkin and Spring Cloud Sleuth

我了解到随着 Spring Cloud Sleuth 3.x.x 的出现,您需要指定要传播到远程组件的行李名称 headers,如下所示:

# in application.yaml

spring:
  sleuth:
    baggage:
      remote-fields: <name of the header>

对于自定义 headers 我认为这很好。我想知道如果应该转移行李,B3 / Zipkin 会是什么样子。

我记得有一个discussion about B3 not specifying baggage,但也有一种“约定”,转发前缀为baggage-的字段。

问题 1:这是否正确,是否仍然如此,或者是否已在 Sleuth 3.x.x 中删除?

问题 2: 如果它被删除,是否意味着对于 B3 / Zipkin 行李 headers 应用程序转发将始终必须是 显式 使用 remote-fields 属性?

指定

问题 3:Sleuth 如何处理标准化行李 headers,例如W3C Trace Context Baggage。它们是自动转发的,还是需要使用 remote-fields?

明确指定

谢谢!

Question 1: Is this correct, and is it still the case, or was that removed in Sleuth 3.x.x?

我们不再为行李添加 baggage-baggage_ 前缀。无论您设置为行李(例如 foo)都将按原样设置在 headers.

Question 2: If it was removed, does that mean that for B3 / Zipkin the baggage headers an application forwards will always have to be explicitly specified using the remote-fields property?

是的。

Question 3: How are standardized baggage headers treated by Sleuth, e.g. W3C Trace Context Baggage. Are they forwarded automatically, or do they need to be explicitly specified using remote-fields?

自动转发。查看文档的这一部分以获取更多信息 https://docs.spring.io/spring-cloud-sleuth/docs/current/reference/html/howto.html#how-to-change-context-propagation