dd-trace 6.0.0 → 6.2.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 +1 -2
- package/index.d.ts +28 -1
- package/initialize.mjs +4 -2
- package/package.json +34 -30
- package/packages/datadog-instrumentations/src/ai.js +45 -0
- package/packages/datadog-instrumentations/src/apollo-server.js +5 -13
- package/packages/datadog-instrumentations/src/child_process.js +3 -3
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +587 -0
- package/packages/datadog-instrumentations/src/cucumber.js +102 -43
- package/packages/datadog-instrumentations/src/cypress-config.js +11 -3
- package/packages/datadog-instrumentations/src/fastify.js +27 -8
- package/packages/datadog-instrumentations/src/helpers/hooks.js +3 -0
- package/packages/datadog-instrumentations/src/helpers/instrument.js +7 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +5 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/ai.js +6 -6
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/claude-agent-sdk.js +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +2 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/mercurius.js +31 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +19 -5
- package/packages/datadog-instrumentations/src/jest.js +713 -63
- package/packages/datadog-instrumentations/src/mercurius.js +11 -0
- package/packages/datadog-instrumentations/src/mocha/main.js +24 -3
- package/packages/datadog-instrumentations/src/mocha/utils.js +128 -22
- package/packages/datadog-instrumentations/src/mocha/worker.js +13 -0
- package/packages/datadog-instrumentations/src/mongodb.js +74 -0
- package/packages/datadog-instrumentations/src/mongoose.js +4 -5
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +15 -0
- package/packages/datadog-instrumentations/src/playwright.js +13 -9
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +4 -0
- package/packages/datadog-instrumentations/src/vitest-main.js +26 -1
- package/packages/datadog-instrumentations/src/vitest-util.js +2 -0
- package/packages/datadog-instrumentations/src/vitest-worker.js +103 -34
- package/packages/datadog-plugin-ai/src/index.js +1 -1
- package/packages/datadog-plugin-ai/src/tracing.js +66 -3
- package/packages/datadog-plugin-ai/src/utils.js +17 -4
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/context.js +1 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/handler.js +1 -0
- package/packages/datadog-plugin-child_process/src/index.js +13 -2
- package/packages/datadog-plugin-claude-agent-sdk/src/index.js +31 -0
- package/packages/datadog-plugin-claude-agent-sdk/src/tracing.js +107 -0
- package/packages/datadog-plugin-claude-agent-sdk/src/util.js +15 -0
- package/packages/datadog-plugin-cucumber/src/index.js +14 -23
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +351 -11
- package/packages/datadog-plugin-cypress/src/index.js +47 -2
- package/packages/datadog-plugin-cypress/src/plugin.js +1 -0
- package/packages/datadog-plugin-graphql/src/execute.js +25 -25
- package/packages/datadog-plugin-graphql/src/index.js +23 -1
- package/packages/datadog-plugin-graphql/src/request.js +104 -0
- package/packages/datadog-plugin-graphql/src/utils.js +186 -2
- package/packages/datadog-plugin-graphql/src/validate.js +25 -2
- package/packages/datadog-plugin-jest/src/index.js +30 -14
- package/packages/datadog-plugin-mocha/src/index.js +39 -14
- package/packages/datadog-plugin-mongodb-core/src/bulk-write.js +43 -0
- package/packages/datadog-plugin-mongodb-core/src/index.js +8 -443
- package/packages/datadog-plugin-mongodb-core/src/query.js +452 -0
- package/packages/datadog-plugin-playwright/src/index.js +3 -2
- package/packages/datadog-plugin-vitest/src/index.js +43 -9
- package/packages/dd-trace/src/aiguard/index.js +9 -14
- package/packages/dd-trace/src/aiguard/integrations/index.js +34 -0
- package/packages/dd-trace/src/aiguard/integrations/openai.js +47 -33
- package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +42 -28
- package/packages/dd-trace/src/appsec/graphql.js +9 -6
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +3 -10
- package/packages/dd-trace/src/appsec/lambda.js +8 -8
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +26 -1
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +115 -24
- package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +3 -0
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +3 -0
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +75 -7
- package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +156 -0
- package/packages/dd-trace/src/config/generated-config-types.d.ts +10 -0
- package/packages/dd-trace/src/config/supported-configurations.json +37 -0
- package/packages/dd-trace/src/crashtracking/crashtracker.js +2 -2
- package/packages/dd-trace/src/datastreams/writer.js +14 -2
- package/packages/dd-trace/src/encode/0.4.js +23 -2
- package/packages/dd-trace/src/encode/0.5.js +12 -1
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +11 -1
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +20 -2
- package/packages/dd-trace/src/exporters/common/writer.js +17 -1
- package/packages/dd-trace/src/guardrails/index.js +3 -1
- package/packages/dd-trace/src/guardrails/telemetry.js +40 -3
- package/packages/dd-trace/src/llmobs/plugins/ai/ddTelemetry.js +403 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +8 -395
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +27 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/vercelTelemetry.js +363 -0
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/index.js +270 -0
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/utils.js +10 -0
- package/packages/dd-trace/src/msgpack/chunk.js +33 -1
- package/packages/dd-trace/src/msgpack/index.js +6 -1
- package/packages/dd-trace/src/opentelemetry/span.js +5 -0
- package/packages/dd-trace/src/plugin_manager.js +16 -0
- package/packages/dd-trace/src/plugins/ci_plugin.js +147 -7
- package/packages/dd-trace/src/plugins/index.js +5 -0
- package/packages/dd-trace/src/plugins/util/test.js +4 -0
- package/packages/dd-trace/src/profiling/exporters/agent.js +28 -3
- package/packages/dd-trace/src/service-naming/schemas/v0/graphql.js +6 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/graphql.js +8 -0
- package/vendor/dist/@apm-js-collab/code-transformer/index.js +5 -6
package/LICENSE-3rdparty.csv
CHANGED
|
@@ -44,8 +44,6 @@
|
|
|
44
44
|
"@oxc-project/types","https://github.com/oxc-project/oxc","['MIT']","['Boshen and oxc contributors']"
|
|
45
45
|
"@tybys/wasm-util","https://github.com/toyobayashi/wasm-util","['MIT']","['toyobayashi']"
|
|
46
46
|
"@types/estree","https://github.com/DefinitelyTyped/DefinitelyTyped","['MIT']","['DefinitelyTyped']"
|
|
47
|
-
"acorn","https://github.com/acornjs/acorn","['MIT']","['acornjs']"
|
|
48
|
-
"acorn-import-attributes","https://github.com/xtuc/acorn-import-attributes","['MIT']","['Sven Sauleau']"
|
|
49
47
|
"argparse","https://github.com/nodeca/argparse","['Python-2.0']","['nodeca']"
|
|
50
48
|
"astring","https://github.com/davidbonnet/astring","['MIT']","['David Bonnet']"
|
|
51
49
|
"cjs-module-lexer","https://github.com/nodejs/cjs-module-lexer","['MIT']","['Guy Bedford']"
|
|
@@ -53,6 +51,7 @@
|
|
|
53
51
|
"dc-polyfill","https://github.com/DataDog/dc-polyfill","['MIT']","['Thomas Hunter II']"
|
|
54
52
|
"dd-trace","https://github.com/DataDog/dd-trace-js","['(Apache-2.0 OR BSD-3-Clause)']","['Datadog Inc. <info@datadoghq.com>']"
|
|
55
53
|
"detect-newline","https://github.com/sindresorhus/detect-newline","['MIT']","['Sindre Sorhus']"
|
|
54
|
+
"es-module-lexer","https://github.com/guybedford/es-module-lexer","['MIT']","['Guy Bedford']"
|
|
56
55
|
"escape-string-regexp","https://github.com/sindresorhus/escape-string-regexp","['MIT']","['Sindre Sorhus']"
|
|
57
56
|
"esquery","https://github.com/estools/esquery","['BSD-3-Clause']","['Joel Feenstra']"
|
|
58
57
|
"estraverse","https://github.com/estools/estraverse","['BSD-2-Clause']","['estools']"
|
package/index.d.ts
CHANGED
|
@@ -233,6 +233,7 @@ interface Plugins {
|
|
|
233
233
|
"amqp10": tracer.plugins.amqp10;
|
|
234
234
|
"amqplib": tracer.plugins.amqplib;
|
|
235
235
|
"anthropic": tracer.plugins.anthropic;
|
|
236
|
+
"claude-agent-sdk": tracer.plugins.claude_agent_sdk;
|
|
236
237
|
"apollo": tracer.plugins.apollo;
|
|
237
238
|
"avsc": tracer.plugins.avsc;
|
|
238
239
|
"aws-durable-execution-sdk-js": tracer.plugins.aws_durable_execution_sdk_js;
|
|
@@ -2191,6 +2192,12 @@ declare namespace tracer {
|
|
|
2191
2192
|
*/
|
|
2192
2193
|
interface anthropic extends Instrumentation {}
|
|
2193
2194
|
|
|
2195
|
+
/**
|
|
2196
|
+
* This plugin automatically instruments the
|
|
2197
|
+
* [@anthropic-ai/claude-agent-sdk](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) module.
|
|
2198
|
+
*/
|
|
2199
|
+
interface claude_agent_sdk extends Instrumentation {}
|
|
2200
|
+
|
|
2194
2201
|
/**
|
|
2195
2202
|
* Currently this plugin automatically instruments
|
|
2196
2203
|
* [@apollo/gateway](https://github.com/apollographql/federation) for module versions >= v2.3.0.
|
|
@@ -2507,6 +2514,13 @@ declare namespace tracer {
|
|
|
2507
2514
|
* This plugin automatically instruments the
|
|
2508
2515
|
* [graphql](https://github.com/graphql/graphql-js) module.
|
|
2509
2516
|
*
|
|
2517
|
+
* It also instruments [mercurius](https://github.com/mercurius-js/mercurius)
|
|
2518
|
+
* (the Fastify GraphQL adapter): every request through `app.graphql` /
|
|
2519
|
+
* `reply.graphql` opens a top-level `graphql.request` span that parents the
|
|
2520
|
+
* `graphql.parse`/`graphql.validate`/`graphql.execute` spans and carries the
|
|
2521
|
+
* request text. This span is produced even when mercurius serves the query
|
|
2522
|
+
* from its JIT-compiled path, where `graphql.execute` does not run.
|
|
2523
|
+
*
|
|
2510
2524
|
* The `graphql` integration uses the operation name as the span resource name.
|
|
2511
2525
|
* If no operation name is set, the resource name will always be just `query`,
|
|
2512
2526
|
* `mutation` or `subscription`.
|
|
@@ -2535,6 +2549,7 @@ declare namespace tracer {
|
|
|
2535
2549
|
* count toward the limit, regardless of `collapse`.
|
|
2536
2550
|
*
|
|
2537
2551
|
* @default -1
|
|
2552
|
+
* @env DD_TRACE_GRAPHQL_DEPTH
|
|
2538
2553
|
*/
|
|
2539
2554
|
depth?: number;
|
|
2540
2555
|
|
|
@@ -2551,7 +2566,10 @@ declare namespace tracer {
|
|
|
2551
2566
|
/**
|
|
2552
2567
|
* An array of variable names to record. Can also be a callback that returns
|
|
2553
2568
|
* the key/value pairs to record. For example, using
|
|
2554
|
-
* `variables => variables` would record all variables.
|
|
2569
|
+
* `variables => variables` would record all variables. The environment
|
|
2570
|
+
* variable only accepts the array form (comma-separated variable names).
|
|
2571
|
+
*
|
|
2572
|
+
* @env DD_TRACE_GRAPHQL_VARIABLES
|
|
2555
2573
|
*/
|
|
2556
2574
|
variables?: string[] | ((variables: { [key: string]: any }) => { [key: string]: any });
|
|
2557
2575
|
|
|
@@ -2560,9 +2578,18 @@ declare namespace tracer {
|
|
|
2560
2578
|
* `users.*.name` span instead of `users.0.name`, `users.1.name`, etc)
|
|
2561
2579
|
*
|
|
2562
2580
|
* @default true
|
|
2581
|
+
* @env DD_TRACE_GRAPHQL_COLLAPSE
|
|
2563
2582
|
*/
|
|
2564
2583
|
collapse?: boolean;
|
|
2565
2584
|
|
|
2585
|
+
/**
|
|
2586
|
+
* An array of error `extensions` keys to attach to the span error event
|
|
2587
|
+
* for each GraphQL error.
|
|
2588
|
+
*
|
|
2589
|
+
* @env DD_TRACE_GRAPHQL_ERROR_EXTENSIONS
|
|
2590
|
+
*/
|
|
2591
|
+
errorExtensions?: string[];
|
|
2592
|
+
|
|
2566
2593
|
/**
|
|
2567
2594
|
* Whether to enable signature calculation for the resource name. This can
|
|
2568
2595
|
* be disabled if your GraphQL operations always have a name. Note that when
|
package/initialize.mjs
CHANGED
|
@@ -75,8 +75,10 @@ export const resolve = brokenLoaders ? undefined : hookResolve
|
|
|
75
75
|
|
|
76
76
|
if (isMainThread) {
|
|
77
77
|
const require = Module.createRequire(import.meta.url)
|
|
78
|
-
require('./init.js')
|
|
79
|
-
|
|
78
|
+
const initialized = require('./init.js')
|
|
79
|
+
// Only register the loader hook when instrumentation initialized. On a bailout the
|
|
80
|
+
// loader has nothing to instrument and can keep a short-lived process from exiting.
|
|
81
|
+
if (Module.register && initialized) {
|
|
80
82
|
// The loader builds its own include/exclude matcher in `initialize`, so no
|
|
81
83
|
// options need to cross the registration boundary.
|
|
82
84
|
Module.register('./loader-hook.mjs', import.meta.url)
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.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 && cd vendor && npm ci --include=dev",
|
|
9
|
+
"prepare": "node scripts/patch-istanbul-lib-coverage.js && node scripts/patch-v8-to-istanbul.js && cd vendor && npm ci --include=dev",
|
|
10
10
|
"prepack": "node scripts/release/swap-v5-types.js",
|
|
11
11
|
"bench": "node benchmark/index.js",
|
|
12
12
|
"bench:e2e:test-optimization": "node benchmark/e2e-test-optimization/benchmark-run.js",
|
|
@@ -22,50 +22,50 @@
|
|
|
22
22
|
"lint:fix": "node scripts/check_licenses.js && node scripts/check-no-coverage-artifacts.js && node scripts/check-no-mcr-images.js && node scripts/check-docker-image-shas.js && eslint . --concurrency=auto --max-warnings 0 --fix",
|
|
23
23
|
"lint:inspect": "npx @eslint/config-inspector@latest",
|
|
24
24
|
"lint:codeowners": "codeowners-audit",
|
|
25
|
-
"lint:codeowners:ci": "codeowners-audit --glob='**/*.spec.js' --glob='benchmark/sirun/**' --glob='.agents/**' --glob='.claude/**'",
|
|
25
|
+
"lint:codeowners:ci": "codeowners-audit --glob='**/*.spec.js' --glob='benchmark/sirun/**' --glob='.agents/**' --glob='.claude/**' --glob='integration-tests/**'",
|
|
26
26
|
"lint:editorconfig": "editorconfig-checker",
|
|
27
27
|
"release:proposal": "node scripts/release/proposal",
|
|
28
28
|
"services": "node ./scripts/install_plugin_modules && node packages/dd-trace/test/setup/services",
|
|
29
29
|
"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",
|
|
30
30
|
"test:aiguard": "mocha \"packages/dd-trace/test/aiguard/**/*.spec.js\"",
|
|
31
|
-
"test:aiguard:ci": "
|
|
31
|
+
"test:aiguard:ci": "node scripts/c8-ci.js test:aiguard",
|
|
32
32
|
"test:appsec": "mocha --exclude \"packages/dd-trace/test/appsec/**/*.plugin.spec.js\" \"packages/dd-trace/test/appsec/**/*.spec.js\"",
|
|
33
|
-
"test:appsec:ci": "
|
|
33
|
+
"test:appsec:ci": "node scripts/c8-ci.js test:appsec",
|
|
34
34
|
"test:appsec:plugins": "mocha \"packages/dd-trace/test/appsec/**/*.@(${PLUGINS}).plugin.spec.js\"",
|
|
35
|
-
"test:appsec:plugins:ci": "yarn services &&
|
|
35
|
+
"test:appsec:plugins:ci": "yarn services && node scripts/c8-ci.js test:appsec:plugins",
|
|
36
36
|
"test:debugger": "mocha \"packages/dd-trace/test/debugger/**/*.spec.js\"",
|
|
37
|
-
"test:debugger:ci": "
|
|
37
|
+
"test:debugger:ci": "node scripts/c8-ci.js test:debugger",
|
|
38
38
|
"test:eslint-rules": "node eslint-rules/*.test.mjs",
|
|
39
39
|
"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\"",
|
|
40
|
-
"test:trace:core:ci": "
|
|
40
|
+
"test:trace:core:ci": "node scripts/c8-ci.js test:trace:core",
|
|
41
41
|
"test:trace:guardrails": "mocha \"packages/dd-trace/test/guardrails/**/*.spec.js\"",
|
|
42
|
-
"test:trace:guardrails:ci": "
|
|
42
|
+
"test:trace:guardrails:ci": "node scripts/c8-ci.js test:trace:guardrails",
|
|
43
43
|
"test:esbuild": "mocha \"packages/datadog-esbuild/test/**/*.spec.js\"",
|
|
44
|
-
"test:esbuild:ci": "
|
|
44
|
+
"test:esbuild:ci": "node scripts/c8-ci.js test:esbuild",
|
|
45
45
|
"test:webpack": "mocha \"packages/datadog-webpack/test/**/*.spec.js\"",
|
|
46
|
-
"test:webpack:ci": "
|
|
46
|
+
"test:webpack:ci": "node scripts/c8-ci.js test:webpack",
|
|
47
47
|
"test:instrumentations": "mocha \"packages/datadog-instrumentations/test/@(${PLUGINS}).spec.js\"",
|
|
48
|
-
"test:instrumentations:ci": "yarn services &&
|
|
48
|
+
"test:instrumentations:ci": "yarn services && node scripts/c8-ci.js test:instrumentations",
|
|
49
49
|
"test:instrumentations:misc": "mocha \"packages/datadog-instrumentations/test/*/**/*.spec.{js,mjs}\"",
|
|
50
|
-
"test:instrumentations:misc:ci": "
|
|
50
|
+
"test:instrumentations:misc:ci": "node scripts/c8-ci.js test:instrumentations:misc",
|
|
51
51
|
"test:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- \"packages/datadog-core/test/**/*.spec.js\"",
|
|
52
|
-
"test:core:ci": "
|
|
52
|
+
"test:core:ci": "node scripts/c8-ci.js test:core",
|
|
53
53
|
"test:code-origin": "mocha \"packages/datadog-code-origin/test/**/*.spec.js\"",
|
|
54
|
-
"test:code-origin:ci": "
|
|
54
|
+
"test:code-origin:ci": "node scripts/c8-ci.js test:code-origin",
|
|
55
55
|
"test:lambda": "mocha \"packages/dd-trace/test/lambda/**/*.spec.js\"",
|
|
56
|
-
"test:lambda:ci": "
|
|
56
|
+
"test:lambda:ci": "node scripts/c8-ci.js test:lambda",
|
|
57
57
|
"test:llmobs:sdk": "mocha --exclude \"packages/dd-trace/test/llmobs/plugins/**/*.spec.js\" \"packages/dd-trace/test/llmobs/**/*.spec.js\"",
|
|
58
|
-
"test:llmobs:sdk:ci": "
|
|
58
|
+
"test:llmobs:sdk:ci": "node scripts/c8-ci.js test:llmobs:sdk",
|
|
59
59
|
"test:llmobs:plugins": "mocha \"packages/dd-trace/test/llmobs/plugins/@(${PLUGINS})/*.spec.js\"",
|
|
60
|
-
"test:llmobs:plugins:ci": "yarn services &&
|
|
60
|
+
"test:llmobs:plugins:ci": "yarn services && node scripts/c8-ci.js test:llmobs:plugins",
|
|
61
61
|
"test:openfeature": "mocha \"packages/dd-trace/test/openfeature/**/*.spec.js\"",
|
|
62
|
-
"test:openfeature:ci": "
|
|
62
|
+
"test:openfeature:ci": "node scripts/c8-ci.js test:openfeature",
|
|
63
63
|
"test:plugins": "node --expose-gc ./node_modules/mocha/bin/mocha.js \"packages/datadog-plugin-@(${PLUGINS})/test/**/${SPEC:-*}*.spec.js\"",
|
|
64
|
-
"test:plugins:ci": "yarn services &&
|
|
65
|
-
"test:plugins:ci:flaky": "yarn services &&
|
|
64
|
+
"test:plugins:ci": "yarn services && node scripts/c8-ci.js test:plugins",
|
|
65
|
+
"test:plugins:ci:flaky": "yarn services && node scripts/c8-ci.js test:plugins --bail --retries 2",
|
|
66
66
|
"test:plugins:upstream": "node ./packages/dd-trace/test/plugins/suite.js",
|
|
67
67
|
"test:profiler": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- \"packages/dd-trace/test/profiling/**/*.spec.js\"",
|
|
68
|
-
"test:profiler:ci": "
|
|
68
|
+
"test:profiler:ci": "node scripts/c8-ci.js test:profiler",
|
|
69
69
|
"test:integration": "mocha --timeout 60000 \"integration-tests/*.spec.js\"",
|
|
70
70
|
"test:integration:coverage": "node ./integration-tests/coverage/run-suite.js --timeout 60000 \"integration-tests/*.spec.js\"",
|
|
71
71
|
"test:integration:aiguard": "mocha --timeout 60000 \"integration-tests/aiguard/*.spec.js\"",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"test:release": "mocha \"scripts/release/**/*.spec.js\"",
|
|
107
107
|
"test:scripts": "mocha \"scripts/helpers/**/*.spec.js\" \"scripts/*.spec.mjs\"",
|
|
108
108
|
"test:shimmer": "mocha \"packages/datadog-shimmer/test/**/*.spec.js\"",
|
|
109
|
-
"test:shimmer:ci": "
|
|
109
|
+
"test:shimmer:ci": "node scripts/c8-ci.js test:shimmer",
|
|
110
110
|
"verify:workflow-job-names": "node scripts/verify-workflow-job-names.js",
|
|
111
111
|
"verify-exercised-tests": "node scripts/verify-exercised-tests.js"
|
|
112
112
|
},
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
],
|
|
165
165
|
"dependencies": {
|
|
166
166
|
"dc-polyfill": "^0.1.11",
|
|
167
|
-
"import-in-the-middle": "^3.
|
|
167
|
+
"import-in-the-middle": "^3.3.1",
|
|
168
168
|
"opentracing": ">=0.14.7"
|
|
169
169
|
},
|
|
170
170
|
"optionalDependencies": {
|
|
@@ -191,19 +191,20 @@
|
|
|
191
191
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
192
192
|
"@types/mocha": "^10.0.10",
|
|
193
193
|
"@types/node": "^18.19.106",
|
|
194
|
-
"@types/sinon": "^
|
|
194
|
+
"@types/sinon": "^22.0.0",
|
|
195
195
|
"axios": "^1.18.1",
|
|
196
196
|
"benchmark": "^2.1.4",
|
|
197
197
|
"body-parser": "^2.3.0",
|
|
198
198
|
"bun": "1.3.14",
|
|
199
|
+
"c8": "^11.0.0",
|
|
199
200
|
"codeowners-audit": "^2.9.0",
|
|
200
201
|
"editorconfig-checker": "^6.1.1",
|
|
201
202
|
"eslint": "^9.39.2",
|
|
202
|
-
"eslint-plugin-cypress": "^6.4.
|
|
203
|
+
"eslint-plugin-cypress": "^6.4.2",
|
|
203
204
|
"eslint-plugin-import": "^2.32.0",
|
|
204
|
-
"eslint-plugin-jsdoc": "^63.0.
|
|
205
|
+
"eslint-plugin-jsdoc": "^63.0.10",
|
|
205
206
|
"eslint-plugin-mocha": "^11.3.0",
|
|
206
|
-
"eslint-plugin-n": "^18.2.
|
|
207
|
+
"eslint-plugin-n": "^18.2.1",
|
|
207
208
|
"eslint-plugin-promise": "^7.3.0",
|
|
208
209
|
"eslint-plugin-sonarjs": "^4.1.0",
|
|
209
210
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
@@ -219,7 +220,7 @@
|
|
|
219
220
|
"mocha-junit-reporter": "^2.2.1",
|
|
220
221
|
"mocha-multi-reporters": "^1.5.1",
|
|
221
222
|
"multer": "^2.2.0",
|
|
222
|
-
"nock": "^14.0.
|
|
223
|
+
"nock": "^14.0.16",
|
|
223
224
|
"node-preload": "^0.2.1",
|
|
224
225
|
"nyc": "^18.0.0",
|
|
225
226
|
"octokit": "^5.0.3",
|
|
@@ -229,9 +230,12 @@
|
|
|
229
230
|
"semifies": "^1.0.0",
|
|
230
231
|
"semver": "^7.8.5",
|
|
231
232
|
"sinon": "^22.0.0",
|
|
233
|
+
"source-map-support": "^0.5.21",
|
|
234
|
+
"test-exclude": "^8.0.0",
|
|
232
235
|
"tiktoken": "^1.0.21",
|
|
233
236
|
"typescript": "^6.0.3",
|
|
234
|
-
"
|
|
237
|
+
"v8-to-istanbul": "^9.0.0",
|
|
238
|
+
"workerpool": "^10.0.3",
|
|
235
239
|
"yaml": "^2.9.0",
|
|
236
240
|
"yarn-deduplicate": "^6.0.2"
|
|
237
241
|
}
|
|
@@ -233,4 +233,49 @@ for (const hook of getHooks('ai')) {
|
|
|
233
233
|
})
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
const aiSdkTelemetryChannel = tracingChannel('ai:telemetry')
|
|
237
|
+
const aiSdkTelemetryStreamedChunkChannel = channel('dd-trace:vercel-ai:chunk')
|
|
238
|
+
|
|
239
|
+
// for testing, and possibly actual instrumentation use, we want to
|
|
240
|
+
// guard against double-subscribing to the asyncEnd channel of the
|
|
241
|
+
// vercel ai-provided tracingChannel
|
|
242
|
+
let subscribed = false
|
|
243
|
+
|
|
244
|
+
// as of the v7 release, the ai sdk does not automatically aggregate streamed responses
|
|
245
|
+
// we will handle emitting the chunks directly for products to handle
|
|
246
|
+
addHook({ name: 'ai', versions: ['>=7.0.0'] }, exports => {
|
|
247
|
+
if (subscribed) return exports
|
|
248
|
+
subscribed = true
|
|
249
|
+
|
|
250
|
+
// ai sdk v7 only supported on node.js 22+
|
|
251
|
+
// inlining this import here so we only import in those cases
|
|
252
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
253
|
+
const { TransformStream } = require('node:stream/web')
|
|
254
|
+
|
|
255
|
+
aiSdkTelemetryChannel.subscribe({
|
|
256
|
+
asyncEnd (ctx) {
|
|
257
|
+
// guard against this event being re-emitted.
|
|
258
|
+
if (!ctx.isStream || !ctx.result?.stream || ctx.streamConsumed) return
|
|
259
|
+
|
|
260
|
+
const transform = new TransformStream({
|
|
261
|
+
transform (chunk, controller) {
|
|
262
|
+
const done = chunk.type === 'finish'
|
|
263
|
+
|
|
264
|
+
aiSdkTelemetryStreamedChunkChannel.publish({ ctx, chunk, done })
|
|
265
|
+
|
|
266
|
+
if (done) {
|
|
267
|
+
aiSdkTelemetryChannel.asyncEnd.publish(ctx)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
controller.enqueue(chunk) // pass through value
|
|
271
|
+
},
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
ctx.result.stream = ctx.result.stream.pipeThrough(transform)
|
|
275
|
+
},
|
|
276
|
+
})
|
|
277
|
+
|
|
278
|
+
return exports
|
|
279
|
+
})
|
|
280
|
+
|
|
236
281
|
module.exports = { wrapModelWithLifecycle }
|
|
@@ -112,24 +112,16 @@ function apolloDrainHttpServerHook (drainModule) {
|
|
|
112
112
|
return drainModule
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
addHook({ name: '@apollo/server', file: 'dist/cjs/ApolloServer.js', versions: ['4'] }, apolloServerHook)
|
|
115
|
+
addHook({ name: '@apollo/server', file: 'dist/cjs/ApolloServer.js', versions: ['>=4'] }, apolloServerHook)
|
|
116
116
|
|
|
117
117
|
addHook({ name: '@apollo/server', file: 'dist/cjs/express4/index.js', versions: ['4'] }, apolloExpress4Hook)
|
|
118
118
|
|
|
119
|
-
addHook({ name: '@apollo/server', file: 'dist/cjs/utils/HeaderMap.js', versions: ['4'] }, apolloHeaderMapHook)
|
|
120
|
-
|
|
121
119
|
addHook(
|
|
122
|
-
{ name: '@apollo/server', file: 'dist/cjs/
|
|
123
|
-
|
|
120
|
+
{ name: '@apollo/server', file: 'dist/cjs/utils/HeaderMap.js', versions: ['>=4'] },
|
|
121
|
+
apolloHeaderMapHook
|
|
124
122
|
)
|
|
125
123
|
|
|
126
124
|
addHook(
|
|
127
|
-
{ name: '@apollo/server', file: 'dist/cjs/
|
|
128
|
-
|
|
129
|
-
shimmer.wrap(runHttpQueryModule, 'runHttpQuery', function wrapRunHttpQuery (originalRunHttpQuery) {
|
|
130
|
-
return wrapExecuteHTTPGraphQLRequest(originalRunHttpQuery)
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
return runHttpQueryModule
|
|
134
|
-
}
|
|
125
|
+
{ name: '@apollo/server', file: 'dist/cjs/plugin/drainHttpServer/index.js', versions: ['>=5.0.0'] },
|
|
126
|
+
apolloDrainHttpServerHook
|
|
135
127
|
)
|
|
@@ -129,7 +129,7 @@ function wrapChildProcessCustomPromisifyMethod (customPromisifyMethod, shell) {
|
|
|
129
129
|
const context = createContextFromChildProcessInfo(childProcessInfo)
|
|
130
130
|
context.callArgs = callArgs
|
|
131
131
|
|
|
132
|
-
const { start, end, asyncStart, asyncEnd, error } = childProcessChannel
|
|
132
|
+
const { start, end, asyncStart, asyncEnd, error: errorChannel } = childProcessChannel
|
|
133
133
|
start.publish(context)
|
|
134
134
|
|
|
135
135
|
let result
|
|
@@ -140,7 +140,7 @@ function wrapChildProcessCustomPromisifyMethod (customPromisifyMethod, shell) {
|
|
|
140
140
|
result = customPromisifyMethod.apply(this, context.callArgs)
|
|
141
141
|
} catch (error) {
|
|
142
142
|
context.error = error
|
|
143
|
-
|
|
143
|
+
errorChannel.publish(context)
|
|
144
144
|
throw error
|
|
145
145
|
} finally {
|
|
146
146
|
end.publish(context)
|
|
@@ -149,7 +149,7 @@ function wrapChildProcessCustomPromisifyMethod (customPromisifyMethod, shell) {
|
|
|
149
149
|
|
|
150
150
|
function reject (err) {
|
|
151
151
|
context.error = err
|
|
152
|
-
|
|
152
|
+
errorChannel.publish(context)
|
|
153
153
|
asyncStart.publish(context)
|
|
154
154
|
|
|
155
155
|
asyncEnd.publish(context)
|