Skip to content

Wrong DD Service on Spring Kafka Consume #8911

@AntoineDuComptoirDesPharmacies

Description

Tracer Version(s)

1.49.0

Java Version(s)

21

JVM Vendor

Eclipse Adoptium / Temurin

Bug Report

We have two Java services that use dd-trace-java to send traces to Datadog.
Both are configured with the following :
-Ddd.service.mapping=postgresql:$SERVICE_NAME-db,kafka:$SERVICE_NAME-kafka,redis:$SERVICE_NAME-redis

First service use version 2.7.1 of Spring Boot, the "spring.consume" operation is located in the DD service "kafka".
So it is mapped to $SERVICE_NAME-kafka.

Second service is in version 3.2.5 of Spring Boot and the "spring.consume" operation is no more located in DD service "kafka" but the default service name.

On our side, the first behavior ("spring.consume" operation in "kafka") was better as it provide better separation (for P95, traces, etc...) between HTTP requests and Kafka processes.

Is this an intended behavior of the library or it is just a missing mapping for new versions of Spring boot Kafka listener ?
Thanks in advance for your help.
Yours faithfully,
LCDP

Expected Behavior

spring.consume" operation should be located in "kafka" service name.

Reproduction Code

Run an app in Spring-boot 3.2.5 with following code :

JAVA_OPTS="-javaagent:/usr/local/bin/dd-java-agent.jar -Ddd.dbm.propagation.mode=full -Ddd.integration.jdbc-datasource.enabled=true -Ddd.env=$SERVICE_ENVIRONMENT -Ddd.service=$SERVICE_NAME -Ddd.version=$SERVICE_VERSION -Ddd.service.mapping=postgresql:$SERVICE_NAME-db,kafka:$SERVICE_NAME-kafka,redis:$SERVICE_NAME-redis $JAVA_OPTS"

@KafkaListener(
            groupId = "#{__listener.getGroupId()}",
            properties = "#{__listener.getProperties()}",
            topics = "#{__listener.getTopic()}",
            batch = "true")
    public void read(@Payload ConsumerRecords<[...], [...]> records, Acknowledgment ack) {

        doSomething(records);

        ack.acknowledge();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugBug report and fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions