Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15022

Opentracing doesn't work with Kafka Component

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.23.4
    • 2.25.2, 3.4.2, 3.5.0
    • camel-opentracing
    • None
    • Unknown

    Description

      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

       

      Attachments

        Issue Links

          Activity

            People

              acosentino Andrea Cosentino
              gnunn Gerald Nunn
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: