Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DuckyC opened this issue May 15, 2024 · 6 comments · Fixed by #7064
Closed
Assignees
Milestone

Comments

@DuckyC
Copy link

DuckyC commented May 15, 2024

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 🙏

@vandonr
Copy link
Contributor

vandonr commented May 29, 2024

👋 yes the service not being picked up is a bug, it should be fixed soon :)
It's only affecting prepared statements/queries. I suppose the service1 where it works as expected is doing "regular" unprepared queries.

@vandonr
Copy link
Contributor

vandonr commented May 29, 2024

As for the traceparent missing, it's a limitation from how prepared statements work:
Since we cannot edit the query after it's been prepared, we can only add the "constant" components in the comment, and not the traceparent (which would be different every time the statement is executed).
So, it's not a bug, it's a feature.

We're working on a (different) way to still get the traceparent for those prepared statements, but it's not ready yet.

@amarziali amarziali reopened this Jun 5, 2024
@amarziali amarziali added this to the 1.35.0 milestone Jun 5, 2024
@amarziali
Copy link
Collaborator

Reopening since not yet available in a release. Will be closed when 1.35.0 will be released

@vandonr
Copy link
Contributor

vandonr commented Jun 5, 2024

yup, it was autoclosed by github as the issue was mentionned in the PR.

@amarziali
Copy link
Collaborator

The fix has been delivered in 1.35.0-RC1 freshly released.

Copy link

🤖 This issue has been addressed in the latest release. See full details in the Release Notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants