camel-telemetry: fix trace context propagation for messaging components#22544
camel-telemetry: fix trace context propagation for messaging components#22544Croway wants to merge 1 commit intoapache:mainfrom
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
7de7d79 to
d52a2b9
Compare
|
🧪 CI tested the following changed modules:
All tested modules (11 modules)
|
squakez
left a comment
There was a problem hiding this comment.
I think that the decode of the "dash" is something exclusive of JMS protocol, I am not aware of other protocols, for example Kafka, having the same limitation. I you notice, the encoding part belongs to CamelJMSHeadersSpanContextPropagationInjector class, so, I guess that if anything has to be done with this class, it makes sense to have the specular encoding part. Same for testing. It makes sense to have an encode/decode test using for consistency reason
|
I think you can instead change the AbstractMessaging and deal with the string/byte conversion there leaving the "dashing" problem to the specific JMS subclass and separating clearly the concerns. |
d52a2b9 to
a0db01b
Compare
AbstractMessagingSpanDecorator used the default CamelHeadersSpanContextPropagationExtractor which only handles String-valued headers. Messaging transports like Kafka deliver headers as byte[], so trace context headers (e.g. traceparent) were silently dropped, breaking distributed trace propagation. Add CamelMessagingHeadersSpanContextPropagationExtractor that handles both String and byte[] headers, and override getExtractor() in AbstractMessagingSpanDecorator so all messaging components (Kafka, AMQP, SJMS, STOMP, Spring RabbitMQ, Azure Service Bus, etc.) benefit from the fix. The issue was discovered while upgrading the camel-spring-boot opentelemetry example from camel-opentelemetry to camel-opentelemetry2.
a0db01b to
1f0a41b
Compare
Summary
AbstractMessagingSpanDecoratorused the defaultCamelHeadersSpanContextPropagationExtractorwhich only handlesString-valued headers. Messaging transports like Kafka deliver headers asbyte[], so trace context headers (e.g.traceparent) were silently dropped, breaking distributed trace propagation across services.CamelMessagingHeadersSpanContextPropagationExtractorthat handles bothStringandbyte[]headers, and overridegetExtractor()inAbstractMessagingSpanDecoratorso all messaging components (Kafka, AMQP, SJMS, STOMP, Spring RabbitMQ, Azure Service Bus, etc.) benefit from the fix.camel-opentelemetrytocamel-opentelemetry2.Test plan