camel-telemetry: fix trace context propagation for messaging components (backport 4.18.x)#22545
Draft
Croway wants to merge 1 commit intoapache:camel-4.18.xfrom
Draft
Conversation
e3353b2 to
7d58fc3
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.
7d58fc3 to
9e92d8b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #22544 to
camel-4.18.x.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.Test plan
camel-4.18.x