Apm-kafka-plugin seems to only support binary traceparent header

We're using the ElasticApmAttacher to collect data from our Java services, while most of our services are using Go. All our services communicate via Kafka messages.

The java services seem to fail to extract the traceparent header from our messages, as they start a new trace every time. I have verified that the Go services are properly setting the text header.

While scanning scanning the code for the kafka plugin, I stumbled upon KafkaRecordHeaderAccessor, which (to my fairly limited understanding) only seems to support the binary format for the header. As we're using the text representation, I could see this as the root for our problem. Is that an actual limitation of the Kafka plugin? If so, is there a reason for it? Or am I misunderstanding the code?

(I didn't want to open up a bug at the repo because I'm not sure if it is a bug or if I'm mistaken :smiley: )

APM Agent language and version:
Java, 1.35.0

Original install method (e.g. download page, yum, deb, from source, etc.) and version:
N/A

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):

Steps to reproduce:

  1. Have a Go service instrumented using go.opentelemetry.io/otel (with kafka instrumentation provided by go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama)
  2. Have a Java services instrumented using co.elastic.apm:apm-agent-attach:1.35.0
  3. Send a kafka message from the Go service to the Java service
  4. Java service opens a new trace instead of connecting to the previous trace

Hi @Henkoglobin ,

Thanks for reporting this! It indeed looks like our trace-context propagation via kafka is currently not compatible with opentelemetry. I created an issue for it, you can track the progress there.

Hey @Jonas_Kunz, thanks for confirming! I'll follow along on Github, then :slight_smile: