[Java] Distributed tracing payload header is missing


I’m having trouble enabling Kafka distributed traces, I can’t get distributed tracing payload header to appear (there is no such key as “newrelic”). We use Spring framework (KafkaTemplate and KafkaListener) to send and to listen to messages.


private KafkaTemplate<String, MyResponse> kafkaTemplate;

public void sendMessage(MyResponse msg) {
ListenableFuture<SendResult<String, MyResponse >> listenableFuture = kafkaTemplate.send(topicName, key, msg);


@Trace(dispatcher = true)
@KafkaListener(topics = "${kafka.my.topic}")
public void listen(@Payload List<MyResponse> messages,
                   @Header(KafkaHeaders.RECEIVED_TOPIC) List<String> topics,
                   @Header("newrelic") {

I also tried fetching all headers with @Headers but there is no “newrelic” key in the list.
Distributed tracing and Kafka-specific distributed tracing features are both enabled in yml files.
I turned log level to finest, but didn’t notice any exceptions.

Maybe somebody has any insights what could me missing?

1 Like

@Vita.Januseviciute Welcome to the community and congrats on posting your first topic. Seems like it has provided quite the mystery for our fellow community members. I’m going to raise it up to our support team again and see if they can provide you with their insights. Thanks for your patience! :slight_smile:


Hey @Vita.Januseviciute,

You’ll want to use the Distributed Tracing (DT) API to get to the DT payload. I have an example write-up here with both a basic producer and consumer example:

Can you take a look at that and let me know if you have questions?

1 Like