-
Notifications
You must be signed in to change notification settings - Fork 631
Description
Describe the issue
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
traceparentheaders
Version of the framework
4.2.0
Expected behavior
There should be just one traceparent header on a produced record.
Additional context
Even though it is already possible to handle that in a way by suppressing the header from the Spring Integration via spring.cloud.stream.kafka.default.producer.header-patterns it would be great to see a more permanent solution.
I would suggest to either:
- add a default exclusion for
traceparentheaders to theBinderHeaderMapperimplementation (potentially also other headers would be needed then in case people use something different than W3C headers) - or make the
KafkaRecordSenderContextto first remove the same existing header and replacing it instead of just adding new ones