dd-trace-java icon indicating copy to clipboard operation
dd-trace-java copied to clipboard

JDBC connection service mapping not being used, and traceparent missing, in SQL comment

Open DuckyC opened this issue 1 year ago • 0 comments

Hello Team!

We've been trying to get our DBM propagation to work in our JVM service. What we've got so far is this:

Environment variables: DD_DBM_PROPAGATION_MODE=full DD_INTEGRATION_JDBC_DATASOURCE_ENABLED=true DD_SERVICE_MAPPING=java-aws-sdk:service2-aws,kafka:service2-kafka,postgresql:service1-postgres,redis:service2-redis

I've changed the name of our services to service1 and service2, but otherwise it's 1:1.

We're using version 1.34.0 of the dd-java-agent.

In our AWS RDS monitoring I can see that a comment is injected into the SQL that looks like this:

/*ddps='service2',dddbs='postgresql',dde='product-production',ddpv='4a388a64e335e580b0a009bde65e5b8ca98c2123'*/

As you can see, the dddbs is postgresql but I am expecting it to be service1-postgres. Also there is no traceparent

In SQL statements from service1, which is a node service, we can see the following comments injected.

/*dddbs='service1-postgres',dde='product-production',ddps='service1',ddpv='33e69dcfc8b2fedef92a0d5c6b02770245912787',traceparent='00-00000000000000006a12fad2e813a38c-28d6e919161bf07e-01'*/

Which works as expected.

I've tried running the the service with the variable DD_TRACE_DEBUG=true and confirmed that the service mapping was picked up:

[dd.trace 2024-05-15 13:26:46:971 +0000] [main] DEBUG datadog.trace.api.Config - New instance: Config{instrumenterConfig=InstrumenterConfig{ [...] serviceMapping={java-aws-sdk=service2-aws, postgresql=service1-postgres, redis=service2-redis, kafka=service2-kafka} [...] }
  1. What do I need to do to get the service mapping applied to the JDBC connection? Is it a bug?
  2. What do I need to do to get a tranceparent?

Thank you for your time 🙏

DuckyC avatar May 15 '24 13:05 DuckyC