feat(graphql): support collapse, depth, variables, and error extensions via env#9111
Conversation
Overall package sizeSelf size: 6.63 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.1 | 122.62 kB | 437.94 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 8dedde9 | Docs | Datadog PR Page | Give us feedback! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9111 +/- ##
========================================
Coverage 96.53% 96.54%
========================================
Files 911 911
Lines 120318 120357 +39
Branches 20642 20505 -137
========================================
+ Hits 116154 116193 +39
Misses 4164 4164
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
f38234b to
03d918f
Compare
BenchmarksBenchmark execution time: 2026-07-07 20:30:35 Comparing candidate commit 8dedde9 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2312 metrics, 46 unstable metrics.
|
…ns via env
This lets `initialize.mjs` users configure the graphql plugin without code
changes, matching the env-var configuration other integrations already offer.
`DD_TRACE_GRAPHQL_COLLAPSE`, `DD_TRACE_GRAPHQL_DEPTH`, and
`DD_TRACE_GRAPHQL_VARIABLES` join the existing `DD_TRACE_GRAPHQL_ERROR_EXTENSIONS`
on the Config singleton and are forwarded to the graphql plugin through
plugin_manager, so they seed the plugin config as a base that a programmatic
`tracer.use('graphql', …)` value overrides, and remote config and config
telemetry observe them on Config like every other global option. `depth` rejects
anything outside `-1` and the non-negative integers via its allowed pattern.
1. `errorExtensions` becomes a programmatic plugin option too, not env-only; the
error-event extraction now reads the resolved plugin config instead of the
raw env name off the tracer config. A value set both programmatically and via
env now resolves programmatic-wins instead of env-always-wins.
2. An invalid programmatic `depth` falls back to the registered default `-1`
after logging, rather than to the env value, because the merge collapses the
global and programmatic values onto one key.
3. The `variables` env var accepts the array form only; the callback form stays
programmatic. An empty `variables`/`errorExtensions` array means no filter.
Refs: #7546
03d918f to
8dedde9
Compare
…ns via env (#9111) This lets `initialize.mjs` users configure the graphql plugin without code changes, matching the env-var configuration other integrations already offer. `DD_TRACE_GRAPHQL_COLLAPSE`, `DD_TRACE_GRAPHQL_DEPTH`, and `DD_TRACE_GRAPHQL_VARIABLES` join the existing `DD_TRACE_GRAPHQL_ERROR_EXTENSIONS` on the Config singleton and are forwarded to the graphql plugin through plugin_manager, so they seed the plugin config as a base that a programmatic `tracer.use('graphql', …)` value overrides, and remote config and config telemetry observe them on Config like every other global option. `depth` rejects anything outside `-1` and the non-negative integers via its allowed pattern. 1. `errorExtensions` becomes a programmatic plugin option too, not env-only; the error-event extraction now reads the resolved plugin config instead of the raw env name off the tracer config. A value set both programmatically and via env now resolves programmatic-wins instead of env-always-wins. 2. An invalid programmatic `depth` falls back to the registered default `-1` after logging, rather than to the env value, because the merge collapses the global and programmatic values onto one key. 3. The `variables` env var accepts the array form only; the callback form stays programmatic. An empty `variables`/`errorExtensions` array means no filter. Fixes: #7546
…ns via env (#9111) This lets `initialize.mjs` users configure the graphql plugin without code changes, matching the env-var configuration other integrations already offer. `DD_TRACE_GRAPHQL_COLLAPSE`, `DD_TRACE_GRAPHQL_DEPTH`, and `DD_TRACE_GRAPHQL_VARIABLES` join the existing `DD_TRACE_GRAPHQL_ERROR_EXTENSIONS` on the Config singleton and are forwarded to the graphql plugin through plugin_manager, so they seed the plugin config as a base that a programmatic `tracer.use('graphql', …)` value overrides, and remote config and config telemetry observe them on Config like every other global option. `depth` rejects anything outside `-1` and the non-negative integers via its allowed pattern. 1. `errorExtensions` becomes a programmatic plugin option too, not env-only; the error-event extraction now reads the resolved plugin config instead of the raw env name off the tracer config. A value set both programmatically and via env now resolves programmatic-wins instead of env-always-wins. 2. An invalid programmatic `depth` falls back to the registered default `-1` after logging, rather than to the env value, because the merge collapses the global and programmatic values onto one key. 3. The `variables` env var accepts the array form only; the callback form stays programmatic. An empty `variables`/`errorExtensions` array means no filter. Fixes: #7546
…ns via env (#9111) This lets `initialize.mjs` users configure the graphql plugin without code changes, matching the env-var configuration other integrations already offer. `DD_TRACE_GRAPHQL_COLLAPSE`, `DD_TRACE_GRAPHQL_DEPTH`, and `DD_TRACE_GRAPHQL_VARIABLES` join the existing `DD_TRACE_GRAPHQL_ERROR_EXTENSIONS` on the Config singleton and are forwarded to the graphql plugin through plugin_manager, so they seed the plugin config as a base that a programmatic `tracer.use('graphql', …)` value overrides, and remote config and config telemetry observe them on Config like every other global option. `depth` rejects anything outside `-1` and the non-negative integers via its allowed pattern. 1. `errorExtensions` becomes a programmatic plugin option too, not env-only; the error-event extraction now reads the resolved plugin config instead of the raw env name off the tracer config. A value set both programmatically and via env now resolves programmatic-wins instead of env-always-wins. 2. An invalid programmatic `depth` falls back to the registered default `-1` after logging, rather than to the env value, because the merge collapses the global and programmatic values onto one key. 3. The `variables` env var accepts the array form only; the callback form stays programmatic. An empty `variables`/`errorExtensions` array means no filter. Fixes: #7546
…ns via env (#9111) This lets `initialize.mjs` users configure the graphql plugin without code changes, matching the env-var configuration other integrations already offer. `DD_TRACE_GRAPHQL_COLLAPSE`, `DD_TRACE_GRAPHQL_DEPTH`, and `DD_TRACE_GRAPHQL_VARIABLES` join the existing `DD_TRACE_GRAPHQL_ERROR_EXTENSIONS` on the Config singleton and are forwarded to the graphql plugin through plugin_manager, so they seed the plugin config as a base that a programmatic `tracer.use('graphql', …)` value overrides, and remote config and config telemetry observe them on Config like every other global option. `depth` rejects anything outside `-1` and the non-negative integers via its allowed pattern. 1. `errorExtensions` becomes a programmatic plugin option too, not env-only; the error-event extraction now reads the resolved plugin config instead of the raw env name off the tracer config. A value set both programmatically and via env now resolves programmatic-wins instead of env-always-wins. 2. An invalid programmatic `depth` falls back to the registered default `-1` after logging, rather than to the env value, because the merge collapses the global and programmatic values onto one key. 3. The `variables` env var accepts the array form only; the callback form stays programmatic. An empty `variables`/`errorExtensions` array means no filter. Fixes: #7546
Summary
Lets
initialize.mjsusers configure the graphql plugin without code changes, matching the env-var configuration other integrations already offer.DD_TRACE_GRAPHQL_COLLAPSE,DD_TRACE_GRAPHQL_DEPTH, andDD_TRACE_GRAPHQL_VARIABLESjoin the existingDD_TRACE_GRAPHQL_ERROR_EXTENSIONSon the Config singleton and are forwarded to the graphql plugin throughplugin_manager, seeding the plugin config as a base that a programmatictracer.use('graphql', …)value overrides. Keeping them on Config means remote config and config telemetry observe them like every other global option.Three behavior notes for reviewers:
errorExtensionsbecomes a programmatic plugin option too, not env-only; error-event extraction now reads the resolved plugin config instead of the raw env name off the tracer config. A value set both programmatically and via env now resolves programmatic-wins instead of env-always-wins.depthfalls back to the registered default-1after logging, rather than to the env value, because the merge collapses the global and programmatic values onto one key.variablesenv var accepts the array form only; the callback form stays programmatic. An emptyvariables/errorExtensionsarray means no filter.depthrejects anything outside-1and the non-negative integers via its allowed pattern.Why
These options only existed programmatically (and
errorExtensionsonly via env), so deployments that rely on zero-code configuration could not set them. Routing through the global Config +#getSharedConfigrail — the same machineryqueryStringObfuscationuses — keeps precedence uniform (remote_config > code > env > default) and positions the options to participate in the planned per-integration remote-config / 1-to-n work without a second resolution path.Test plan
PLUGINS=graphqlplugin suite (collapse/depth/error-extensions integration coverage)packages/datadog-plugin-graphql/test/config.spec.js— resolution + precedencepackages/dd-trace/test/plugin_manager.spec.js— graphql-scoped shared-config forwardingpackages/dd-trace/test/config/index.spec.js— env vars parse onto ConfigFixes: #7546