Skip to content

Kafka ProducerRecord may end up with duplicated trace headers #3786

Closed
@GFriedrich

Description

@GFriedrich

In what version(s) of Spring for Apache Kafka are you seeing this issue?
3.2.* up to the latest 3.3.*

Describe the bug
I found a bit of a weird behaviour when enabling the observation on Spring Integrations and the Spring Kafka binder.
In this case the Spring Integration already adds a traceparent header (e.g. when using W3C traces) to the internal Message but later on the Spring Kafka binder will also add another traceparent header.

To Reproduce
Steps to reproduce the behavior:

  • Enable the observation for Spring Integrations via spring.integration.management.observation-patterns
  • Enable Spring Kafka binder observations via spring.cloud.stream.kafka.binder.enable-observation
  • Send a message to a StreamBridge
  • See that the produced record on Kafka has two traceparent headers

Expected behavior
There should be just one traceparent header on a produced record.

Sample
see spring-cloud/spring-cloud-stream#3095 (comment)

Additional info
This issue originates from spring-cloud/spring-cloud-stream#3095 but it was suggested in the issue over there that the underlying problem should be fixed in the Spring Kafka library instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions