dd-trace-js
dd-trace-js copied to clipboard
mongodb tracer doesnt show the query
Expected behaviour Show up mongodb query in tracings.
Actual behaviour
Mongodb queries are obfuscated with ? in datadog console.
findAndModify tractian.$cmd {"$and":"?"}

Steps to reproduce Just get up some application that do queries in mongodb and setup datadog, default behavior is to obfuscate queries, I didn't find any env vars or config in init() to disabled it, found this issue and tried the config below forcing disabling obfuscation but didn't work.
public.ecr.aws/datadog/agent:latest running as a sidecar in the task definition with my application. I can see tracing and metrics normally.
/etc/datadog-agent/datadog.yaml:
## Provides autodetected defaults, for ECS Fargate environments,
## please see datadog.yaml.example for all supported options
# Enable APM by setting the DD_APM_ENABLED envvar to true, or override this configuration
apm_config:
enable: true
apm_non_local_traffic: true
obfuscation:
mongodb:
enabled: false
I found these snippets below and I think that's related to this "obfuscation":
https://github.com/DataDog/dd-trace-js/blob/995da60aa504cbf3401cf6b22a3adcc3b5d402e4/packages/datadog-plugin-mongodb-core/src/index.js#L84
https://github.com/DataDog/dd-trace-js/blob/995da60aa504cbf3401cf6b22a3adcc3b5d402e4/packages/datadog-plugin-mongodb-core/src/index.js#L85
https://github.com/DataDog/dd-trace-js/blob/995da60aa504cbf3401cf6b22a3adcc3b5d402e4/packages/datadog-plugin-mongodb-core/src/index.js#L86
https://github.com/DataDog/dd-trace-js/blob/995da60aa504cbf3401cf6b22a3adcc3b5d402e4/packages/datadog-plugin-mongodb-core/src/index.js#L89
Environment
- Operation system: AWS Fargate - container
- Node.js version: v14.17.6
- Tracer version: 3
- Agent version: latest
- Relevant library versions:
"dd-trace": "^3.0.0",
This is fixed by #2295. Please upgrade.