dd-trace 5.82.0 → 5.84.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/LICENSE-3rdparty.csv +77 -79
- package/ci/init.js +6 -6
- package/index.d.ts +213 -4
- package/loader-hook.mjs +1 -1
- package/package.json +59 -56
- package/packages/datadog-core/src/storage.js +7 -7
- package/packages/datadog-esbuild/index.js +6 -0
- package/packages/datadog-instrumentations/src/ai.js +7 -3
- package/packages/datadog-instrumentations/src/child_process.js +1 -1
- package/packages/datadog-instrumentations/src/cucumber.js +1 -1
- package/packages/datadog-instrumentations/src/graphql.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/instrumentations.js +4 -3
- package/packages/datadog-instrumentations/src/helpers/register.js +3 -7
- package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +6 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +2 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +73 -16
- package/packages/datadog-instrumentations/src/http/client.js +2 -2
- package/packages/datadog-instrumentations/src/jest.js +124 -64
- package/packages/datadog-instrumentations/src/koa.js +2 -1
- package/packages/datadog-instrumentations/src/light-my-request.js +2 -2
- package/packages/datadog-instrumentations/src/mocha/main.js +2 -2
- package/packages/datadog-instrumentations/src/mocha/worker.js +1 -1
- package/packages/datadog-instrumentations/src/mocha.js +1 -1
- package/packages/datadog-instrumentations/src/mysql.js +1 -1
- package/packages/datadog-instrumentations/src/mysql2.js +2 -2
- package/packages/datadog-instrumentations/src/net.js +13 -5
- package/packages/datadog-instrumentations/src/nyc.js +1 -1
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +4 -4
- package/packages/datadog-instrumentations/src/pg.js +4 -2
- package/packages/datadog-instrumentations/src/playwright.js +15 -11
- package/packages/datadog-instrumentations/src/selenium.js +2 -2
- package/packages/datadog-instrumentations/src/undici.js +12 -1
- package/packages/datadog-plugin-aws-sdk/src/base.js +4 -4
- package/packages/datadog-plugin-azure-event-hubs/src/producer.js +2 -2
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +2 -2
- package/packages/datadog-plugin-cucumber/src/index.js +35 -34
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +2 -2
- package/packages/datadog-plugin-dd-trace-api/src/index.js +2 -2
- package/packages/datadog-plugin-express/src/code_origin.js +21 -15
- package/packages/datadog-plugin-fastify/src/code_origin.js +17 -4
- package/packages/datadog-plugin-jest/src/index.js +2 -2
- package/packages/datadog-plugin-mocha/src/index.js +2 -2
- package/packages/datadog-plugin-mongodb-core/src/index.js +2 -2
- package/packages/datadog-plugin-playwright/src/index.js +26 -26
- package/packages/datadog-plugin-undici/src/index.js +305 -2
- package/packages/datadog-plugin-vitest/src/index.js +5 -5
- package/packages/datadog-shimmer/src/shimmer.js +2 -5
- package/packages/dd-trace/index.js +19 -0
- package/packages/dd-trace/src/agent/info.js +57 -0
- package/packages/dd-trace/src/agent/url.js +28 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +1 -1
- package/packages/dd-trace/src/appsec/index.js +47 -7
- package/packages/dd-trace/src/appsec/rasp/index.js +2 -4
- package/packages/dd-trace/src/azure_metadata.js +8 -3
- package/packages/dd-trace/src/baggage.js +36 -11
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +5 -1
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +3 -4
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +5 -5
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +5 -11
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +3 -3
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +4 -4
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/writer.js +1 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -2
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +4 -4
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +4 -4
- package/packages/dd-trace/src/ci-visibility/telemetry.js +6 -2
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +2 -2
- package/packages/dd-trace/src/{config_defaults.js → config/defaults.js} +3 -3
- package/packages/dd-trace/src/{config-helper.js → config/helper.js} +88 -15
- package/packages/dd-trace/src/{config.js → config/index.js} +107 -46
- package/packages/dd-trace/src/config/remote_config.js +188 -19
- package/packages/dd-trace/src/{config_stable.js → config/stable.js} +20 -32
- package/packages/dd-trace/src/{supported-configurations.json → config/supported-configurations.json} +3 -1
- package/packages/dd-trace/src/crashtracking/crashtracker.js +2 -5
- package/packages/dd-trace/src/datastreams/processor.js +1 -1
- package/packages/dd-trace/src/datastreams/writer.js +2 -8
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/config.js +2 -7
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +10 -11
- package/packages/dd-trace/src/debugger/devtools_client/send.js +3 -3
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/constants.js +1 -1
- package/packages/dd-trace/src/debugger/index.js +83 -15
- package/packages/dd-trace/src/dogstatsd.js +5 -11
- package/packages/dd-trace/src/encode/0.4.js +2 -2
- package/packages/dd-trace/src/exporter.js +1 -1
- package/packages/dd-trace/src/exporters/agent/index.js +5 -11
- package/packages/dd-trace/src/exporters/agent/writer.js +12 -16
- package/packages/dd-trace/src/exporters/common/{agent-info-exporter.js → buffering-exporter.js} +10 -37
- package/packages/dd-trace/src/exporters/common/docker.js +2 -2
- package/packages/dd-trace/src/exporters/common/request.js +1 -1
- package/packages/dd-trace/src/exporters/common/util.js +2 -2
- package/packages/dd-trace/src/exporters/span-stats/index.js +3 -10
- package/packages/dd-trace/src/flare/index.js +1 -1
- package/packages/dd-trace/src/guardrails/telemetry.js +1 -1
- package/packages/dd-trace/src/index.js +4 -4
- package/packages/dd-trace/src/lambda/handler.js +2 -2
- package/packages/dd-trace/src/lambda/index.js +2 -2
- package/packages/dd-trace/src/lambda/runtime/patch.js +2 -2
- package/packages/dd-trace/src/lambda/runtime/ritm.js +2 -2
- package/packages/dd-trace/src/llmobs/constants/tags.js +8 -1
- package/packages/dd-trace/src/llmobs/index.js +2 -2
- package/packages/dd-trace/src/llmobs/noop.js +2 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +3 -4
- package/packages/dd-trace/src/llmobs/sdk.js +33 -6
- package/packages/dd-trace/src/llmobs/span_processor.js +17 -7
- package/packages/dd-trace/src/llmobs/tagger.js +175 -1
- package/packages/dd-trace/src/llmobs/writers/base.js +118 -45
- package/packages/dd-trace/src/llmobs/writers/spans.js +4 -3
- package/packages/dd-trace/src/llmobs/writers/util.js +3 -9
- package/packages/dd-trace/src/log/index.js +50 -35
- package/packages/dd-trace/src/log/writer.js +13 -78
- package/packages/dd-trace/src/noop/proxy.js +3 -3
- package/packages/dd-trace/src/openfeature/writers/base.js +9 -16
- package/packages/dd-trace/src/openfeature/writers/util.js +3 -8
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +2 -2
- package/packages/dd-trace/src/opentelemetry/tracer.js +48 -6
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +45 -21
- package/packages/dd-trace/src/opentracing/span.js +4 -4
- package/packages/dd-trace/src/plugin_manager.js +8 -6
- package/packages/dd-trace/src/plugins/util/ci.js +5 -8
- package/packages/dd-trace/src/plugins/util/git-cache.js +3 -3
- package/packages/dd-trace/src/plugins/util/test.js +1 -1
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +41 -43
- package/packages/dd-trace/src/profiler.js +4 -39
- package/packages/dd-trace/src/profiling/config.js +74 -34
- package/packages/dd-trace/src/profiling/exporter_cli.js +5 -5
- package/packages/dd-trace/src/profiling/exporters/agent.js +1 -1
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +9 -2
- package/packages/dd-trace/src/profiling/index.js +1 -1
- package/packages/dd-trace/src/profiling/libuv-size.js +1 -1
- package/packages/dd-trace/src/profiling/profiler.js +57 -2
- package/packages/dd-trace/src/proxy.js +34 -5
- package/packages/dd-trace/src/remote_config/capabilities.js +4 -0
- package/packages/dd-trace/src/remote_config/index.js +2 -7
- package/packages/dd-trace/src/ritm.js +8 -4
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +2 -2
- package/packages/dd-trace/src/serverless.js +2 -2
- package/packages/dd-trace/src/span_processor.js +2 -2
- package/packages/dd-trace/src/startup-log.js +7 -16
- package/packages/dd-trace/src/telemetry/endpoints.js +67 -5
- package/packages/dd-trace/src/telemetry/send-data.js +103 -4
- package/packages/dd-trace/src/telemetry/telemetry.js +229 -110
- package/vendor/dist/@isaacs/ttlcache/index.js +1 -1
- package/vendor/dist/esquery/index.js +1 -1
- package/vendor/dist/meriyah/index.js +1 -1
- package/vendor/dist/protobufjs/index.js +1 -1
- /package/packages/dd-trace/src/{git_properties.js → config/git_properties.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.84.0",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -18,61 +18,64 @@
|
|
|
18
18
|
"lint:inspect": "npx @eslint/config-inspector@latest",
|
|
19
19
|
"release:proposal": "node scripts/release/proposal",
|
|
20
20
|
"services": "node ./scripts/install_plugin_modules && node packages/dd-trace/test/setup/services",
|
|
21
|
-
"test": "
|
|
22
|
-
"test:aiguard": "mocha
|
|
21
|
+
"test": "echo '\nError: The root \"npm test\" command is intentionally disabled.\n\nInstead, run specific test suites:\n - npm run test:trace:core\n - npm run test:appsec\n - etc.\n\nOr run individual test files:\n npx mocha path/to/test.spec.js\n\nSee CONTRIBUTING.md (Testing section) for more details.\n' && exit 1",
|
|
22
|
+
"test:aiguard": "mocha packages/dd-trace/test/aiguard/**/*.spec.js",
|
|
23
23
|
"test:aiguard:ci": "nyc --no-clean --include \"packages/dd-trace/src/aiguard/**/*.js\" -- npm run test:aiguard",
|
|
24
|
-
"test:appsec": "mocha
|
|
24
|
+
"test:appsec": "mocha --exclude \"packages/dd-trace/test/appsec/**/*.plugin.spec.js\" \"packages/dd-trace/test/appsec/**/*.spec.js\"",
|
|
25
25
|
"test:appsec:ci": "nyc --no-clean --include \"packages/dd-trace/src/appsec/**/*.js\" --exclude \"packages/dd-trace/test/appsec/**/*.plugin.spec.js\" -- npm run test:appsec",
|
|
26
|
-
"test:appsec:plugins": "mocha
|
|
26
|
+
"test:appsec:plugins": "mocha \"packages/dd-trace/test/appsec/**/*.@(${PLUGINS}).plugin.spec.js\"",
|
|
27
27
|
"test:appsec:plugins:ci": "yarn services && nyc --no-clean --include \"packages/dd-trace/src/appsec/**/*.js\" -- npm run test:appsec:plugins",
|
|
28
|
-
"test:debugger": "mocha
|
|
29
|
-
"test:debugger:ci": "nyc --no-clean --include
|
|
28
|
+
"test:debugger": "mocha packages/dd-trace/test/debugger/**/*.spec.js",
|
|
29
|
+
"test:debugger:ci": "nyc --no-clean --include \"packages/dd-trace/src/debugger/**/*.js\" -- npm run test:debugger",
|
|
30
30
|
"test:eslint-rules": "node eslint-rules/*.test.mjs",
|
|
31
|
-
"test:trace:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 --
|
|
31
|
+
"test:trace:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- \"packages/dd-trace/test/*.spec.js\" \"packages/dd-trace/test/{agent,ci-visibility,config,crashtracking,datastreams,encode,exporters,msgpack,opentelemetry,opentracing,payload-tagging,plugins,remote_config,service-naming,standalone,telemetry,external-logger}/**/*.spec.js\"",
|
|
32
32
|
"test:trace:core:ci": "nyc --no-clean --include \"packages/dd-trace/src/**/*.js\" -- npm run test:trace:core",
|
|
33
|
-
"test:trace:guardrails": "mocha
|
|
33
|
+
"test:trace:guardrails": "mocha packages/dd-trace/test/guardrails/**/*.spec.js",
|
|
34
34
|
"test:trace:guardrails:ci": "nyc --no-clean --include \"packages/dd-trace/src/guardrails/**/*.js\" -- npm run test:trace:guardrails",
|
|
35
|
-
"test:esbuild": "mocha
|
|
35
|
+
"test:esbuild": "mocha packages/datadog-esbuild/test/**/*.spec.js",
|
|
36
36
|
"test:esbuild:ci": "nyc --no-clean --include \"packages/datadog-esbuild/test/**/*.js\" -- npm run test:esbuild",
|
|
37
|
-
"test:instrumentations": "mocha
|
|
38
|
-
"test:instrumentations:ci": "yarn services && nyc --no-clean --include \"packages/datadog-instrumentations/src/@($
|
|
39
|
-
"test:instrumentations:misc": "mocha
|
|
40
|
-
"test:instrumentations:misc:ci": "nyc --no-clean --include
|
|
41
|
-
"test:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 --
|
|
37
|
+
"test:instrumentations": "mocha \"packages/datadog-instrumentations/test/@(${PLUGINS}).spec.js\"",
|
|
38
|
+
"test:instrumentations:ci": "yarn services && nyc --no-clean --include \"packages/datadog-instrumentations/src/@(${PLUGINS}).js\" --include \"packages/datadog-instrumentations/src/@(${PLUGINS})/**/*.js\" -- npm run test:instrumentations",
|
|
39
|
+
"test:instrumentations:misc": "mocha packages/datadog-instrumentations/test/*/**/*.spec.js",
|
|
40
|
+
"test:instrumentations:misc:ci": "nyc --no-clean --include \"packages/datadog-instrumentations/src/**/*.js\" -- npm run test:instrumentations:misc",
|
|
41
|
+
"test:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- packages/datadog-core/test/**/*.spec.js",
|
|
42
42
|
"test:core:ci": "nyc --no-clean --include \"packages/datadog-core/src/**/*.js\" -- npm run test:core",
|
|
43
|
-
"test:
|
|
43
|
+
"test:code-origin": "mocha packages/datadog-code-origin/test/**/*.spec.js",
|
|
44
|
+
"test:code-origin:ci": "nyc --no-clean --include \"packages/datadog-code-origin/**/*.js\" -- npm run test:code-origin",
|
|
45
|
+
"test:lambda": "mocha packages/dd-trace/test/lambda/**/*.spec.js",
|
|
44
46
|
"test:lambda:ci": "nyc --no-clean --include \"packages/dd-trace/src/lambda/**/*.js\" -- npm run test:lambda",
|
|
45
|
-
"test:llmobs:sdk": "mocha
|
|
47
|
+
"test:llmobs:sdk": "mocha --exclude \"packages/dd-trace/test/llmobs/plugins/**/*.spec.js\" \"packages/dd-trace/test/llmobs/**/*.spec.js\"",
|
|
46
48
|
"test:llmobs:sdk:ci": "nyc --no-clean --include \"packages/dd-trace/src/llmobs/**/*.js\" -- npm run test:llmobs:sdk",
|
|
47
|
-
"test:llmobs:plugins": "mocha
|
|
49
|
+
"test:llmobs:plugins": "mocha \"packages/dd-trace/test/llmobs/plugins/@(${PLUGINS})/*.spec.js\"",
|
|
48
50
|
"test:llmobs:plugins:ci": "yarn services && nyc --no-clean --include \"packages/dd-trace/src/llmobs/**/*.js\" -- npm run test:llmobs:plugins",
|
|
49
|
-
"test:openfeature": "mocha
|
|
51
|
+
"test:openfeature": "mocha packages/dd-trace/test/openfeature/**/*.spec.js",
|
|
50
52
|
"test:openfeature:ci": "nyc --no-clean --include \"packages/dd-trace/src/openfeature/**/*.js\" -- npm run test:openfeature",
|
|
51
|
-
"test:plugins": "
|
|
52
|
-
"test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@($
|
|
53
|
-
"test:plugins:ci:flaky": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@($
|
|
53
|
+
"test:plugins": "node --expose-gc ./node_modules/mocha/bin/mocha.js \"packages/datadog-plugin-@(${PLUGINS})/test/**/${SPEC:-*}*.spec.js\"",
|
|
54
|
+
"test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@(${PLUGINS})/src/**/*.js\" -- npm run test:plugins",
|
|
55
|
+
"test:plugins:ci:flaky": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@(${PLUGINS})/src/**/*.js\" -- npm run test:plugins -- --bail --retries 2",
|
|
54
56
|
"test:plugins:upstream": "node ./packages/dd-trace/test/plugins/suite.js",
|
|
55
|
-
"test:profiler": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 --
|
|
57
|
+
"test:profiler": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- packages/dd-trace/test/profiling/**/*.spec.js",
|
|
56
58
|
"test:profiler:ci": "nyc --no-clean --include \"packages/dd-trace/src/profiling/**/*.js\" -- npm run test:profiler",
|
|
57
|
-
"test:integration": "mocha --timeout 60000
|
|
58
|
-
"test:integration:aiguard": "mocha --timeout 60000
|
|
59
|
-
"test:integration:appsec": "mocha --timeout 60000
|
|
60
|
-
"test:integration:cucumber": "mocha --timeout 60000
|
|
61
|
-
"test:integration:cypress": "mocha --timeout 60000
|
|
62
|
-
"test:integration:debugger": "mocha --timeout 60000
|
|
63
|
-
"test:integration:esbuild": "mocha --timeout 60000
|
|
64
|
-
"test:integration:openfeature": "mocha --timeout 60000
|
|
65
|
-
"test:integration:jest": "mocha --timeout 60000
|
|
66
|
-
"test:integration:mocha": "mocha --timeout 60000
|
|
67
|
-
"test:integration:playwright": "mocha --timeout 60000
|
|
68
|
-
"test:integration:selenium": "mocha --timeout 60000
|
|
69
|
-
"test:integration:vitest": "mocha --timeout 60000
|
|
70
|
-
"test:integration:testopt": "mocha --timeout 120000
|
|
71
|
-
"test:integration:profiler": "mocha --timeout 180000
|
|
72
|
-
"test:integration:plugins": "mocha
|
|
73
|
-
"test:unit:plugins": "mocha
|
|
74
|
-
"test:shimmer": "mocha
|
|
75
|
-
"test:shimmer:ci": "nyc --no-clean --include
|
|
59
|
+
"test:integration": "mocha --timeout 60000 \"integration-tests/*.spec.js\"",
|
|
60
|
+
"test:integration:aiguard": "mocha --timeout 60000 \"integration-tests/aiguard/*.spec.js\"",
|
|
61
|
+
"test:integration:appsec": "mocha --timeout 60000 \"integration-tests/appsec/*.spec.js\"",
|
|
62
|
+
"test:integration:cucumber": "mocha --timeout 60000 \"integration-tests/cucumber/*.spec.js\"",
|
|
63
|
+
"test:integration:cypress": "mocha --timeout 60000 \"integration-tests/cypress/*.spec.js\"",
|
|
64
|
+
"test:integration:debugger": "mocha --timeout 60000 \"integration-tests/debugger/*.spec.js\"",
|
|
65
|
+
"test:integration:esbuild": "mocha --timeout 60000 \"integration-tests/esbuild/*.spec.js\"",
|
|
66
|
+
"test:integration:openfeature": "mocha --timeout 60000 \"integration-tests/openfeature/*.spec.js\"",
|
|
67
|
+
"test:integration:jest": "mocha --timeout 60000 \"integration-tests/jest/*.spec.js\"",
|
|
68
|
+
"test:integration:mocha": "mocha --timeout 60000 \"integration-tests/mocha/*.spec.js\"",
|
|
69
|
+
"test:integration:playwright": "mocha --timeout 60000 \"integration-tests/playwright/*.spec.js\"",
|
|
70
|
+
"test:integration:selenium": "mocha --timeout 60000 \"integration-tests/selenium/*.spec.js\"",
|
|
71
|
+
"test:integration:vitest": "mocha --timeout 60000 \"integration-tests/vitest/*.spec.js\"",
|
|
72
|
+
"test:integration:testopt": "mocha --timeout 120000 \"integration-tests/ci-visibility/*.spec.js\"",
|
|
73
|
+
"test:integration:profiler": "mocha --timeout 180000 \"integration-tests/profiler/*.spec.js\"",
|
|
74
|
+
"test:integration:plugins": "mocha \"packages/datadog-plugin-@($(echo $PLUGINS))/test/integration-test/**/*.spec.js\"",
|
|
75
|
+
"test:unit:plugins": "mocha \"packages/datadog-instrumentations/test/@($(echo $PLUGINS)).spec.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\" --exclude \"packages/datadog-plugin-@($(echo $PLUGINS))/test/integration-test/**/*.spec.js\"",
|
|
76
|
+
"test:shimmer": "mocha \"packages/datadog-shimmer/test/**/*.spec.js\"",
|
|
77
|
+
"test:shimmer:ci": "nyc --no-clean --include \"packages/datadog-shimmer/src/**/*.js\" -- npm run test:shimmer",
|
|
78
|
+
"verify-exercised-tests": "node scripts/verify-exercised-tests.js"
|
|
76
79
|
},
|
|
77
80
|
"repository": {
|
|
78
81
|
"type": "git",
|
|
@@ -127,45 +130,45 @@
|
|
|
127
130
|
],
|
|
128
131
|
"dependencies": {
|
|
129
132
|
"dc-polyfill": "^0.1.10",
|
|
130
|
-
"import-in-the-middle": "2.0.
|
|
133
|
+
"import-in-the-middle": "2.0.3"
|
|
131
134
|
},
|
|
132
135
|
"optionalDependencies": {
|
|
133
136
|
"@datadog/libdatadog": "0.7.0",
|
|
134
137
|
"@datadog/native-appsec": "10.3.0",
|
|
135
138
|
"@datadog/native-iast-taint-tracking": "4.1.0",
|
|
136
139
|
"@datadog/native-metrics": "3.1.1",
|
|
137
|
-
"@datadog/openfeature-node-server": "^0.
|
|
138
|
-
"@datadog/pprof": "5.13.
|
|
140
|
+
"@datadog/openfeature-node-server": "^0.3.3",
|
|
141
|
+
"@datadog/pprof": "5.13.2",
|
|
139
142
|
"@datadog/wasm-js-rewriter": "5.0.1",
|
|
140
143
|
"@opentelemetry/api": ">=1.0.0 <1.10.0",
|
|
141
144
|
"@opentelemetry/api-logs": "<1.0.0"
|
|
142
145
|
},
|
|
143
146
|
"devDependencies": {
|
|
144
|
-
"@babel/helpers": "^7.28.
|
|
147
|
+
"@babel/helpers": "^7.28.6",
|
|
145
148
|
"@eslint/eslintrc": "^3.3.1",
|
|
146
|
-
"@eslint/js": "^9.39.
|
|
147
|
-
"@msgpack/msgpack": "^3.1.
|
|
149
|
+
"@eslint/js": "^9.39.2",
|
|
150
|
+
"@msgpack/msgpack": "^3.1.3",
|
|
148
151
|
"@openfeature/core": "^1.8.1",
|
|
149
152
|
"@openfeature/server-sdk": "~1.20.0",
|
|
150
|
-
"@stylistic/eslint-plugin": "^5.
|
|
153
|
+
"@stylistic/eslint-plugin": "^5.7.0",
|
|
151
154
|
"@types/mocha": "^10.0.10",
|
|
152
155
|
"@types/node": "^18.19.106",
|
|
153
156
|
"@types/sinon": "^21.0.0",
|
|
154
157
|
"axios": "^1.12.2",
|
|
155
158
|
"benchmark": "^2.1.4",
|
|
156
|
-
"body-parser": "^2.2.
|
|
157
|
-
"bun": "1.3.
|
|
158
|
-
"eslint": "^9.39.
|
|
159
|
-
"eslint-plugin-cypress": "^5.2.
|
|
159
|
+
"body-parser": "^2.2.2",
|
|
160
|
+
"bun": "1.3.6",
|
|
161
|
+
"eslint": "^9.39.2",
|
|
162
|
+
"eslint-plugin-cypress": "^5.2.1",
|
|
160
163
|
"eslint-plugin-import": "^2.32.0",
|
|
161
|
-
"eslint-plugin-jsdoc": "^
|
|
164
|
+
"eslint-plugin-jsdoc": "^62.0.0",
|
|
162
165
|
"eslint-plugin-mocha": "^11.2.0",
|
|
163
|
-
"eslint-plugin-n": "^17.23.
|
|
166
|
+
"eslint-plugin-n": "^17.23.2",
|
|
164
167
|
"eslint-plugin-promise": "^7.2.1",
|
|
165
168
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
166
169
|
"express": "^5.1.0",
|
|
167
170
|
"glob": "^10.4.5",
|
|
168
|
-
"globals": "^
|
|
171
|
+
"globals": "^17.0.0",
|
|
169
172
|
"graphql": "*",
|
|
170
173
|
"jszip": "^3.10.1",
|
|
171
174
|
"mocha": "^11.6.0",
|
|
@@ -10,12 +10,12 @@ const { AsyncLocalStorage } = require('async_hooks')
|
|
|
10
10
|
* a "handle" object, which is used as a key in a WeakMap, where the values
|
|
11
11
|
* are the real store objects.
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @template T
|
|
14
|
+
* @typedef {Record<string, T>} Store
|
|
14
15
|
*/
|
|
15
16
|
class DatadogStorage extends AsyncLocalStorage {
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @param {Store} [store]
|
|
18
|
+
* @param {Store<unknown>} [store]
|
|
19
19
|
* @override
|
|
20
20
|
*/
|
|
21
21
|
enterWith (store) {
|
|
@@ -35,7 +35,7 @@ class DatadogStorage extends AsyncLocalStorage {
|
|
|
35
35
|
*
|
|
36
36
|
* TODO: Refactor the Scope class to use a span-only store and remove this.
|
|
37
37
|
*
|
|
38
|
-
* @returns {Store}
|
|
38
|
+
* @returns {Store<unknown>}
|
|
39
39
|
*/
|
|
40
40
|
getHandle () {
|
|
41
41
|
return super.getStore()
|
|
@@ -48,7 +48,7 @@ class DatadogStorage extends AsyncLocalStorage {
|
|
|
48
48
|
* key. This is useful if you've stashed a handle somewhere and want to
|
|
49
49
|
* retrieve the store with it.
|
|
50
50
|
* @param {object} [handle]
|
|
51
|
-
* @returns {Store | undefined}
|
|
51
|
+
* @returns {Store<unknown> | undefined}
|
|
52
52
|
* @override
|
|
53
53
|
*/
|
|
54
54
|
getStore (handle) {
|
|
@@ -68,7 +68,7 @@ class DatadogStorage extends AsyncLocalStorage {
|
|
|
68
68
|
* WeakMap.
|
|
69
69
|
* @template R
|
|
70
70
|
* @template TArgs = unknown[]
|
|
71
|
-
* @param {Store} store
|
|
71
|
+
* @param {Store<unknown>} store
|
|
72
72
|
* @param {() => R} fn
|
|
73
73
|
* @param {...TArgs} args
|
|
74
74
|
* @returns {R}
|
|
@@ -87,7 +87,7 @@ class DatadogStorage extends AsyncLocalStorage {
|
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* This is the map from handles to real stores, used in the class above.
|
|
90
|
-
* @type {WeakMap<WeakKey, Store
|
|
90
|
+
* @type {WeakMap<WeakKey, Store<unknown>|undefined>}
|
|
91
91
|
*/
|
|
92
92
|
const stores = new WeakMap()
|
|
93
93
|
|
|
@@ -97,6 +97,12 @@ function getGitMetadata () {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
module.exports.setup = function (build) {
|
|
100
|
+
if (build.initialOptions.minify && !build.initialOptions.keepNames) {
|
|
101
|
+
throw new Error(
|
|
102
|
+
'Using --minify without --keep-names will break some dd-trace behavior. Refusing to bundle.'
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
100
106
|
if (DD_IAST_ENABLED) {
|
|
101
107
|
const iastRewriter = require('../dd-trace/src/appsec/iast/taint-tracking/rewriter')
|
|
102
108
|
rewriter = iastRewriter.getRewriter()
|
|
@@ -41,8 +41,14 @@ const noopTracer = {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
const tracers = new WeakSet()
|
|
45
|
+
|
|
44
46
|
function wrapTracer (tracer) {
|
|
45
|
-
if (
|
|
47
|
+
if (tracers.has(tracer)) {
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
tracers.add(tracer)
|
|
46
52
|
|
|
47
53
|
shimmer.wrap(tracer, 'startActiveSpan', function (startActiveSpan) {
|
|
48
54
|
return function () {
|
|
@@ -90,8 +96,6 @@ function wrapTracer (tracer) {
|
|
|
90
96
|
})
|
|
91
97
|
}
|
|
92
98
|
})
|
|
93
|
-
|
|
94
|
-
Object.defineProperty(tracer, Symbol.for('_dd.wrapped'), { value: true })
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
function wrapWithTracer (fn) {
|
|
@@ -214,7 +214,7 @@ function wrapChildProcessAsyncMethod (ChildProcess, shell = false) {
|
|
|
214
214
|
childProcessChannel.error.publish(context)
|
|
215
215
|
})
|
|
216
216
|
|
|
217
|
-
childProcess.
|
|
217
|
+
childProcess.once('close', (code = 0) => {
|
|
218
218
|
if (!errorExecuted && code !== 0) {
|
|
219
219
|
childProcessChannel.error.publish(context)
|
|
220
220
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { createCoverageMap } = require('../../../vendor/dist/istanbul-lib-coverage')
|
|
4
4
|
const shimmer = require('../../datadog-shimmer')
|
|
5
5
|
const log = require('../../dd-trace/src/log')
|
|
6
|
-
const { getEnvironmentVariable } = require('../../dd-trace/src/config
|
|
6
|
+
const { getEnvironmentVariable } = require('../../dd-trace/src/config/helper')
|
|
7
7
|
const {
|
|
8
8
|
getCoveredFilenamesFromCoverage,
|
|
9
9
|
resetCoverage,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
// Use a global symbol to prevent stealthy-require to interfere.
|
|
4
|
+
// TODO: Use the symbol from dd-trace instead and remove this file.
|
|
3
5
|
const sym = Symbol.for('_ddtrace_instrumentations')
|
|
6
|
+
globalThis[sym] ??= {}
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
module.exports = global[sym]
|
|
8
|
+
module.exports = globalThis[sym]
|
|
@@ -7,18 +7,14 @@ const requirePackageJson = require('../../../dd-trace/src/require-package-json')
|
|
|
7
7
|
const log = require('../../../dd-trace/src/log')
|
|
8
8
|
const telemetry = require('../../../dd-trace/src/guardrails/telemetry')
|
|
9
9
|
const { isInServerlessEnvironment } = require('../../../dd-trace/src/serverless')
|
|
10
|
-
const {
|
|
10
|
+
const { getValueFromEnvSources } = require('../../../dd-trace/src/config/helper')
|
|
11
11
|
const checkRequireCache = require('./check-require-cache')
|
|
12
12
|
const Hook = require('./hook')
|
|
13
13
|
const { isRelativeRequire } = require('./shared-utils')
|
|
14
14
|
const rewriter = require('./rewriter')
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const {
|
|
19
|
-
DD_TRACE_DISABLED_INSTRUMENTATIONS = '',
|
|
20
|
-
DD_TRACE_DEBUG = ''
|
|
21
|
-
} = envs
|
|
16
|
+
const DD_TRACE_DISABLED_INSTRUMENTATIONS = getValueFromEnvSources('DD_TRACE_DISABLED_INSTRUMENTATIONS') || ''
|
|
17
|
+
const DD_TRACE_DEBUG = getValueFromEnvSources('DD_TRACE_DEBUG') || ''
|
|
22
18
|
|
|
23
19
|
const hooks = require('./hooks')
|
|
24
20
|
const instrumentations = require('./instrumentations')
|
|
@@ -35,7 +35,7 @@ const { readFileSync } = require('fs')
|
|
|
35
35
|
const { join } = require('path')
|
|
36
36
|
const semifies = require('../../../../../vendor/dist/semifies')
|
|
37
37
|
const log = require('../../../../dd-trace/src/log')
|
|
38
|
-
const { getEnvironmentVariable } = require('../../../../dd-trace/src/config
|
|
38
|
+
const { getEnvironmentVariable } = require('../../../../dd-trace/src/config/helper')
|
|
39
39
|
const transforms = require('./transforms')
|
|
40
40
|
const { generate, parse, traverse } = require('./compiler')
|
|
41
41
|
const instrumentations = require('./instrumentations')
|
|
@@ -127,6 +127,7 @@ function fromFunctionQuery (functionQuery) {
|
|
|
127
127
|
if (className) {
|
|
128
128
|
queries.push(
|
|
129
129
|
`[id.name="${className}"]`,
|
|
130
|
+
`[id.name="${className}"] > ClassExpression`,
|
|
130
131
|
`[id.name="${className}"] > ClassBody > [key.name="${methodName}"] > [async]`,
|
|
131
132
|
`[id.name="${className}"] > ClassExpression > ClassBody > [key.name="${methodName}"] > [async]`
|
|
132
133
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { parse } = require('./compiler')
|
|
3
|
+
const { parse, query } = require('./compiler')
|
|
4
4
|
|
|
5
5
|
const tracingChannelPredicate = (node) => (
|
|
6
6
|
node.specifiers?.[0]?.local?.name === 'tr_ch_apm_tracingChannel' ||
|
|
@@ -106,34 +106,91 @@ function traceInstanceMethod (state, node, program) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
function wrap (state, node) {
|
|
109
|
-
const { channelName, operator
|
|
109
|
+
const { channelName, operator } = state
|
|
110
|
+
|
|
111
|
+
if (operator === 'traceCallback') return wrapCallback(state, node)
|
|
112
|
+
|
|
110
113
|
const async = operator === 'tracePromise' ? 'async' : ''
|
|
111
114
|
const channelVariable = 'tr_ch_apm$' + channelName.replaceAll(':', '_')
|
|
112
|
-
const tracedArgs = operator === 'traceCallback'
|
|
113
|
-
? `__apm$original_args.splice(${index}, 1, arguments[${index >= 0 ? index : `arguments.length + ${index}`}])`
|
|
114
|
-
: '__apm$original_args'
|
|
115
|
-
const traceParams = operator === 'traceCallback'
|
|
116
|
-
? `__apm$traced, ${index}`
|
|
117
|
-
: '__apm$traced'
|
|
118
115
|
const wrapper = parse(`
|
|
119
116
|
function wrapper () {
|
|
120
|
-
const __apm$
|
|
121
|
-
const __apm$traced = ${async} function () {
|
|
117
|
+
const __apm$traced = ${async} () => {
|
|
122
118
|
const __apm$wrapped = () => {};
|
|
123
|
-
|
|
124
|
-
return __apm$wrapped.apply(this, __apm$traced_args);
|
|
119
|
+
return __apm$wrapped.apply(this, arguments);
|
|
125
120
|
};
|
|
126
|
-
if (!${channelVariable}.hasSubscribers) return __apm$traced
|
|
127
|
-
return ${channelVariable}.${operator}($
|
|
121
|
+
if (!${channelVariable}.hasSubscribers) return __apm$traced();
|
|
122
|
+
return ${channelVariable}.${operator}(__apm$traced, {
|
|
123
|
+
arguments,
|
|
124
|
+
self: this,
|
|
125
|
+
moduleVersion: "1.0.0"
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
`).body[0].body // Extract only block statement of function body.
|
|
129
|
+
|
|
130
|
+
// Replace the right-hand side assignment of `const __apm$wrapped = () => {}`.
|
|
131
|
+
query(wrapper, '[id.name=__apm$wrapped]')[0].init = node
|
|
132
|
+
|
|
133
|
+
return wrapper
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function wrapCallback (state, node) {
|
|
137
|
+
const { channelName, functionQuery: { index = -1 } } = state
|
|
138
|
+
const channelVariable = 'tr_ch_apm$' + channelName.replaceAll(':', '_')
|
|
139
|
+
const wrapper = parse(`
|
|
140
|
+
function wrapper () {
|
|
141
|
+
const __apm$cb = Array.prototype.at.call(arguments, ${index});
|
|
142
|
+
const __apm$ctx = {
|
|
128
143
|
arguments,
|
|
129
144
|
self: this,
|
|
130
145
|
moduleVersion: "1.0.0"
|
|
131
|
-
}
|
|
146
|
+
};
|
|
147
|
+
const __apm$traced = () => {
|
|
148
|
+
const __apm$wrapped = () => {};
|
|
149
|
+
return __apm$wrapped.apply(this, arguments);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
if (!${channelVariable}.start.hasSubscribers) return __apm$traced();
|
|
153
|
+
|
|
154
|
+
function __apm$wrappedCb(err, res) {
|
|
155
|
+
if (err) {
|
|
156
|
+
__apm$ctx.error = err;
|
|
157
|
+
${channelVariable}.error.publish(__apm$ctx);
|
|
158
|
+
} else {
|
|
159
|
+
__apm$ctx.result = res;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
${channelVariable}.asyncStart.runStores(__apm$ctx, () => {
|
|
163
|
+
try {
|
|
164
|
+
if (__apm$cb) {
|
|
165
|
+
return __apm$cb.apply(this, arguments);
|
|
166
|
+
}
|
|
167
|
+
} finally {
|
|
168
|
+
${channelVariable}.asyncEnd.publish(__apm$ctx);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (typeof __apm$cb !== 'function') {
|
|
174
|
+
return __apm$traced();
|
|
175
|
+
}
|
|
176
|
+
Array.prototype.splice.call(arguments, ${index}, 1, __apm$wrappedCb);
|
|
177
|
+
|
|
178
|
+
return ${channelVariable}.start.runStores(__apm$ctx, () => {
|
|
179
|
+
try {
|
|
180
|
+
return __apm$traced();
|
|
181
|
+
} catch (err) {
|
|
182
|
+
__apm$ctx.error = err;
|
|
183
|
+
${channelVariable}.error.publish(__apm$ctx);
|
|
184
|
+
throw err;
|
|
185
|
+
} finally {
|
|
186
|
+
${channelVariable}.end.publish(__apm$ctx);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
132
189
|
}
|
|
133
190
|
`).body[0].body // Extract only block statement of function body.
|
|
134
191
|
|
|
135
192
|
// Replace the right-hand side assignment of `const __apm$wrapped = () => {}`.
|
|
136
|
-
wrapper
|
|
193
|
+
query(wrapper, '[id.name=__apm$wrapped]')[0].init = node
|
|
137
194
|
|
|
138
195
|
return wrapper
|
|
139
196
|
}
|
|
@@ -101,8 +101,8 @@ function patch (http, methodName) {
|
|
|
101
101
|
case 'response': {
|
|
102
102
|
const res = arg
|
|
103
103
|
ctx.res = res
|
|
104
|
-
res.
|
|
105
|
-
res.
|
|
104
|
+
res.once('end', finish)
|
|
105
|
+
res.once(errorMonitor, finish)
|
|
106
106
|
break
|
|
107
107
|
}
|
|
108
108
|
case 'connect':
|