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

Opentracing doesn't work with Kafka Component

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.23.4
    • Fix Version/s: 2.25.2, 3.4.2, 3.5.0
    • Component/s: camel-opentracing
    • Labels:
      None
    • Estimated Complexity:
      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

          Activity

            People

            • Assignee:
              acosentino Andrea Cosentino
              Reporter:
              gnunn Gerald Nunn

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment