Skip to content

spring_json_header_types not updated with tracing header types after migration from Sleuth to Micrometer #2905

Closed as not planned
@dharezlak

Description

@dharezlak

Describe the issue
After migrating from Spring Boot 2.7.x to Spring Boot 3.x.x the spring_json_header_types header is no longer updated with the types of the tracing headers such as b3 or traceparent or any of the baggage headers with the Kafka binder. With Sleuth we used to see the following Kafka message headers:

  • b3: d501ea8b2acdcd56-1f7c7b3a48f28941-0
  • scst_partition: 1
  • baggagesample: baggageValue
  • spring_json_header_types: {"b3":"java.lang.String","scst_partition":"java.lang.Integer","baggagesample":"java.lang.String"}

With micrometer we see the following:

  • b3: 65cf4648a9deb2968c23a2070084596e-f2194f78ae26054d-0-8c23a2070084596e
  • scst_partition: 1
  • baggagesample: baggageValue
  • baggage: baggageSample=baggageValue
  • spring_json_header_types: {"scst_partition":"java.lang.Integer"}

As you can see the tracing header types are missing in the spring_json_header_types header value which changes how this message can be consumed which in turn breaks our consumers and we run into type mapping issues.

To Reproduce
Steps to reproduce the behavior:

  • Use the latest Spring Boot 3.2.x app to publish with Spring Cloud Stream (using e.g. StreamBridge) with micrometer tracing enabled, e.g.:
@PostMapping("/")
    public Mono<Void> test() {
        return Mono.fromRunnable(() -> {
            try (BaggageInScope scope = tracer.createBaggageInScope("baggageSample", "baggageValue")) {
                streamBridge.send("output", MessageBuilder
                        .withPayload(Map.of("hello", "world"))
                        .build());
            }
        });
    }

Version of the framework
Spring Boot 3.2.2 with 2023.0.0 Cloud dependencies (including Spring Cloud Stream)

Expected behavior
spring_json_header_types contains all the tracing header types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions