Add data_streams_enabled to startup log output#7454
Conversation
Go, Java, and .NET tracers already include data_streams_enabled in the DATADOG TRACER CONFIGURATION startup log. This adds parity for the Node.js tracer, making it easier to debug DSM configuration issues in customer environments. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Overall package sizeSelf size: 4.58 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 813.08 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7454 +/- ##
=======================================
Coverage 80.34% 80.34%
=======================================
Files 731 731
Lines 31093 31093
=======================================
Hits 24981 24981
Misses 6112 6112 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
Tests the three key scenarios: 1. env var true, config unset → true (env var applies) 2. env var unset, config true → true (code option applies) 3. env var true, config false → false (code option takes precedence) Co-Authored-By: Claude Opus 4.6 <[email protected]>
BenchmarksBenchmark execution time: 2026-02-06 19:18:08 Comparing candidate commit cf17ed2 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 230 metrics, 30 unstable metrics. |
Exposes dsmEnabled as a documented, first-class option in dd.init(). The config system already supports this internally — this change just makes it visible in the public TypeScript types. When not provided, the value of DD_DATA_STREAMS_ENABLED env var is used. When explicitly set, the code option takes precedence over the env var (consistent with all other config options). Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
Added to the queue but the mergequeue is not enabled for now.
This pull request was merged directly. |
* Add data_streams_enabled to startup log output Go, Java, and .NET tracers already include data_streams_enabled in the DATADOG TRACER CONFIGURATION startup log. This adds parity for the Node.js tracer, making it easier to debug DSM configuration issues in customer environments. * Add test coverage for data_streams_enabled in startup log Tests the three key scenarios: 1. env var true, config unset → true (env var applies) 2. env var unset, config true → true (code option applies) 3. env var true, config false → false (code option takes precedence) * Add dsmEnabled to TracerOptions interface Exposes dsmEnabled as a documented, first-class option in dd.init(). The config system already supports this internally — this change just makes it visible in the public TypeScript types. When not provided, the value of DD_DATA_STREAMS_ENABLED env var is used. When explicitly set, the code option takes precedence over the env var (consistent with all other config options).
* Add data_streams_enabled to startup log output Go, Java, and .NET tracers already include data_streams_enabled in the DATADOG TRACER CONFIGURATION startup log. This adds parity for the Node.js tracer, making it easier to debug DSM configuration issues in customer environments. * Add test coverage for data_streams_enabled in startup log Tests the three key scenarios: 1. env var true, config unset → true (env var applies) 2. env var unset, config true → true (code option applies) 3. env var true, config false → false (code option takes precedence) * Add dsmEnabled to TracerOptions interface Exposes dsmEnabled as a documented, first-class option in dd.init(). The config system already supports this internally — this change just makes it visible in the public TypeScript types. When not provided, the value of DD_DATA_STREAMS_ENABLED env var is used. When explicitly set, the code option takes precedence over the env var (consistent with all other config options).
* Add data_streams_enabled to startup log output Go, Java, and .NET tracers already include data_streams_enabled in the DATADOG TRACER CONFIGURATION startup log. This adds parity for the Node.js tracer, making it easier to debug DSM configuration issues in customer environments. * Add test coverage for data_streams_enabled in startup log Tests the three key scenarios: 1. env var true, config unset → true (env var applies) 2. env var unset, config true → true (code option applies) 3. env var true, config false → false (code option takes precedence) * Add dsmEnabled to TracerOptions interface Exposes dsmEnabled as a documented, first-class option in dd.init(). The config system already supports this internally — this change just makes it visible in the public TypeScript types. When not provided, the value of DD_DATA_STREAMS_ENABLED env var is used. When explicitly set, the code option takes precedence over the env var (consistent with all other config options).
* Add data_streams_enabled to startup log output Go, Java, and .NET tracers already include data_streams_enabled in the DATADOG TRACER CONFIGURATION startup log. This adds parity for the Node.js tracer, making it easier to debug DSM configuration issues in customer environments. * Add test coverage for data_streams_enabled in startup log Tests the three key scenarios: 1. env var true, config unset → true (env var applies) 2. env var unset, config true → true (code option applies) 3. env var true, config false → false (code option takes precedence) * Add dsmEnabled to TracerOptions interface Exposes dsmEnabled as a documented, first-class option in dd.init(). The config system already supports this internally — this change just makes it visible in the public TypeScript types. When not provided, the value of DD_DATA_STREAMS_ENABLED env var is used. When explicitly set, the code option takes precedence over the env var (consistent with all other config options).
* Add data_streams_enabled to startup log output Go, Java, and .NET tracers already include data_streams_enabled in the DATADOG TRACER CONFIGURATION startup log. This adds parity for the Node.js tracer, making it easier to debug DSM configuration issues in customer environments. * Add test coverage for data_streams_enabled in startup log Tests the three key scenarios: 1. env var true, config unset → true (env var applies) 2. env var unset, config true → true (code option applies) 3. env var true, config false → false (code option takes precedence) * Add dsmEnabled to TracerOptions interface Exposes dsmEnabled as a documented, first-class option in dd.init(). The config system already supports this internally — this change just makes it visible in the public TypeScript types. When not provided, the value of DD_DATA_STREAMS_ENABLED env var is used. When explicitly set, the code option takes precedence over the env var (consistent with all other config options).
Summary
dsmEnabledto the publicTracerOptionsinterface so customers can enable Data Streams Monitoring directly indd.init()data_streams_enabledto theDATADOG TRACER CONFIGURATIONstartup log output (Go, Java, and .NET already include this field)Changes
index.d.ts: AdddsmEnabled?: booleantoTracerOptionsinterface with JSDoc. The config system already supports this option internally — this just makes it visible and documented for customers.packages/dd-trace/src/startup-log.js: Adddata_streams_enabled: !!config.dsmEnabledtotracerInfo()output.packages/dd-trace/test/startup-log.spec.js: Add test coverage for three env var / code option precedence scenarios.Investigation context
This came out of investigating a support case where a customer had
DD_DATA_STREAMS_ENABLED=trueset in ECS Fargate but DSM was not showing as enabled on the service page.What we tested
Repro app: Built a repro mimicking their setup — a shared wrapper library (compiled TypeScript) that calls
dd.init()at module-level, imported by the main service. Tested with [email protected] across ts-node, compiled dist/, and separately compiled shared-lib scenarios. Result:dsmEnabledwastruein all cases — the wrapper pattern alone does not prevent the env var from being read.Config precedence verification: Tested all combinations of env var vs code option:
dsmEnabledin codeDD_DATA_STREAMS_ENABLEDenv vartruetrue(env var applies)false(default)undefinedtruetrue(env var applies)truetrue(code option applies)falsetruefalse(code option takes precedence)Adding
dsmEnabledtoTracerOptionshas no runtime impact on existing customers. When not passed in code, the env var continues to work exactly as before.Customer debug logging: Customer added debug prints and found:
DD_DATA_STREAMS_ENABLED: undefined— env var not set at process startDD_DATA_STREAMS_ENABLED: true— something sets it between entrypoint and init (likely dotenv or similar)dsmEnabled: true— tracer picks it up correctlyHowever, this was from a local dev environment, not their production ECS Fargate deployment where the issue actually occurs. Investigation is ongoing for the production case.
Why these changes help
dsmEnabledinTracerOptions: Customers using wrapper libraries arounddd.init()(like this customer's@touchbistro/node-common) can explicitly enable DSM in code rather than relying solely on the env var. This is especially useful when env var injection in container orchestrators (ECS, K8s) may behave unexpectedly.data_streams_enabledin startup logs: Currently there's no way to verify DSM configuration from the tracer's diagnostic output. The startup log includesappsec_enabled,profiling_enabled,runtime_metrics_enabled, etc. — but not DSM. This makes it impossible to debug DSM config issues from logs alone.Cross-language precedent
data_streams_enabledin startup log?Test plan
mocha packages/dd-trace/test/startup-log.spec.js— all 6 tests passagent-proxy.spec.js(macOS gzip test) — unrelated to this change🤖 Generated with Claude Code