Skip to content

This is a draft made with AIT - feat(graphql): migrate shimmer to orchestrion instrumentation#7757

Draft
crysmags wants to merge 1 commit intomasterfrom
crysmags/graphql-migration
Draft

This is a draft made with AIT - feat(graphql): migrate shimmer to orchestrion instrumentation#7757
crysmags wants to merge 1 commit intomasterfrom
crysmags/graphql-migration

Conversation

@crysmags
Copy link
Collaborator

Replaces shimmer-based graphql instrumentation with orchestrion's tracingChannel approach. All 219 tests passing.

  • graphql.js: switch from addHook/shimmer to orchestrion channels
  • rewriter/instrumentations/graphql.js: orchestrion config for execute, parse, validate, resolveField across graphql versions
  • execute.js: use tracePromise with asyncEnd lifecycle
  • parse.js: use traceSync with document/source caching via WeakMap
  • validate.js: use traceSync with error tag on validation failures
  • resolve.js: use bindStart/end with field info from exeContext
  • state.js: shared WeakMap state for cross-plugin span coordination

What does this PR do?

Motivation

Additional Notes

Replaces shimmer-based graphql instrumentation with orchestrion's
tracingChannel approach. All 219 tests passing.

- graphql.js: switch from addHook/shimmer to orchestrion channels
- rewriter/instrumentations/graphql.js: orchestrion config for
  execute, parse, validate, resolveField across graphql versions
- execute.js: use tracePromise with asyncEnd lifecycle
- parse.js: use traceSync with document/source caching via WeakMap
- validate.js: use traceSync with error tag on validation failures
- resolve.js: use bindStart/end with field info from exeContext
- state.js: shared WeakMap state for cross-plugin span coordination

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 91.11111% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.20%. Comparing base (1a5eae4) to head (c7691b3).

Files with missing lines Patch % Lines
packages/datadog-plugin-graphql/src/state.js 62.50% 12 Missing ⚠️
packages/datadog-plugin-graphql/src/execute.js 92.15% 4 Missing ⚠️
packages/datadog-plugin-graphql/src/resolve.js 96.46% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7757      +/-   ##
==========================================
- Coverage   80.40%   80.20%   -0.20%     
==========================================
  Files         741      742       +1     
  Lines       32110    32094      -16     
==========================================
- Hits        25819    25742      -77     
- Misses       6291     6352      +61     
Flag Coverage Δ
aiguard-macos 38.88% <100.00%> (-0.10%) ⬇️
aiguard-ubuntu 39.00% <100.00%> (-0.10%) ⬇️
aiguard-windows 38.73% <100.00%> (-0.10%) ⬇️
apm-capabilities-tracing-macos 48.60% <8.63%> (-0.26%) ⬇️
apm-capabilities-tracing-ubuntu 48.64% <8.63%> (-0.26%) ⬇️
apm-capabilities-tracing-windows 48.37% <8.63%> (-0.26%) ⬇️
apm-integrations-child-process 38.44% <100.00%> (-0.10%) ⬇️
apm-integrations-couchbase-18 37.36% <100.00%> (-0.12%) ⬇️
apm-integrations-couchbase-eol 37.83% <100.00%> (+0.05%) ⬆️
apm-integrations-oracledb 37.67% <100.00%> (-0.09%) ⬇️
appsec-express 55.13% <100.00%> (-0.08%) ⬇️
appsec-fastify 51.49% <100.00%> (-0.07%) ⬇️
appsec-graphql ?
appsec-kafka 44.28% <100.00%> (-0.08%) ⬇️
appsec-ldapjs 43.90% <100.00%> (-0.08%) ⬇️
appsec-lodash 43.56% <100.00%> (-0.08%) ⬇️
appsec-macos 58.17% <100.00%> (-0.07%) ⬇️
appsec-mongodb-core 48.68% <100.00%> (-0.08%) ⬇️
appsec-mongoose 49.34% <100.00%> (-0.08%) ⬇️
appsec-mysql 50.74% <100.00%> (-0.17%) ⬇️
appsec-node-serialize 43.08% <100.00%> (-0.08%) ⬇️
appsec-passport 47.48% <100.00%> (-0.08%) ⬇️
appsec-postgres 50.47% <100.00%> (-0.07%) ⬇️
appsec-sourcing 42.49% <100.00%> (-0.08%) ⬇️
appsec-template 43.25% <100.00%> (-0.08%) ⬇️
appsec-ubuntu 58.24% <100.00%> (-0.07%) ⬇️
appsec-windows 58.00% <100.00%> (-0.07%) ⬇️
instrumentations-instrumentation-bluebird 32.31% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-body-parser 40.38% <100.00%> (-0.09%) ⬇️
instrumentations-instrumentation-child_process 37.76% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-cookie-parser 34.28% <100.00%> (-0.09%) ⬇️
instrumentations-instrumentation-express 34.60% <100.00%> (-0.09%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.41% <100.00%> (-0.09%) ⬇️
instrumentations-instrumentation-express-session 40.01% <100.00%> (-0.09%) ⬇️
instrumentations-instrumentation-fs 31.92% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-generic-pool 29.91% <100.00%> (+0.01%) ⬆️
instrumentations-instrumentation-http 39.74% <100.00%> (-0.09%) ⬇️
instrumentations-instrumentation-knex 32.31% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-mongoose 33.44% <100.00%> (-0.09%) ⬇️
instrumentations-instrumentation-multer 40.13% <100.00%> (-0.09%) ⬇️
instrumentations-instrumentation-mysql2 38.22% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-passport 43.88% <100.00%> (-0.08%) ⬇️
instrumentations-instrumentation-passport-http 43.56% <100.00%> (-0.08%) ⬇️
instrumentations-instrumentation-passport-local 44.09% <100.00%> (-0.08%) ⬇️
instrumentations-instrumentation-pg 37.65% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-promise 32.24% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-promise-js 32.25% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-q 32.29% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-url 32.21% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-when 32.26% <100.00%> (-0.10%) ⬇️
llmobs-ai 42.20% <100.00%> (-0.09%) ⬇️
llmobs-anthropic 40.19% <100.00%> (-0.09%) ⬇️
llmobs-bedrock 39.17% <100.00%> (-0.08%) ⬇️
llmobs-google-genai 39.73% <100.00%> (-0.08%) ⬇️
llmobs-langchain 39.97% <100.00%> (-0.07%) ⬇️
llmobs-openai 43.92% <100.00%> (-0.08%) ⬇️
llmobs-vertex-ai 39.99% <100.00%> (-0.09%) ⬇️
platform-core 31.53% <ø> (ø)
platform-esbuild 34.48% <ø> (ø)
platform-instrumentations-misc 48.45% <100.00%> (+0.05%) ⬆️
platform-shimmer 37.63% <ø> (ø)
platform-unit-guardrails 32.95% <ø> (ø)
plugins-azure-event-hubs 25.94% <100.00%> (+0.11%) ⬆️
plugins-azure-service-bus 25.30% <100.00%> (+0.11%) ⬆️
plugins-bullmq 44.16% <100.00%> (-0.01%) ⬇️
plugins-cassandra 37.71% <100.00%> (-0.09%) ⬇️
plugins-cookie 27.00% <100.00%> (+0.11%) ⬆️
plugins-cookie-parser 26.79% <100.00%> (+0.11%) ⬆️
plugins-crypto 26.79% <ø> (ø)
plugins-dd-trace-api 38.27% <100.00%> (-0.10%) ⬇️
plugins-express-mongo-sanitize 26.94% <100.00%> (+0.11%) ⬆️
plugins-express-session 26.75% <100.00%> (+0.11%) ⬆️
plugins-fastify 42.10% <100.00%> (-0.09%) ⬇️
plugins-fetch 38.27% <100.00%> (-0.09%) ⬇️
plugins-fs 38.54% <100.00%> (-0.10%) ⬇️
plugins-generic-pool 25.99% <100.00%> (+0.11%) ⬆️
plugins-google-cloud-pubsub 45.30% <100.00%> (-0.08%) ⬇️
plugins-grpc 40.82% <100.00%> (-0.09%) ⬇️
plugins-handlebars 26.98% <100.00%> (+0.11%) ⬆️
plugins-hapi 40.01% <100.00%> (-0.23%) ⬇️
plugins-hono 40.27% <100.00%> (-0.09%) ⬇️
plugins-ioredis 38.35% <100.00%> (-0.10%) ⬇️
plugins-knex 26.61% <100.00%> (+0.11%) ⬆️
plugins-ldapjs 24.47% <100.00%> (+0.11%) ⬆️
plugins-light-my-request 26.34% <100.00%> (+0.11%) ⬆️
plugins-limitd-client 32.59% <100.00%> (-0.10%) ⬇️
plugins-lodash 26.08% <100.00%> (+0.11%) ⬆️
plugins-mariadb 39.40% <100.00%> (-0.10%) ⬇️
plugins-memcached 38.08% <100.00%> (-0.10%) ⬇️
plugins-microgateway-core 39.07% <100.00%> (-0.17%) ⬇️
plugins-moleculer 40.41% <100.00%> (-0.09%) ⬇️
plugins-mongodb 39.09% <100.00%> (-0.09%) ⬇️
plugins-mongodb-core 38.93% <100.00%> (-0.09%) ⬇️
plugins-mongoose 38.78% <100.00%> (-0.09%) ⬇️
plugins-multer 26.75% <100.00%> (+0.11%) ⬆️
plugins-mysql 39.09% <100.00%> (-0.10%) ⬇️
plugins-mysql2 39.19% <100.00%> (-0.09%) ⬇️
plugins-node-serialize 27.05% <100.00%> (+0.11%) ⬆️
plugins-opensearch 37.54% <100.00%> (-0.09%) ⬇️
plugins-passport-http 26.80% <100.00%> (+0.11%) ⬆️
plugins-postgres 35.66% <100.00%> (-0.08%) ⬇️
plugins-process 26.79% <ø> (ø)
plugins-pug 27.00% <100.00%> (+0.11%) ⬆️
plugins-redis 38.82% <100.00%> (-0.10%) ⬇️
plugins-router 42.81% <100.00%> (-0.09%) ⬇️
plugins-sequelize 25.59% <100.00%> (+0.11%) ⬆️
plugins-test-and-upstream-amqp10 38.43% <100.00%> (-0.10%) ⬇️
plugins-test-and-upstream-amqplib 43.76% <100.00%> (-0.10%) ⬇️
plugins-test-and-upstream-apollo 39.91% <15.55%> (+0.78%) ⬆️
plugins-test-and-upstream-avsc 38.60% <100.00%> (-0.10%) ⬇️
plugins-test-and-upstream-bunyan 33.85% <100.00%> (-0.10%) ⬇️
plugins-test-and-upstream-connect 40.66% <100.00%> (-0.09%) ⬇️
plugins-test-and-upstream-graphql 41.00% <91.11%> (+0.86%) ⬆️
plugins-test-and-upstream-koa 40.25% <100.00%> (-0.09%) ⬇️
plugins-test-and-upstream-protobufjs 38.83% <100.00%> (-0.10%) ⬇️
plugins-test-and-upstream-rhea 43.96% <100.00%> (-0.07%) ⬇️
plugins-undici 39.04% <100.00%> (-0.09%) ⬇️
plugins-url 26.79% <ø> (ø)
plugins-valkey 38.02% <100.00%> (-0.10%) ⬇️
plugins-vm 26.79% <ø> (ø)
plugins-winston 34.04% <100.00%> (-0.09%) ⬇️
plugins-ws 41.77% <100.00%> (-0.09%) ⬇️
profiling-macos 39.85% <100.00%> (-0.09%) ⬇️
profiling-ubuntu 39.98% <100.00%> (-0.09%) ⬇️
profiling-windows 41.16% <100.00%> (-0.09%) ⬇️
serverless-azure-functions-client 25.66% <100.00%> (+0.11%) ⬆️
serverless-azure-functions-eventhubs 25.66% <100.00%> (+0.11%) ⬆️
serverless-azure-functions-servicebus 25.66% <100.00%> (+0.11%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@github-actions
Copy link
Contributor

Overall package size

Self size: 4.97 MB
Deduped: 5.81 MB
No deduping: 5.81 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.0 | 81.15 kB | 815.98 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@datadog-prod-us1-6
Copy link

datadog-prod-us1-6 bot commented Mar 12, 2026

⚠️ Tests

Fix all issues with BitsAI or with Cursor

⚠️ Warnings

🧪 8 Tests failed

with @apollo/server 4 (4.0.0) Graphql sources tests Should detect COMMAND_INJECTION vulnerability with hardcoded query from Graphql sources tests (Datadog) (Fix with Cursor)
Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/dd-trace/test/appsec/iast/taint-tracking/sources/plugin.apollo-server.plugin.spec.js)

Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/dd-trace/test/appsec/iast/taint-tracking/sources/plugin.apollo-server.plugin.spec.js)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)
with @apollo/server 4 (4.13.0) Graphql sources tests Should detect COMMAND_INJECTION vulnerability with hardcoded query from Graphql sources tests (Datadog) (Fix with Cursor)
Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/dd-trace/test/appsec/iast/taint-tracking/sources/plugin.apollo-server.plugin.spec.js)

Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/dd-trace/test/appsec/iast/taint-tracking/sources/plugin.apollo-server.plugin.spec.js)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)
with @apollo/server >=5.0.0 (5.0.0) Graphql sources tests Should detect COMMAND_INJECTION vulnerability with hardcoded query from Graphql sources tests (Datadog) (Fix with Cursor)
Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/dd-trace/test/appsec/iast/taint-tracking/sources/plugin.apollo-server.plugin.spec.js)

Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/dd-trace/test/appsec/iast/taint-tracking/sources/plugin.apollo-server.plugin.spec.js)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)
View all

ℹ️ Info

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: c7691b3 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@pr-commenter
Copy link

pr-commenter bot commented Mar 12, 2026

Benchmarks

Benchmark execution time: 2026-03-12 02:34:13

Comparing candidate commit c7691b3 in PR branch crysmags/graphql-migration with baseline commit 1a5eae4 in branch master.

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

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 this pull request may close these issues.

1 participant