Gerald Nunn created CAMEL-15022:
-----------------------------------

             Summary: Opentracing doesn't work with Kafka Component
                 Key: CAMEL-15022
                 URL: https://issues.apache.org/jira/browse/CAMEL-15022
             Project: Camel
          Issue Type: Bug
          Components: camel-opentracing
    Affects Versions: 2.23.4
            Reporter: Gerald Nunn


In Kafka the headers are stored as byte arrays rather then string. OpenTracing 
with Jaeger inserts a string header uber-trace-id which works. However when it 
tries to read it as a string when the message is consumed it presumably does a 
toString which doesn't return the actual string since the header is returned as 
a byte array.

This can be worked around by using a KafkaHeaderDeserializer as per here:

https://github.com/gnunn1/seating/blob/master/seat-listener/src/main/java/com/redhat/demo/HeaderDeserializer.java

Note you need to deserialize the kafka.TOPIC as well since the 
KafkaSpanDecorator tries to cast the header as a string which fails the header 
is returned as byte array.

https://github.com/apache/camel/blob/camel-2.23.x/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/KafkaSpanDecorator.java#L49


 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to