Skip to content

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
Croway:fix/telemetry-messaging-byte-headers-4.18.x
Draft

camel-telemetry: fix trace context propagation for messaging components (backport 4.18.x)#22545
Croway wants to merge 1 commit intoapache:camel-4.18.xfrom
Croway:fix/telemetry-messaging-byte-headers-4.18.x

Conversation

@Croway
Copy link
Copy Markdown
Contributor

@Croway Croway commented Apr 10, 2026

Summary

Backport of #22544 to camel-4.18.x.

  • 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 across services.
  • 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.

Test plan

  • 91 camel-telemetry tests pass on camel-4.18.x

@Croway Croway marked this pull request as draft April 10, 2026 12:55
@Croway Croway force-pushed the fix/telemetry-messaging-byte-headers-4.18.x branch 2 times, most recently from e3353b2 to 7d58fc3 Compare April 10, 2026 13:39
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.
@Croway Croway force-pushed the fix/telemetry-messaging-byte-headers-4.18.x branch from 7d58fc3 to 9e92d8b Compare April 10, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant