Skip to content

feat(graphql): support collapse, depth, variables, and error extensions via env#9111

Merged
BridgeAR merged 1 commit into
masterfrom
BridgeAR/2026-06-27-graphql-env-config
Jul 7, 2026
Merged

feat(graphql): support collapse, depth, variables, and error extensions via env#9111
BridgeAR merged 1 commit into
masterfrom
BridgeAR/2026-06-27-graphql-env-config

Conversation

@BridgeAR

@BridgeAR BridgeAR commented Jun 27, 2026

Copy link
Copy Markdown
Member

Summary

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, seeding the plugin config as a base that a programmatic tracer.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:

  1. errorExtensions becomes 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.
  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. depth rejects anything outside -1 and the non-negative integers via its allowed pattern.

Why

These options only existed programmatically (and errorExtensions only via env), so deployments that rely on zero-code configuration could not set them. Routing through the global Config + #getSharedConfig rail — the same machinery queryStringObfuscation uses — 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=graphql plugin suite (collapse/depth/error-extensions integration coverage)
  • packages/datadog-plugin-graphql/test/config.spec.js — resolution + precedence
  • packages/dd-trace/test/plugin_manager.spec.js — graphql-scoped shared-config forwarding
  • packages/dd-trace/test/config/index.spec.js — env vars parse onto Config

Fixes: #7546

@dd-octo-sts

dd-octo-sts Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 6.63 MB
Deduped: 7.29 MB
No deduping: 7.29 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

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Jun 27, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 96.50% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 8dedde9 | Docs | Datadog PR Page | Give us feedback!

@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.54%. Comparing base (731a05d) to head (8dedde9).
⚠️ Report is 2 commits behind head on master.

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            
Flag Coverage Δ
aiguard 53.57% <68.75%> (-0.04%) ⬇️
aiguard-integration 57.40% <68.75%> (+<0.01%) ⬆️
apm-bucket-0 53.80% <68.75%> (-0.05%) ⬇️
apm-bucket-1 58.11% <68.75%> (-0.04%) ⬇️
apm-bucket-2 56.12% <68.75%> (-0.04%) ⬇️
apm-capabilities-tracing 60.52% <70.45%> (+<0.01%) ⬆️
apm-integrations-aerospike 52.95% <68.75%> (-0.05%) ⬇️
apm-integrations-confluentinc-kafka-javascript 57.01% <68.75%> (-0.11%) ⬇️
apm-integrations-couchbase 53.28% <68.75%> (-0.04%) ⬇️
apm-integrations-http 57.99% <68.75%> (-0.04%) ⬇️
apm-integrations-kafkajs 57.73% <68.75%> (-0.07%) ⬇️
apm-integrations-next 54.25% <68.75%> (-0.04%) ⬇️
apm-integrations-prisma 54.21% <68.75%> (-0.04%) ⬇️
apm-integrations-tedious 53.05% <68.75%> (-0.04%) ⬇️
appsec 69.04% <68.75%> (-0.10%) ⬇️
appsec-express_fastify_graphql 65.71% <90.90%> (-0.02%) ⬇️
appsec-integration 45.55% <90.90%> (+0.02%) ⬆️
appsec-kafka_ldapjs_lodash 59.13% <68.75%> (-0.04%) ⬇️
appsec-mongodb-core_mongoose_mysql 62.32% <68.75%> (-0.04%) ⬇️
appsec-next 52.86% <68.75%> (-0.04%) ⬇️
appsec-node-serialize_passport_postgres 61.93% <68.75%> (-0.04%) ⬇️
appsec-sourcing_stripe_template 60.27% <68.75%> (-0.04%) ⬇️
debugger 65.72% <100.00%> (+0.01%) ⬆️
instrumentations-bucket-0 48.78% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-1 54.98% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-10 56.65% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-11 48.74% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-12 48.85% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-13 48.68% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-2 49.74% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-3 53.84% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-4 49.17% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-5 53.02% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-6 55.63% <68.75%> (-0.05%) ⬇️
instrumentations-bucket-7 53.62% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-8 54.65% <68.75%> (-0.04%) ⬇️
instrumentations-bucket-9 56.11% <68.75%> (-0.04%) ⬇️
instrumentations-instrumentation-couchbase 48.17% <68.75%> (-0.04%) ⬇️
instrumentations-integration-esbuild 33.93% <0.00%> (-0.02%) ⬇️
llmobs-ai_anthropic_bedrock 57.29% <68.75%> (-0.04%) ⬇️
llmobs-bucket-1 56.82% <68.75%> (-0.04%) ⬇️
llmobs-openai 57.59% <68.75%> (-0.04%) ⬇️
llmobs-sdk 59.99% <68.75%> (-0.05%) ⬇️
llmobs-vertex-ai 54.22% <68.75%> (-0.04%) ⬇️
master-coverage 96.54% <100.00%> (?)
openfeature 54.62% <68.75%> (+0.01%) ⬆️
openfeature-unit 49.82% <68.75%> (-0.04%) ⬇️
platform-core_esbuild_instrumentations-misc 38.41% <68.75%> (-0.02%) ⬇️
platform-integration 62.19% <68.75%> (+<0.01%) ⬆️
platform-shimmer_unit-guardrails_webpack 37.22% <68.75%> (-0.02%) ⬇️
plugins-bucket-0 53.19% <68.75%> (-0.04%) ⬇️
plugins-bucket-1 55.08% <68.75%> (+<0.01%) ⬆️
plugins-bucket-11 56.74% <68.75%> (-0.04%) ⬇️
plugins-bucket-17 56.76% <68.75%> (-0.04%) ⬇️
plugins-bucket-18 57.61% <86.36%> (-0.01%) ⬇️
plugins-bucket-19 57.14% <100.00%> (+<0.01%) ⬆️
plugins-bucket-20 59.39% <68.75%> (-0.05%) ⬇️
plugins-bucket-4 53.86% <68.75%> (-0.04%) ⬇️
plugins-bullmq_cassandra_cookie 57.41% <68.75%> (-0.04%) ⬇️
plugins-cookie-parser_crypto_dd-trace-api 52.33% <68.75%> (-0.05%) ⬇️
plugins-fetch_fs_generic-pool 54.47% <68.75%> (-0.04%) ⬇️
plugins-google-cloud-pubsub_grpc_handlebars 59.89% <68.75%> (-0.04%) ⬇️
plugins-hapi_hono_ioredis 55.88% <68.75%> (-0.04%) ⬇️
plugins-jest_knex_langgraph 51.67% <68.75%> (-0.04%) ⬇️
plugins-ldapjs_light-my-request_limitd-client 53.42% <68.75%> (-0.04%) ⬇️
plugins-lodash_mariadb_memcached 54.22% <68.75%> (-0.05%) ⬇️
plugins-mongodb_mongodb-core_mongoose 55.13% <68.75%> (-0.04%) ⬇️
plugins-multer_mysql_mysql2 54.38% <68.75%> (-0.04%) ⬇️
plugins-nats_node-serialize_opensearch 56.08% <68.75%> (-0.04%) ⬇️
plugins-passport-http_pino_postgres 54.82% <68.75%> (+0.02%) ⬆️
plugins-process_pug_redis 53.88% <68.75%> (-0.03%) ⬇️
plugins-undici_url_valkey 54.31% <68.75%> (-0.12%) ⬇️
plugins-vm_winston_ws 55.28% <68.75%> (-0.04%) ⬇️
profiling 58.22% <68.75%> (-0.04%) ⬇️
serverless-aws-sdk-aws-sdk 50.67% <68.75%> (-0.04%) ⬇️
serverless-aws-sdk-bedrockruntime 50.68% <68.75%> (-0.04%) ⬇️
serverless-aws-sdk-client 51.96% <68.75%> (-0.04%) ⬇️
serverless-aws-sdk-dynamodb 51.76% <68.75%> (-0.10%) ⬇️
serverless-aws-sdk-eventbridge 46.22% <68.75%> (-0.04%) ⬇️
serverless-aws-sdk-kinesis 54.71% <68.75%> (-0.04%) ⬇️
serverless-aws-sdk-lambda 52.79% <68.75%> (-0.04%) ⬇️
serverless-aws-sdk-s3 51.53% <68.75%> (-0.04%) ⬇️
serverless-aws-sdk-serverless-peer-service 54.74% <68.75%> (-0.08%) ⬇️
serverless-aws-sdk-sns 55.49% <68.75%> (-0.04%) ⬇️
serverless-aws-sdk-sqs 55.98% <68.75%> (+0.02%) ⬆️
serverless-aws-sdk-stepfunctions 51.25% <68.75%> (-0.04%) ⬇️
serverless-aws-sdk-util 48.46% <68.75%> (-0.04%) ⬇️
serverless-bucket-0 55.24% <68.75%> (+<0.01%) ⬆️
serverless-bucket-1 56.02% <68.75%> (-0.04%) ⬇️
test-optimization-cucumber 73.01% <100.00%> (+0.05%) ⬆️
test-optimization-cypress 66.56% <68.75%> (+0.03%) ⬆️
test-optimization-jest 73.98% <100.00%> (-0.06%) ⬇️
test-optimization-mocha 74.32% <100.00%> (+0.03%) ⬆️
test-optimization-playwright-playwright-atr 61.59% <68.75%> (+<0.01%) ⬆️
test-optimization-playwright-playwright-efd 61.84% <68.75%> (+0.07%) ⬆️
test-optimization-playwright-playwright-final-status 61.73% <68.75%> (-0.02%) ⬇️
test-optimization-playwright-playwright-impacted-tests 61.54% <68.75%> (+0.24%) ⬆️
test-optimization-playwright-playwright-reporting 61.62% <68.75%> (+0.06%) ⬆️
test-optimization-playwright-playwright-test-management 62.33% <68.75%> (-0.17%) ⬇️
test-optimization-playwright-playwright-test-span 61.50% <68.75%> (-0.07%) ⬇️
test-optimization-selenium 60.70% <68.75%> (-0.11%) ⬇️
test-optimization-testopt 59.15% <68.75%> (+0.08%) ⬆️
test-optimization-vitest 72.83% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-06-27-graphql-env-config branch from f38234b to 03d918f Compare June 27, 2026 07:05
@pr-commenter

pr-commenter Bot commented Jun 27, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-07 20:30:35

Comparing candidate commit 8dedde9 in PR branch BridgeAR/2026-06-27-graphql-env-config with baseline commit 731a05d in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2312 metrics, 46 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:appsec-appsec-enabled-24

  • unstable execution_time [-214.444ms; +206.026ms] or [-8.054%; +7.738%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-230.328ms; +225.008ms] or [-9.029%; +8.820%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-188.944ms; +185.151ms] or [-6.485%; +6.355%]

scenario:appsec-control-20

  • unstable execution_time [-124.677ms; +128.574ms] or [-7.612%; +7.850%]

scenario:appsec-control-24

  • unstable execution_time [-114995.572µs; +114838.139µs] or [-9.292%; +9.279%]

scenario:appsec-control-26

  • unstable execution_time [-123.567ms; +126.738ms] or [-9.995%; +10.251%]

scenario:appsec-iast-no-vulnerability-control-20

  • unstable execution_time [-14.744ms; +11.458ms] or [-5.735%; +4.457%]

scenario:appsec-iast-no-vulnerability-iast-enabled-always-active-20

  • unstable execution_time [-16340.856µs; +16944.056µs] or [-6.382%; +6.618%]

scenario:appsec-iast-with-vulnerability-control-20

  • unstable execution_time [-32.332ms; +26.186ms] or [-5.712%; +4.626%]

scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-30006.003µs; +30248.670µs] or [-5.372%; +5.415%]

scenario:debugger-line-probe-with-snapshot-default-24

  • unstable cpu_user_time [-3054.247ms; +1892.538ms] or [-32.446%; +20.105%]
  • unstable execution_time [-3101.161ms; +1889.676ms] or [-30.578%; +18.633%]
  • unstable instructions [-26.1G instructions; +16.2G instructions] or [-33.718%; +21.004%]
  • unstable max_rss_usage [-12.098MB; +8.044MB] or [-7.496%; +4.984%]
  • unstable throughput [-528.320op/s; +864.047op/s] or [-15.941%; +26.071%]

scenario:debugger-line-probe-with-snapshot-default-26

  • unstable cpu_user_time [-2307.443ms; +763.509ms] or [-24.142%; +7.988%]
  • unstable execution_time [-2321.048ms; +767.535ms] or [-22.569%; +7.463%]
  • unstable instructions [-20.3G instructions; +6.6G instructions] or [-25.532%; +8.350%]
  • unstable throughput [-154.148op/s; +453.036op/s] or [-4.780%; +14.048%]

scenario:debugger-line-probe-with-snapshot-minimal-24

  • unstable cpu_user_time [-1495.523ms; +543.033ms] or [-18.077%; +6.564%]
  • unstable execution_time [-1492.699ms; +542.898ms] or [-16.607%; +6.040%]
  • unstable instructions [-12.7G instructions; +4.6G instructions] or [-18.701%; +6.762%]
  • unstable throughput [-179.312op/s; +438.961op/s] or [-4.922%; +12.050%]

scenario:debugger-line-probe-with-snapshot-minimal-26

  • unstable cpu_user_time [-4.012s; +0.020s] or [-37.290%; +0.190%]
  • unstable execution_time [-4.004s; +0.029s] or [-34.890%; +0.254%]
  • unstable instructions [-35.7G instructions; +0.2G instructions] or [-39.496%; +0.172%]
  • unstable throughput [-7.477op/s; +837.188op/s] or [-0.252%; +28.222%]

scenario:debugger-line-probe-without-snapshot-24

  • unstable cpu_user_time [-2239.686ms; +3999.750ms] or [-24.557%; +43.856%]
  • unstable execution_time [-2258.741ms; +4016.260ms] or [-22.972%; +40.846%]
  • unstable instructions [-19.2G instructions; +34.2G instructions] or [-25.680%; +45.731%]
  • unstable max_rss_usage [-8.867MB; +17.928MB] or [-5.558%; +11.238%]
  • unstable throughput [-1034.367op/s; +647.194op/s] or [-30.473%; +19.067%]

scenario:debugger-line-probe-without-snapshot-26

  • unstable cpu_user_time [-2632.813ms; +4210.640ms] or [-27.739%; +44.363%]
  • unstable execution_time [-2665.099ms; +4196.271ms] or [-26.044%; +41.007%]
  • unstable instructions [-23.0G instructions; +37.3G instructions] or [-28.996%; +46.988%]
  • unstable max_rss_usage [-8.113MB; +12.903MB] or [-5.100%; +8.111%]
  • unstable throughput [-824.673op/s; +527.435op/s] or [-25.441%; +16.271%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-372107.835µs; +371538.918µs] or [-7.610%; +7.598%]
  • unstable execution_time [-372103.611µs; +372292.944µs] or [-7.487%; +7.491%]
  • unstable throughput [-126933.606op/s; +128267.162op/s] or [-7.506%; +7.585%]

scenario:plugin-claude-agent-sdk-compact-stream-scan-26

  • unstable cpu_usage_percentage [-5.766%; +5.766%]

scenario:plugin-graphql-long-with-depth-off-20

  • unstable max_rss_usage [-8835.188KB; +7404.903KB] or [-6.831%; +5.725%]

scenario:plugin-graphql-long-with-depth-on-max-20

  • unstable cpu_user_time [-741.809ms; +775.729ms] or [-5.780%; +6.044%]
  • unstable execution_time [-749.097ms; +779.855ms] or [-5.713%; +5.948%]
  • unstable throughput [-3.553op/s; +3.430op/s] or [-5.786%; +5.585%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-5558.311KB; +5382.644KB] or [-6.935%; +6.716%]

@BridgeAR
BridgeAR marked this pull request as ready for review June 27, 2026 13:23
@BridgeAR
BridgeAR requested review from a team as code owners June 27, 2026 13:23
@BridgeAR
BridgeAR requested review from khanayan123 and tlhunter and removed request for a team June 27, 2026 13:23
Comment thread index.d.ts
bengl
bengl previously approved these changes Jul 7, 2026
…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
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-06-27-graphql-env-config branch from 03d918f to 8dedde9 Compare July 7, 2026 20:18
@BridgeAR
BridgeAR merged commit 221c2fb into master Jul 7, 2026
660 of 662 checks passed
@BridgeAR
BridgeAR deleted the BridgeAR/2026-06-27-graphql-env-config branch July 7, 2026 21:54
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 8, 2026
…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
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 8, 2026
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 8, 2026
…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
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 8, 2026
juan-fernandez pushed a commit that referenced this pull request Jul 8, 2026
…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
juan-fernandez pushed a commit that referenced this pull request Jul 8, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Support GraphQL plugin collapse option via environment variable

2 participants