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

**URL:** <https://discuss.elastic.co/t/apm-kafka-plugin-seems-to-only-support-binary-traceparent-header/323737>\
**Category:** APM\
**Tags:** java\
**Created:** [January 23, 2023, 2:44pm UTC](https://discuss.elastic.co/t/apm-kafka-plugin-seems-to-only-support-binary-traceparent-header/323737 "2023-01-23T14:44:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henkoglobin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henkoglobin/32/116282_2.png) [@Henkoglobin](https://discuss.elastic.co/u/Henkoglobin)\
**Post date:** [January 23, 2023, 2:44pm UTC](https://discuss.elastic.co/t/apm-kafka-plugin-seems-to-only-support-binary-traceparent-header/323737/1 "2023-01-23T14:44:11Z")

</div>

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](https://github.dev/elastic/apm-agent-java/blob/main/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/main/java/co/elastic/apm/agent/kafka/helper/KafkaRecordHeaderAccessor.java), 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 😃 )

**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

---

<div class="post-metadata">

**Author:** ![Jonas\_Kunz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonas_kunz/32/110740_2.png) [@Jonas\_Kunz](https://discuss.elastic.co/u/Jonas_Kunz)\
**Post date:** [January 24, 2023, 11:45am UTC](https://discuss.elastic.co/t/apm-kafka-plugin-seems-to-only-support-binary-traceparent-header/323737/2 "2023-01-24T11:45:26Z")

</div>

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](https://github.com/elastic/apm-agent-java/issues/2983) for it, you can track the progress there.

---

<div class="post-metadata">

**Author:** ![Henkoglobin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henkoglobin/32/116282_2.png) [@Henkoglobin](https://discuss.elastic.co/u/Henkoglobin)\
**Post date:** [January 24, 2023, 1:08pm UTC](https://discuss.elastic.co/t/apm-kafka-plugin-seems-to-only-support-binary-traceparent-header/323737/3 "2023-01-24T13:08:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 14, 2023, 9:09am UTC](https://discuss.elastic.co/t/apm-kafka-plugin-seems-to-only-support-binary-traceparent-header/323737/4 "2023-02-14T09:09:16Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
