【问题标题】:LEGACY_HEADER_MAPPING removed from spring-cloud-sleuth-instrumentation from Spring Cloud 2020.0.0 (aka Ilford) BWC issueLEGACY_HEADER_MAPPING 从 Spring Cloud 2020.0.0(又名 Ilford)BWC 问题的 spring-cloud-sleuth-instrumentation 中删除
【发布时间】:2021-07-16 06:31:23
【问题描述】:

我们在项目中迁移到最新的 Spring Cloud 2020.0.0(又名 Ilford),当 Brave Trace Id(spanTraceId、spanId 等)传递给 Kafka 消息时,TracingChannelInterceptor 不会提取它,因为新的 Jar spring-cloud-sleuth -instrumentation 从 MessageHeaderPropagatorGetter 中删除了对 LEGACY_HEADER_MAPPING 的处理。

之前我们使用 Spring-cloud-sleuth-core jar MessageHeaderPropagation.java 来处理 spanId、SpanTraceId 等的提取值...

核心2.2.X的old extract file

New extract file 用于 slueth 3.X。

如何在 Spring Cloud 2020.0.0(又名 Ilford)中处理这些遗留的 spanId、spanTraceId 提取?

【问题讨论】:

    标签: spring-cloud-stream spring-cloud-sleuth spring-cloud-stream-binder-kafka


    【解决方案1】:

    你不能。这是一个重大变化——我们不再支持标题中的“X-B3_TraceId”。您需要使用新的“traceId”方法

    【讨论】:

    • 我们有 2 个应用程序 1 使用 sleuth 1.2.5 和其他使用 3.0 。我们需要传播(通过 Spring 云流和 Kafka 消息)spanId 和 spanTraceId 从旧到新,因为 1.2.5 不知道 X-B3 字段,所以我正在创建自定义 ChannelInterceptor 来传递 X-B3 字段。这是正确的方法吗?或 Spring 提供一些桥接或配置,以便 sleuth 1.2.5 可以将 spanId、spanTraceId... 和 X-B3 字段传递给具有 sleuth 3.0 的新应用程序?
    • 在 Spring Cloud Sleuth 2.x 中不推荐使用标头的情况就是如此。在 Sleuth 3.x 中,我们删除了这些标头
    猜你喜欢
    • 2021-04-20
    • 2022-05-24
    • 1970-01-01
    • 2021-04-28
    • 2016-11-23
    • 2021-09-06
    • 2017-10-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多