dd-trace 5.136.0 → 5.137.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/ci/cypress/support.js +2 -1
- package/ci/vitest-no-worker-init-node-setup.mjs +2 -1
- package/ci/vitest-no-worker-init-runner-setup.mjs +2 -1
- package/ci/vitest-no-worker-init-setup.mjs +729 -724
- package/ci/vitest-no-worker-init-v5-setup.mjs +2 -1
- package/package.json +33 -30
- package/packages/datadog-esbuild/index.js +8 -15
- package/packages/datadog-esbuild/src/log.js +2 -29
- package/packages/datadog-instrumentations/src/ai.js +6 -1
- package/packages/datadog-instrumentations/src/cypress-config.js +20 -9
- package/packages/datadog-instrumentations/src/helpers/bundler-esm-exports.js +23 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-log.js +38 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +9 -6
- package/packages/datadog-instrumentations/src/helpers/fetch.js +51 -6
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +6 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-client.js +30 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-server.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +21 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +33 -4
- package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +30 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +6 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +122 -0
- package/packages/datadog-instrumentations/src/microgateway-core.js +1 -2
- package/packages/datadog-instrumentations/src/modelcontextprotocol-client.js +21 -0
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +7 -1
- package/packages/datadog-instrumentations/src/modelcontextprotocol-server.js +41 -0
- package/packages/datadog-instrumentations/src/next.js +184 -20
- package/packages/datadog-instrumentations/src/router.js +35 -12
- package/packages/datadog-instrumentations/src/vitest-main.js +10 -2
- package/packages/datadog-plugin-aws-lambda/src/arn.js +41 -0
- package/packages/datadog-plugin-aws-lambda/src/event-type-guards.js +170 -0
- package/packages/datadog-plugin-aws-lambda/src/trigger.js +339 -0
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +7 -0
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +32 -10
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +10 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +4 -0
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +3 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +30 -4
- package/packages/datadog-plugin-cypress/src/support.mjs +1353 -0
- package/packages/datadog-plugin-express/src/code_origin.js +2 -2
- package/packages/datadog-plugin-fastify/src/code_origin.js +2 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +10 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +2 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +7 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/resource-names.js +24 -0
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +1 -0
- package/packages/datadog-plugin-http/src/client.js +2 -1
- package/packages/datadog-plugin-http2/src/client.js +2 -1
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/tracing.js +28 -2
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/utils.js +1 -0
- package/packages/datadog-plugin-mongodb-core/src/query.js +17 -1
- package/packages/datadog-plugin-postgres/src/index.js +118 -41
- package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +18 -8
- package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +49 -13
- package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +34 -9
- package/packages/datadog-plugin-vitest/src/index.js +3 -2
- package/packages/datadog-plugin-ws/src/close.js +3 -5
- package/packages/datadog-plugin-ws/src/producer.js +1 -4
- package/packages/datadog-plugin-ws/src/receiver.js +3 -5
- package/packages/datadog-plugin-ws/src/server.js +44 -13
- package/packages/datadog-vite/index.js +537 -0
- package/packages/datadog-vite/src/log.js +5 -0
- package/packages/datadog-webpack/src/log.js +2 -29
- package/packages/dd-trace/src/aiguard/index.js +1 -1
- package/packages/dd-trace/src/aiguard/integrations/index.js +6 -5
- package/packages/dd-trace/src/appsec/blocking/index.js +17 -1
- package/packages/dd-trace/src/appsec/channels.js +7 -0
- package/packages/dd-trace/src/appsec/downstream_requests.js +105 -0
- package/packages/dd-trace/src/appsec/graphql.js +10 -13
- package/packages/dd-trace/src/appsec/handlers/auth.js +1 -3
- package/packages/dd-trace/src/appsec/handlers/http-request.js +60 -65
- package/packages/dd-trace/src/appsec/handlers/http-response.js +61 -7
- package/packages/dd-trace/src/appsec/handlers/payments.js +23 -27
- package/packages/dd-trace/src/appsec/index.js +6 -0
- package/packages/dd-trace/src/appsec/lambda.js +17 -17
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +4 -4
- package/packages/dd-trace/src/appsec/rasp/index.js +8 -1
- package/packages/dd-trace/src/appsec/rasp/lfi.js +2 -2
- package/packages/dd-trace/src/appsec/rasp/sql_injection.js +7 -17
- package/packages/dd-trace/src/appsec/rasp/ssrf.js +80 -16
- package/packages/dd-trace/src/appsec/rasp/utils.js +33 -3
- package/packages/dd-trace/src/appsec/recommended.json +70 -3
- package/packages/dd-trace/src/appsec/reporter.js +9 -0
- package/packages/dd-trace/src/appsec/sdk/set_user.js +3 -3
- package/packages/dd-trace/src/appsec/sdk/track_event.js +4 -4
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +1 -1
- package/packages/dd-trace/src/appsec/user_tracking.js +6 -8
- package/packages/dd-trace/src/appsec/waf/index.js +65 -6
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +33 -38
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +18 -2
- package/packages/dd-trace/src/config/generated-config-types.d.ts +4 -2
- package/packages/dd-trace/src/config/index.js +46 -26
- package/packages/dd-trace/src/config/parsers.js +35 -0
- package/packages/dd-trace/src/config/remote-config-layers.js +38 -0
- package/packages/dd-trace/src/config/remote_config.js +2 -1
- package/packages/dd-trace/src/config/supported-configurations.json +14 -6
- package/packages/dd-trace/src/datastreams/fnv.js +27 -0
- package/packages/dd-trace/src/datastreams/pathway.js +113 -28
- package/packages/dd-trace/src/datastreams/processor.js +5 -4
- package/packages/dd-trace/src/debugger/config.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/request-options.js +7 -9
- package/packages/dd-trace/src/debugger/devtools_client/send.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/state.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/tags.js +1 -1
- package/packages/dd-trace/src/debugger/index.js +2 -2
- package/packages/dd-trace/src/debugger/inspect-segment.js +3 -2
- package/packages/dd-trace/src/debugger/pause-duration-histogram.js +4 -1
- package/packages/dd-trace/src/debugger/probe_sampler.js +39 -17
- package/packages/dd-trace/src/debugger/unsupported-runtime.js +2 -0
- package/packages/dd-trace/src/git_metadata.js +2 -1
- package/packages/dd-trace/src/index.js +6 -3
- package/packages/dd-trace/src/lambda/facade.js +6 -5
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/index.js +54 -3
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +81 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +3 -0
- package/packages/dd-trace/src/openfeature/configuration_source.js +20 -0
- package/packages/dd-trace/src/plugins/ci_plugin.js +104 -9
- package/packages/dd-trace/src/plugins/index.js +2 -0
- package/packages/dd-trace/src/plugins/util/ci.js +34 -0
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +9 -14
- package/packages/dd-trace/src/plugins/util/test.js +28 -1
- package/packages/dd-trace/src/plugins/util/url.js +8 -5
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +4 -4
- package/packages/dd-trace/src/process-tags/index.js +1 -1
- package/packages/dd-trace/src/profiler.js +74 -12
- package/packages/dd-trace/src/profiling/profiler.js +30 -2
- package/packages/dd-trace/src/profiling/profilers/space.js +3 -1
- package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
- package/packages/dd-trace/src/profiling/remote-config.js +354 -0
- package/packages/dd-trace/src/profiling/runtime-capabilities.js +11 -0
- package/packages/dd-trace/src/propagation-hash/index.js +7 -0
- package/packages/dd-trace/src/proxy.js +13 -1
- package/vendor/dist/@opentelemetry/core/LICENSE +11 -0
- package/vendor/dist/@opentelemetry/core/index.js +1 -1
- package/vite.d.ts +7 -0
- package/vite.js +3 -0
- package/lambda.d.ts +0 -39
- package/lambda.js +0 -3
- package/packages/datadog-plugin-cypress/src/support.js +0 -1348
|
@@ -7,4 +7,5 @@ captureDeclarations(test, TestRunner.getCurrentSuite)
|
|
|
7
7
|
globalThis[Symbol.for('dd-trace.vitest.browser-context-importer')] = () => import('vitest/browser')
|
|
8
8
|
globalThis[Symbol.for('dd-trace.vitest.skip-task')] = skip => skip('Skipped by Datadog Test Optimization')
|
|
9
9
|
|
|
10
|
-
await import('./vitest-no-worker-init-setup.mjs')
|
|
10
|
+
const { setup } = await import('./vitest-no-worker-init-setup.mjs')
|
|
11
|
+
setup()
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.137.0",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"env": "bash ./plugin-env",
|
|
9
|
-
"prepare": "node scripts/patch-istanbul-lib-coverage.js && node scripts/patch-v8-to-istanbul.js &&
|
|
9
|
+
"prepare": "node scripts/patch-istanbul-lib-coverage.js && node scripts/patch-v8-to-istanbul.js && npm exec --yes --package=bun -- bun install --cwd vendor --config=../bunfig.toml --silent --frozen-lockfile",
|
|
10
10
|
"prepack": "node scripts/release/swap-v5-types.js",
|
|
11
11
|
"bench": "node benchmark/index.js",
|
|
12
12
|
"bench:elevenlabs": "node benchmark/elevenlabs.js",
|
|
13
13
|
"bench:e2e:test-optimization": "node benchmark/e2e-test-optimization/benchmark-run.js",
|
|
14
|
-
"dependencies:dedupe": "yarn-deduplicate yarn.lock",
|
|
15
14
|
"generate:config:types": "node scripts/generate-config-types.js",
|
|
16
15
|
"generate:electron-package": "node scripts/generate-electron-package.js",
|
|
17
16
|
"verify:config:types": "node scripts/generate-config-types.js --check",
|
|
@@ -20,8 +19,9 @@
|
|
|
20
19
|
"verify:rewriter:targets": "node scripts/generate-rewriter-targets.js --check",
|
|
21
20
|
"generate:supported-integrations": "node scripts/generate-supported-integrations.js",
|
|
22
21
|
"type:check": "tsc --noEmit -p tsconfig.dev.json",
|
|
23
|
-
"type:
|
|
24
|
-
"type:doc:
|
|
22
|
+
"type:check:ci": "node scripts/type-check.js tsconfig.type-checked.json",
|
|
23
|
+
"type:doc:build": "cd docs && bun install --frozen-lockfile && bun run build",
|
|
24
|
+
"type:doc:test": "cd docs && bun install --frozen-lockfile && bun run test",
|
|
25
25
|
"lint": "bash ./scripts/lint.sh",
|
|
26
26
|
"lint:fix": "node scripts/check_licenses.js && node scripts/check-agents-md-size.js && node scripts/check-no-coverage-artifacts.js && node scripts/check-no-mcr-images.js && node scripts/check-docker-image-shas.js && node scripts/check-workflow-inline-js.js && eslint . --concurrency=auto --max-warnings 0 --fix",
|
|
27
27
|
"verify:carrier-fields": "node scripts/verify-carrier-fields.mjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"test:appsec": "mocha --exclude \"packages/dd-trace/test/appsec/**/*.plugin.spec.js\" \"packages/dd-trace/test/appsec/**/*.spec.js\"",
|
|
38
38
|
"test:appsec:ci": "node scripts/c8-ci.js test:appsec",
|
|
39
39
|
"test:appsec:plugins": "mocha \"packages/dd-trace/test/appsec/**/*.@(${PLUGINS}).plugin.spec.js\"",
|
|
40
|
-
"test:appsec:plugins:ci": "
|
|
40
|
+
"test:appsec:plugins:ci": "npm run services && node scripts/c8-ci.js test:appsec:plugins",
|
|
41
41
|
"test:debugger": "mocha \"packages/dd-trace/test/debugger/**/*.spec.js\"",
|
|
42
42
|
"test:debugger:ci": "node scripts/c8-ci.js test:debugger",
|
|
43
43
|
"test:eslint-rules": "node scripts/run-eslint-rule-tests.mjs eslint-rules/*.test.mjs",
|
|
@@ -49,10 +49,12 @@
|
|
|
49
49
|
"test:esbuild:ci": "node scripts/c8-ci.js test:esbuild",
|
|
50
50
|
"test:turbopack": "mocha \"packages/datadog-turbopack/test/**/*.spec.js\"",
|
|
51
51
|
"test:turbopack:ci": "node scripts/c8-ci.js test:turbopack",
|
|
52
|
+
"test:vite": "mocha \"packages/datadog-vite/test/**/*.spec.js\"",
|
|
53
|
+
"test:vite:ci": "node scripts/c8-ci.js test:vite",
|
|
52
54
|
"test:webpack": "mocha \"packages/datadog-webpack/test/**/*.spec.js\"",
|
|
53
55
|
"test:webpack:ci": "node scripts/c8-ci.js test:webpack",
|
|
54
56
|
"test:instrumentations": "mocha --fail-zero \"packages/datadog-instrumentations/test/@(${PLUGINS}).spec.js\"",
|
|
55
|
-
"test:instrumentations:ci": "
|
|
57
|
+
"test:instrumentations:ci": "npm run services && node scripts/c8-ci.js test:instrumentations",
|
|
56
58
|
"test:instrumentations:misc": "mocha \"packages/datadog-instrumentations/test/*/**/*.spec.{js,mjs}\"",
|
|
57
59
|
"test:instrumentations:misc:ci": "node scripts/c8-ci.js test:instrumentations:misc",
|
|
58
60
|
"test:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- \"packages/datadog-core/test/**/*.spec.js\"",
|
|
@@ -65,12 +67,12 @@
|
|
|
65
67
|
"test:llmobs:sdk": "mocha --exclude \"packages/dd-trace/test/llmobs/plugins/**/*.spec.js\" \"packages/dd-trace/test/llmobs/**/*.spec.js\"",
|
|
66
68
|
"test:llmobs:sdk:ci": "node scripts/c8-ci.js test:llmobs:sdk",
|
|
67
69
|
"test:llmobs:plugins": "mocha \"packages/dd-trace/test/llmobs/plugins/@(${PLUGINS})/*.spec.js\"",
|
|
68
|
-
"test:llmobs:plugins:ci": "
|
|
70
|
+
"test:llmobs:plugins:ci": "npm run services && node scripts/c8-ci.js test:llmobs:plugins",
|
|
69
71
|
"test:openfeature": "mocha \"packages/dd-trace/test/evp_proxy/**/*.spec.js\" \"packages/dd-trace/test/openfeature/**/*.spec.js\"",
|
|
70
72
|
"test:openfeature:ci": "node scripts/c8-ci.js test:openfeature",
|
|
71
73
|
"test:plugins": "node --expose-gc ./node_modules/mocha/bin/mocha.js --fail-zero \"packages/datadog-plugin-@(${PLUGINS})/test/**/${SPEC:-*}*.spec.js\"",
|
|
72
|
-
"test:plugins:ci": "
|
|
73
|
-
"test:plugins:ci:flaky": "
|
|
74
|
+
"test:plugins:ci": "npm run services && node scripts/c8-ci.js test:plugins",
|
|
75
|
+
"test:plugins:ci:flaky": "npm run services && node scripts/c8-ci.js test:plugins --bail --retries 2",
|
|
74
76
|
"test:plugins:upstream": "node ./packages/dd-trace/test/plugins/suite.js",
|
|
75
77
|
"test:profiler": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- \"packages/dd-trace/test/profiling/**/*.spec.js\"",
|
|
76
78
|
"test:profiler:ci": "node scripts/c8-ci.js test:profiler",
|
|
@@ -115,14 +117,15 @@
|
|
|
115
117
|
"test:integration:testopt:coverage": "node ./integration-tests/coverage/run-suite.js --timeout 120000 \"integration-tests/ci-visibility/${SPEC:-*}.spec.js\"",
|
|
116
118
|
"test:integration:profiler": "mocha --timeout 180000 \"integration-tests/profiler/*.spec.js\"",
|
|
117
119
|
"test:integration:profiler:coverage": "node ./integration-tests/coverage/run-suite.js --timeout 180000 \"integration-tests/profiler/*.spec.js\"",
|
|
118
|
-
"test:integration:plugins": "
|
|
119
|
-
"test:integration:plugins:coverage": "
|
|
120
|
+
"test:integration:plugins": "npm run services && mocha \"packages/datadog-plugin-@(${PLUGINS})/test/integration-test/**/${SPEC:-*}*.spec.js\"",
|
|
121
|
+
"test:integration:plugins:coverage": "npm run services && node ./integration-tests/coverage/run-suite.js \"packages/datadog-plugin-@(${PLUGINS})/test/integration-test/**/${SPEC:-*}*.spec.js\"",
|
|
120
122
|
"test:unit:plugins": "mocha \"packages/datadog-instrumentations/test/@(${PLUGINS}).spec.js\" \"packages/datadog-plugin-@(${PLUGINS})/test/**/*.spec.js\" --exclude \"packages/datadog-plugin-@(${PLUGINS})/test/integration-test/**/*.spec.js\"",
|
|
121
123
|
"test:release": "mocha \"scripts/release/**/*.spec.js\"",
|
|
122
124
|
"test:scripts": "mocha \"benchmark/e2e-test-optimization/*.spec.js\" \"benchmark/sirun/*.spec.js\" \"scripts/helpers/**/*.spec.js\" \"scripts/test/**/*.spec.js\" \"scripts/*.spec.mjs\"",
|
|
123
125
|
"test:shimmer": "mocha \"packages/datadog-shimmer/test/**/*.spec.js\"",
|
|
124
126
|
"test:shimmer:ci": "node scripts/c8-ci.js test:shimmer",
|
|
125
127
|
"verify:workflow-job-names": "node scripts/verify-workflow-job-names.js",
|
|
128
|
+
"verify:dependency-updates": "node scripts/verify-dependency-updates.js",
|
|
126
129
|
"verify-exercised-tests": "node scripts/verify-exercised-tests.js"
|
|
127
130
|
},
|
|
128
131
|
"repository": {
|
|
@@ -156,6 +159,8 @@
|
|
|
156
159
|
"esbuild.js",
|
|
157
160
|
"next.js",
|
|
158
161
|
"next.d.ts",
|
|
162
|
+
"vite.js",
|
|
163
|
+
"vite.d.ts",
|
|
159
164
|
"webpack.js",
|
|
160
165
|
"ext/**/*",
|
|
161
166
|
"index.d.ts",
|
|
@@ -168,8 +173,6 @@
|
|
|
168
173
|
"LICENSE.Apache",
|
|
169
174
|
"LICENSE.BSD3",
|
|
170
175
|
"loader-hook.mjs",
|
|
171
|
-
"lambda.d.ts",
|
|
172
|
-
"lambda.js",
|
|
173
176
|
"openfeature.d.ts",
|
|
174
177
|
"openfeature.js",
|
|
175
178
|
"openfeature/rules-based.js",
|
|
@@ -197,7 +200,7 @@
|
|
|
197
200
|
"optionalDependencies": {
|
|
198
201
|
"@datadog/libdatadog": "^0.21.0",
|
|
199
202
|
"@datadog/libdatadog-extras": "^0.21.0",
|
|
200
|
-
"@datadog/native-appsec": "
|
|
203
|
+
"@datadog/native-appsec": "12.0.0",
|
|
201
204
|
"@datadog/native-iast-taint-tracking": "4.2.1",
|
|
202
205
|
"@datadog/native-metrics": "4.0.0",
|
|
203
206
|
"@datadog/pprof": "5.20.1",
|
|
@@ -209,7 +212,7 @@
|
|
|
209
212
|
"devDependencies": {
|
|
210
213
|
"@actions/core": "^3.0.1",
|
|
211
214
|
"@actions/github": "^9.1.1",
|
|
212
|
-
"@babel/helpers": "^8.
|
|
215
|
+
"@babel/helpers": "^8.1.2",
|
|
213
216
|
"@eslint/eslintrc": "^3.3.7",
|
|
214
217
|
"@eslint/js": "^10.0.1",
|
|
215
218
|
"@eslint/plugin-kit": "^0.7.3",
|
|
@@ -221,34 +224,32 @@
|
|
|
221
224
|
"@types/mocha": "^10.0.10",
|
|
222
225
|
"@types/node": "^18.19.106",
|
|
223
226
|
"@types/sinon": "^22.0.2",
|
|
224
|
-
"@vercel/nft": "^1.11.
|
|
225
|
-
"@yarnpkg/lockfile": "^1.1.0",
|
|
227
|
+
"@vercel/nft": "^1.11.1",
|
|
226
228
|
"benchmark": "^2.1.4",
|
|
227
229
|
"body-parser": "^2.4.0",
|
|
228
230
|
"bun": "1.4.4",
|
|
229
231
|
"c8": "^12.0.0",
|
|
230
232
|
"codeowners-audit": "^2.9.0",
|
|
231
|
-
"eslint": "^10.
|
|
232
|
-
"eslint-plugin-cypress": "^7.0.
|
|
233
|
-
"eslint-plugin-import-x": "^4.
|
|
234
|
-
"eslint-plugin-jsdoc": "^65.4.
|
|
233
|
+
"eslint": "^10.14.0",
|
|
234
|
+
"eslint-plugin-cypress": "^7.0.4",
|
|
235
|
+
"eslint-plugin-import-x": "^4.18.1",
|
|
236
|
+
"eslint-plugin-jsdoc": "^65.4.5",
|
|
235
237
|
"eslint-plugin-mocha": "^12.0.2",
|
|
236
238
|
"eslint-plugin-n": "^18.5.0",
|
|
237
239
|
"eslint-plugin-promise": "^7.3.0",
|
|
238
|
-
"eslint-plugin-regexp": "^3.3.
|
|
240
|
+
"eslint-plugin-regexp": "^3.3.3",
|
|
239
241
|
"eslint-plugin-sonarjs": "^4.2.2",
|
|
240
242
|
"eslint-plugin-unicorn": "^79.0.0",
|
|
241
243
|
"express": "^5.3.0",
|
|
242
244
|
"glob": "^10.4.5",
|
|
243
|
-
"globals": "^17.
|
|
245
|
+
"globals": "^17.14.0",
|
|
244
246
|
"graphql": "*",
|
|
245
|
-
"husky": "^9.1.7",
|
|
246
247
|
"istanbul-lib-coverage": "^3.2.2",
|
|
247
248
|
"istanbul-lib-report": "^3.0.0",
|
|
248
249
|
"istanbul-reports": "^3.0.2",
|
|
249
250
|
"jsonc-parser": "^3.3.1",
|
|
250
251
|
"jszip": "^3.10.2",
|
|
251
|
-
"minimatch": "^11.0.
|
|
252
|
+
"minimatch": "^11.0.8",
|
|
252
253
|
"mocha": "^11.8.0",
|
|
253
254
|
"mocha-junit-reporter": "^2.2.1",
|
|
254
255
|
"mocha-multi-reporters": "^1.5.2",
|
|
@@ -261,7 +262,7 @@
|
|
|
261
262
|
"proxyquire": "^2.1.3",
|
|
262
263
|
"retry": "^0.13.1",
|
|
263
264
|
"semifies": "^1.0.0",
|
|
264
|
-
"semver": "^7.8.
|
|
265
|
+
"semver": "^7.8.6",
|
|
265
266
|
"sinon": "^22.1.0",
|
|
266
267
|
"source-map-support": "^0.5.21",
|
|
267
268
|
"test-exclude": "^8.0.0",
|
|
@@ -269,7 +270,9 @@
|
|
|
269
270
|
"typescript": "^6.0.3",
|
|
270
271
|
"v8-to-istanbul": "^9.0.0",
|
|
271
272
|
"workerpool": "^10.0.3",
|
|
272
|
-
"yaml": "^2.9.1"
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
"yaml": "^2.9.1"
|
|
274
|
+
},
|
|
275
|
+
"trustedDependencies": [
|
|
276
|
+
"bun"
|
|
277
|
+
]
|
|
275
278
|
}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('node:fs')
|
|
4
4
|
const path = require('node:path')
|
|
5
|
-
const {
|
|
5
|
+
const { fileURLToPath } = require('node:url')
|
|
6
6
|
|
|
7
7
|
const instrumentations = require('../datadog-instrumentations/src/helpers/instrumentations')
|
|
8
8
|
const {
|
|
9
9
|
createEsmResolver,
|
|
10
|
+
createEsmWrapper,
|
|
10
11
|
processModule,
|
|
11
12
|
} = require('../datadog-instrumentations/src/helpers/bundler-esm-exports')
|
|
12
13
|
const { getGitMetadataBanner, isESMFile } = require('../datadog-instrumentations/src/helpers/bundler-utils')
|
|
@@ -348,20 +349,12 @@ ${build.initialOptions.banner.js}`
|
|
|
348
349
|
transform: build.esbuild.transformSync,
|
|
349
350
|
})
|
|
350
351
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const _ = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
358
|
-
const set = {};
|
|
359
|
-
const get = {};
|
|
360
|
-
|
|
361
|
-
${[...setters.values()].join(';\n')};
|
|
362
|
-
|
|
363
|
-
register(${JSON.stringify(toRegister)}, _, set, get, ${JSON.stringify(data.raw)});
|
|
364
|
-
`
|
|
352
|
+
contents = createEsmWrapper({
|
|
353
|
+
path: args.path,
|
|
354
|
+
internal: data.internal,
|
|
355
|
+
specifier: data.raw,
|
|
356
|
+
setters: setters.values(),
|
|
357
|
+
})
|
|
365
358
|
} else {
|
|
366
359
|
contents = fs.readFileSync(args.path, 'utf8')
|
|
367
360
|
}
|
|
@@ -1,32 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const createBundlerLog = require('../../datadog-instrumentations/src/helpers/bundler-log')
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const DD_TRACE_DEBUG = (process.env.DD_TRACE_DEBUG || '').trim().toLowerCase()
|
|
7
|
-
const DEBUG = DD_TRACE_DEBUG === 'true' || DD_TRACE_DEBUG === '1'
|
|
8
|
-
|
|
9
|
-
const noop = () => {}
|
|
10
|
-
|
|
11
|
-
const formatWithLogPrefix = (prefix, str, ...args) => {
|
|
12
|
-
if (typeof str === 'string') {
|
|
13
|
-
return format(`${prefix} ${str}`, ...args)
|
|
14
|
-
}
|
|
15
|
-
return format(prefix, str, ...args)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
module.exports = DEBUG
|
|
19
|
-
? {
|
|
20
|
-
debug (...args) {
|
|
21
|
-
// eslint-disable-next-line no-console
|
|
22
|
-
console.log(formatWithLogPrefix('[dd-trace/esbuild]', ...args))
|
|
23
|
-
},
|
|
24
|
-
warn (...args) {
|
|
25
|
-
// eslint-disable-next-line no-console
|
|
26
|
-
console.warn(formatWithLogPrefix('[dd-trace/esbuild] Warning:', ...args))
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
: {
|
|
30
|
-
debug: noop,
|
|
31
|
-
warn: noop,
|
|
32
|
-
}
|
|
5
|
+
module.exports = createBundlerLog('esbuild')
|
|
@@ -279,7 +279,12 @@ addHook({ name: 'ai', versions: ['>=7.0.0'] }, exports => {
|
|
|
279
279
|
},
|
|
280
280
|
})
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
// The telemetry result may be a copy, but its stream is shared with the SDK.
|
|
283
|
+
// Preserve that identity and attach the observer when the SDK pipes the stream.
|
|
284
|
+
shimmer.wrap(ctx.result.stream, 'pipeThrough', pipeThrough => function () {
|
|
285
|
+
const stream = pipeThrough.call(this, transform)
|
|
286
|
+
return pipeThrough.apply(stream, arguments)
|
|
287
|
+
})
|
|
283
288
|
},
|
|
284
289
|
})
|
|
285
290
|
|
|
@@ -301,14 +301,19 @@ function getRelativeImportPath (fromDirectory, importedFile) {
|
|
|
301
301
|
* @param {string} browserHooksSource Datadog browser-side support hooks
|
|
302
302
|
* @param {boolean} deferLifecycle whether manual support owns lifecycle registration
|
|
303
303
|
* @param {string} lifecycleOwnerSource browser lifecycle ownership detection
|
|
304
|
+
* @param {string} [localBrowserHooks] browser hooks module inside the project
|
|
304
305
|
* @returns {string[]} generated files
|
|
305
306
|
*/
|
|
306
307
|
function createSupportWrapper (
|
|
307
|
-
directory, originalSupportFile, browserHooksSource, deferLifecycle, lifecycleOwnerSource
|
|
308
|
+
directory, originalSupportFile, browserHooksSource, deferLifecycle, lifecycleOwnerSource, localBrowserHooks
|
|
308
309
|
) {
|
|
309
310
|
const suffix = `${process.pid}-${randomUUID()}`
|
|
310
|
-
|
|
311
|
-
const
|
|
311
|
+
// Stay on the project's TypeScript preprocessor instead of loading Babel for an injected .mjs entry.
|
|
312
|
+
const extension = /\.tsx?$/.test(originalSupportFile) ? path.extname(originalSupportFile) : '.mjs'
|
|
313
|
+
// These generated entries contain JavaScript; leave type checking to the user's support file.
|
|
314
|
+
const typeCheckDirective = extension === '.mjs' ? '' : '// @ts-nocheck\n'
|
|
315
|
+
const browserHooksFile = path.join(directory, `dd-cypress-support-hooks-${suffix}${extension}`)
|
|
316
|
+
const wrapperFile = path.join(directory, `dd-cypress-support-${suffix}${extension}`)
|
|
312
317
|
const wrapperImports = [
|
|
313
318
|
`import ${JSON.stringify(getRelativeImportPath(directory, browserHooksFile))}`,
|
|
314
319
|
]
|
|
@@ -319,7 +324,10 @@ function createSupportWrapper (
|
|
|
319
324
|
|
|
320
325
|
const generatedFiles = []
|
|
321
326
|
try {
|
|
322
|
-
const
|
|
327
|
+
const initializer = localBrowserHooks
|
|
328
|
+
? `import initializeBrowserSupport from ${JSON.stringify(getRelativeImportPath(directory, localBrowserHooks))}\n`
|
|
329
|
+
: `${browserHooksSource}\n`
|
|
330
|
+
const guardedSource = `${initializer}const ddSupportRoot = Cypress.mocha.getRootSuite()
|
|
323
331
|
const ddSupportKey = Symbol.for('dd-trace.cypress.support-installed')
|
|
324
332
|
const ddHasLifecycle = (() => {
|
|
325
333
|
const module = { exports: {} }
|
|
@@ -334,11 +342,11 @@ for (const key of ['_beforeAll', '_beforeEach', '_afterAll', '_afterEach']) {
|
|
|
334
342
|
}
|
|
335
343
|
ddSupportRoot[Symbol.for('dd-trace.cypress.lifecycle-positions')] = positions
|
|
336
344
|
ddSupportRoot[Symbol.for('dd-trace.cypress.defer-lifecycle')] = ${deferLifecycle}
|
|
337
|
-
|
|
345
|
+
initializeBrowserSupport()
|
|
338
346
|
ddSupportRoot[ddSupportKey] = true
|
|
339
347
|
}
|
|
340
348
|
`
|
|
341
|
-
writeExclusiveFile(browserHooksFile, guardedSource)
|
|
349
|
+
writeExclusiveFile(browserHooksFile, `${typeCheckDirective}${guardedSource}`)
|
|
342
350
|
generatedFiles.push(browserHooksFile)
|
|
343
351
|
const finalize = `const root = Cypress.mocha.getRootSuite()
|
|
344
352
|
const install = root[Symbol.for('dd-trace.cypress.install-lifecycle')]
|
|
@@ -359,7 +367,7 @@ if (typeof install === 'function' && (!hasLifecycle || !hasLifecycle(root))) {
|
|
|
359
367
|
}
|
|
360
368
|
}
|
|
361
369
|
`
|
|
362
|
-
writeExclusiveFile(wrapperFile, `${wrapperImports.join('\n')}\n${finalize}`)
|
|
370
|
+
writeExclusiveFile(wrapperFile, `${typeCheckDirective}${wrapperImports.join('\n')}\n${finalize}`)
|
|
363
371
|
generatedFiles.push(wrapperFile)
|
|
364
372
|
} catch (error) {
|
|
365
373
|
for (const generatedFile of generatedFiles) removeGeneratedFile(generatedFile)
|
|
@@ -410,7 +418,7 @@ function injectSupportFile (config, manualLifecycle = false) {
|
|
|
410
418
|
let browserHooksPath
|
|
411
419
|
let lifecycleOwnerSource
|
|
412
420
|
try {
|
|
413
|
-
browserHooksPath = require.resolve('../../datadog-plugin-cypress/src/support')
|
|
421
|
+
browserHooksPath = require.resolve('../../datadog-plugin-cypress/src/support.mjs')
|
|
414
422
|
browserHooksSource = fs.readFileSync(browserHooksPath, 'utf8')
|
|
415
423
|
lifecycleOwnerSource = fs.readFileSync(require.resolve('../../datadog-plugin-cypress/src/lifecycle-owner'), 'utf8')
|
|
416
424
|
} catch (error) {
|
|
@@ -423,6 +431,9 @@ function injectSupportFile (config, manualLifecycle = false) {
|
|
|
423
431
|
}
|
|
424
432
|
|
|
425
433
|
const projectRoot = config.projectRoot
|
|
434
|
+
// Local imports share one bundled module with manual support. External action
|
|
435
|
+
// preloads still need a project-local copy for Vite's filesystem boundary.
|
|
436
|
+
const localBrowserHooks = projectRoot && isPathInside(projectRoot, browserHooksPath) ? browserHooksPath : undefined
|
|
426
437
|
const candidateDirectories = []
|
|
427
438
|
if (originalSupportFile) candidateDirectories.push(path.dirname(originalSupportFile))
|
|
428
439
|
if (projectRoot) candidateDirectories.push(projectRoot)
|
|
@@ -432,7 +443,7 @@ function injectSupportFile (config, manualLifecycle = false) {
|
|
|
432
443
|
if (projectRoot && !isPathInside(projectRoot, directory)) continue
|
|
433
444
|
try {
|
|
434
445
|
const generatedFiles = createSupportWrapper(
|
|
435
|
-
directory, originalSupportFile, browserHooksSource, !!deferLifecycle, lifecycleOwnerSource
|
|
446
|
+
directory, originalSupportFile, browserHooksSource, !!deferLifecycle, lifecycleOwnerSource, localBrowserHooks
|
|
436
447
|
)
|
|
437
448
|
config.supportFile = generatedFiles[1]
|
|
438
449
|
// Shared across SDK copies, but scoped to this exact generated support path.
|
|
@@ -557,4 +557,26 @@ async function processModuleWithResolver (
|
|
|
557
557
|
return setters
|
|
558
558
|
}
|
|
559
559
|
|
|
560
|
-
|
|
560
|
+
/**
|
|
561
|
+
* Generates the IITM registration wrapper used by bundlers. Export bindings come from processModule; IITM owns the
|
|
562
|
+
* export proxy and hook semantics, just as it does for modules wrapped by its Node.js loader.
|
|
563
|
+
*
|
|
564
|
+
* @param {{ path: string, internal?: boolean, specifier?: string, setters: Iterable<string> }} options
|
|
565
|
+
*/
|
|
566
|
+
function createEsmWrapper ({ path, internal, specifier, setters }) {
|
|
567
|
+
const iitmPath = require.resolve('import-in-the-middle/lib/register.js')
|
|
568
|
+
const toRegister = internal ? path : pathToFileURL(path)
|
|
569
|
+
return `
|
|
570
|
+
import { register } from ${JSON.stringify(iitmPath)};
|
|
571
|
+
import * as namespace from ${JSON.stringify(path)};
|
|
572
|
+
const _ = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
573
|
+
const set = {};
|
|
574
|
+
const get = {};
|
|
575
|
+
|
|
576
|
+
${[...setters].join(';\n')};
|
|
577
|
+
|
|
578
|
+
register(${JSON.stringify(toRegister)}, _, set, get, ${JSON.stringify(specifier)});
|
|
579
|
+
`
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
module.exports = { createEsmResolver, createEsmWrapper, driveGetExportsGenerator, processModule }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { format } = require('node:util')
|
|
4
|
+
|
|
5
|
+
const noop = () => {}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} name
|
|
9
|
+
* @returns {import('./bundler-utils').BundlerLog}
|
|
10
|
+
*/
|
|
11
|
+
function createBundlerLog (name) {
|
|
12
|
+
// eslint-disable-next-line eslint-rules/eslint-process-env
|
|
13
|
+
const debug = (process.env.DD_TRACE_DEBUG || '').trim().toLowerCase()
|
|
14
|
+
if (debug !== 'true' && debug !== '1') return { debug: noop, warn: noop }
|
|
15
|
+
|
|
16
|
+
const prefix = `[dd-trace/${name}]`
|
|
17
|
+
return {
|
|
18
|
+
debug (...args) {
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
20
|
+
console.log(formatWithLogPrefix(prefix, ...args))
|
|
21
|
+
},
|
|
22
|
+
warn (...args) {
|
|
23
|
+
// eslint-disable-next-line no-console
|
|
24
|
+
console.warn(formatWithLogPrefix(`${prefix} Warning:`, ...args))
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} prefix
|
|
31
|
+
* @param {unknown} [str]
|
|
32
|
+
* @param {...unknown} args
|
|
33
|
+
*/
|
|
34
|
+
function formatWithLogPrefix (prefix, str, ...args) {
|
|
35
|
+
return typeof str === 'string' ? format(`${prefix} ${str}`, ...args) : format(prefix, str, ...args)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = createBundlerLog
|
|
@@ -89,7 +89,10 @@ function instrument ({ source, resourcePath, inputSourceMap, warn }) {
|
|
|
89
89
|
const target = getTarget(resourcePath, false)
|
|
90
90
|
if (!target || target.kind === 'none') return undefined
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
// Bundlers resolve the injected import from the module ID they passed in, which may be a symlink
|
|
93
|
+
// (for example with preserveSymlinks) whose realpath sits at a different directory depth.
|
|
94
|
+
const importerPath = resourcePath
|
|
95
|
+
const { packageInfo, publications, rewriteTarget } = target
|
|
93
96
|
resourcePath = target.resourcePath
|
|
94
97
|
const esm = packageInfo.esm
|
|
95
98
|
if (publications.length > 0 && hasUnsafeCommonJsBindings(source)) {
|
|
@@ -97,7 +100,7 @@ function instrument ({ source, resourcePath, inputSourceMap, warn }) {
|
|
|
97
100
|
return undefined
|
|
98
101
|
}
|
|
99
102
|
|
|
100
|
-
const dcModule = getDcModule(
|
|
103
|
+
const dcModule = getDcModule(importerPath)
|
|
101
104
|
let code = source
|
|
102
105
|
let sourceMap = inputSourceMap
|
|
103
106
|
let rewritten = false
|
|
@@ -559,12 +562,12 @@ function escapeRegExp (value) {
|
|
|
559
562
|
}
|
|
560
563
|
|
|
561
564
|
/**
|
|
562
|
-
* @param {string}
|
|
565
|
+
* @param {string} importerPath
|
|
563
566
|
*/
|
|
564
|
-
function getDcModule (
|
|
565
|
-
let value = path.relative(path.dirname(
|
|
567
|
+
function getDcModule (importerPath) {
|
|
568
|
+
let value = path.relative(path.dirname(importerPath), require.resolve('dc-polyfill')).replaceAll('\\', '/')
|
|
566
569
|
if (path.isAbsolute(value) || path.win32.isAbsolute(value)) {
|
|
567
|
-
throw new Error(`Cannot create a relative diagnostic-channel import from ${
|
|
570
|
+
throw new Error(`Cannot create a relative diagnostic-channel import from ${importerPath}`)
|
|
568
571
|
}
|
|
569
572
|
if (!value.startsWith('./') && !value.startsWith('../')) value = `./${value}`
|
|
570
573
|
return value
|
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
function noop () {}
|
|
4
|
+
|
|
3
5
|
exports.createWrapFetch = function createWrapFetch (Request, ch, onLoad) {
|
|
6
|
+
/**
|
|
7
|
+
* Rejects an aborted request with the abort reason, once the body it would send is cancelled.
|
|
8
|
+
* @param {Request} req request to send.
|
|
9
|
+
* @param {import('undici-types').RequestInit | undefined} init options that fetch applies over `req`.
|
|
10
|
+
* @param {unknown} reason abort reason.
|
|
11
|
+
* @returns {Promise<never>}
|
|
12
|
+
*/
|
|
13
|
+
function rejectAborted (req, init, reason) {
|
|
14
|
+
try {
|
|
15
|
+
// The request is built only to find the body to cancel.
|
|
16
|
+
const request = init === undefined ? req : new Request(req, init)
|
|
17
|
+
request.body?.cancel(reason).catch(noop)
|
|
18
|
+
} catch {
|
|
19
|
+
// The abort takes precedence over argument errors that fetch would raise, as in the other instrumentations
|
|
20
|
+
// that can abort: the request is not attempted.
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return Promise.reject(reason)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {Function} fetch fetch implementation to call.
|
|
28
|
+
* @param {unknown} thisArg receiver of the fetch call.
|
|
29
|
+
* @param {Request} req request to send, published to subscribers.
|
|
30
|
+
* @param {import('undici-types').RequestInit | undefined} init options that fetch applies over `req`.
|
|
31
|
+
* @param {import('undici-types').RequestInit | undefined} options second argument of the fetch call.
|
|
32
|
+
*/
|
|
33
|
+
function traceFetch (fetch, thisArg, req, init, options) {
|
|
34
|
+
const abortController = new AbortController()
|
|
35
|
+
|
|
36
|
+
return ch.tracePromise(() => {
|
|
37
|
+
const { signal } = abortController
|
|
38
|
+
if (signal.aborted) return rejectAborted(req, init, signal.reason)
|
|
39
|
+
|
|
40
|
+
return fetch.call(thisArg, req, options)
|
|
41
|
+
}, { req, init, abortController })
|
|
42
|
+
}
|
|
43
|
+
|
|
4
44
|
return function wrapFetch (fetch) {
|
|
5
45
|
if (typeof fetch !== 'function') return fetch
|
|
6
46
|
|
|
@@ -13,18 +53,23 @@ exports.createWrapFetch = function createWrapFetch (Request, ch, onLoad) {
|
|
|
13
53
|
if (!ch.start.hasSubscribers) return fetch.apply(this, arguments)
|
|
14
54
|
|
|
15
55
|
if (input instanceof Request) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
56
|
+
// `init` is left for fetch to read once: it can hold one-shot values such as iterators and streams. It can
|
|
57
|
+
// override the method, headers and body of `input`, but not its URL.
|
|
58
|
+
return traceFetch(fetch, this, input, init, init)
|
|
59
|
+
}
|
|
60
|
+
let req
|
|
61
|
+
try {
|
|
62
|
+
req = new Request(input, init)
|
|
63
|
+
} catch (error) {
|
|
64
|
+
// fetch rejects the arguments it can't build a request from, rather than throwing them synchronously
|
|
65
|
+
return Promise.reject(error)
|
|
19
66
|
}
|
|
20
|
-
const req = new Request(input, init)
|
|
21
|
-
const ctx = { req }
|
|
22
67
|
const signal = init?.signal
|
|
23
68
|
|
|
24
69
|
// The signal of `req` only weakly follows `init.signal` and is collected once `req` is unreachable, which
|
|
25
70
|
// stops aborts from reaching the in-flight request. Passing it again lets `fetch` follow it directly.
|
|
26
71
|
const options = signal ? { signal, referrer: req.referrer, referrerPolicy: req.referrerPolicy } : undefined
|
|
27
|
-
return
|
|
72
|
+
return traceFetch(fetch, this, req, undefined, options)
|
|
28
73
|
}
|
|
29
74
|
}
|
|
30
75
|
}
|
|
@@ -199,6 +199,9 @@ function createMatcher (dcModule) {
|
|
|
199
199
|
waitForAsyncEnd,
|
|
200
200
|
} = require('./transforms')
|
|
201
201
|
const {
|
|
202
|
+
postgresNativeCopy,
|
|
203
|
+
postgresNativePreparation,
|
|
204
|
+
postgresNativeTransactionEnd,
|
|
202
205
|
postgresQueryAcquire,
|
|
203
206
|
postgresQueryHandlers,
|
|
204
207
|
postgresQueryLifecycle,
|
|
@@ -216,6 +219,9 @@ function createMatcher (dcModule) {
|
|
|
216
219
|
matcher.addTransform('configureGraphqlJitRuntime', configureGraphqlJitRuntime)
|
|
217
220
|
matcher.addTransform('configureMercuriusRequest', configureMercuriusRequest)
|
|
218
221
|
matcher.addTransform('publishDurableOrchestrationFailure', publishDurableOrchestrationFailure)
|
|
222
|
+
matcher.addTransform('postgresNativeCopy', postgresNativeCopy)
|
|
223
|
+
matcher.addTransform('postgresNativePreparation', postgresNativePreparation)
|
|
224
|
+
matcher.addTransform('postgresNativeTransactionEnd', postgresNativeTransactionEnd)
|
|
219
225
|
matcher.addTransform('postgresQueryAcquire', postgresQueryAcquire)
|
|
220
226
|
matcher.addTransform('publishTrpcRequestInfo', publishTrpcRequestInfo)
|
|
221
227
|
matcher.addTransform('postgresQueryHandlers', postgresQueryHandlers)
|
|
@@ -42,6 +42,14 @@ const registry = [
|
|
|
42
42
|
{ activate: true, instrumentations: require('./instrumentations/langgraph') },
|
|
43
43
|
{ activate: true, instrumentations: require('./instrumentations/mercurius') },
|
|
44
44
|
{ instrumentations: require('./instrumentations/modelcontextprotocol-sdk') },
|
|
45
|
+
{
|
|
46
|
+
activate: { setup: () => require('../../modelcontextprotocol-client') },
|
|
47
|
+
instrumentations: require('./instrumentations/modelcontextprotocol-client'),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
activate: { setup: () => require('../../modelcontextprotocol-server') },
|
|
51
|
+
instrumentations: require('./instrumentations/modelcontextprotocol-server'),
|
|
52
|
+
},
|
|
45
53
|
{ instrumentations: require('./instrumentations/next') },
|
|
46
54
|
{ instrumentations: require('./instrumentations/openai-agents') },
|
|
47
55
|
{
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// SDK 2.x bundles Client into `dist/index` up to 2.3, and into a `public-<hash>` chunk from 2.4.
|
|
4
|
+
const CLIENT_FILES = [
|
|
5
|
+
{ versionRange: '>=2 <2.4.0', filePath: /^dist\/index\.[cm]js$/ },
|
|
6
|
+
{ versionRange: '>=2.4.0', filePath: /^dist\/public-[\w-]+\.[cm]js$/ },
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
const CLIENT_METHODS = [
|
|
10
|
+
'callTool',
|
|
11
|
+
'listTools',
|
|
12
|
+
'listResources',
|
|
13
|
+
'readResource',
|
|
14
|
+
'listPrompts',
|
|
15
|
+
'getPrompt',
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
module.exports = [
|
|
19
|
+
...CLIENT_FILES.flatMap(({ versionRange, filePath }) => CLIENT_METHODS.map(methodName => ({
|
|
20
|
+
module: { name: '@modelcontextprotocol/client', versionRange, filePath },
|
|
21
|
+
functionQuery: { methodName, className: 'Client', kind: 'Async' },
|
|
22
|
+
channelName: `Client_${methodName}`,
|
|
23
|
+
}))),
|
|
24
|
+
// Every 2.x release bundles Protocol into a `src-<hash>` chunk.
|
|
25
|
+
{
|
|
26
|
+
module: { name: '@modelcontextprotocol/client', versionRange: '>=2', filePath: /^dist\/src-[\w-]+\.[cm]js$/ },
|
|
27
|
+
functionQuery: { methodName: 'request', className: 'Protocol', kind: 'Sync' },
|
|
28
|
+
channelName: 'Protocol_request',
|
|
29
|
+
},
|
|
30
|
+
]
|