dd-trace 5.94.0 → 5.96.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 +46 -44
- package/index.d.ts +191 -13
- package/package.json +2 -2
- package/packages/datadog-instrumentations/src/ai.js +112 -0
- package/packages/datadog-instrumentations/src/anthropic.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/ai-messages.js +182 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/{orchestrion/compiler.js → compiler.js} +4 -13
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +16 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/ai.js +25 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langgraph.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/{orchestrion/transforms.js → transforms.js} +3 -89
- package/packages/datadog-instrumentations/src/mocha/utils.js +10 -0
- package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -4
- package/packages/dd-trace/src/aiguard/index.js +64 -0
- package/packages/dd-trace/src/azure_metadata.js +15 -15
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +73 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +76 -1
- package/packages/dd-trace/src/ci-visibility/lage.js +39 -0
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +259 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +56 -0
- package/packages/dd-trace/src/config/config-base.d.ts +7 -0
- package/packages/dd-trace/src/config/config-base.js +5 -0
- package/packages/dd-trace/src/config/config-types.d.ts +78 -0
- package/packages/dd-trace/src/config/generated-config-types.d.ts +582 -0
- package/packages/dd-trace/src/config/index.js +5 -2
- package/packages/dd-trace/src/config/supported-configurations.json +24 -0
- package/packages/dd-trace/src/constants.js +1 -0
- package/packages/dd-trace/src/exporter.js +5 -2
- package/packages/dd-trace/src/llmobs/constants/tags.js +1 -0
- package/packages/dd-trace/src/llmobs/constants/text.js +4 -1
- package/packages/dd-trace/src/llmobs/constants/writers.js +1 -1
- package/packages/dd-trace/src/llmobs/index.js +9 -4
- package/packages/dd-trace/src/llmobs/plugins/anthropic.js +11 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +4 -1
- package/packages/dd-trace/src/llmobs/writers/spans.js +1 -1
- package/packages/dd-trace/src/plugins/util/test.js +5 -0
- package/packages/dd-trace/src/priority_sampler.js +1 -1
- package/packages/dd-trace/src/proxy.js +4 -0
- package/packages/dd-trace/src/rate_limiter.js +2 -1
- package/packages/dd-trace/src/startup-log.js +9 -0
- package/packages/dd-trace/src/tagger.js +31 -35
- package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +28 -0
- package/vendor/dist/@apm-js-collab/code-transformer/index.js +133 -0
- package/vendor/dist/@opentelemetry/core/index.js +1 -1
- package/vendor/dist/@opentelemetry/resources/index.js +1 -1
- package/vendor/dist/esquery/index.js +1 -1
- package/vendor/dist/meriyah/index.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/index.js +0 -43
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/matcher.js +0 -49
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/transformer.js +0 -121
- package/vendor/dist/astring/LICENSE +0 -19
- package/vendor/dist/astring/index.js +0 -1
package/LICENSE-3rdparty.csv
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
"component","origin","license","copyright"
|
|
2
|
-
"@
|
|
3
|
-
"@datadog/
|
|
4
|
-
"@datadog/
|
|
5
|
-
"@datadog/native-
|
|
6
|
-
"@datadog/native-
|
|
7
|
-
"@datadog/
|
|
1
|
+
"component","origin","license","copyright"
|
|
2
|
+
"@apm-js-collab/code-transformer","https://github.com/nodejs/orchestrion-js","['Apache-2.0']","['nodejs']"
|
|
3
|
+
"@datadog/flagging-core","https://github.com/DataDog/openfeature-js-client","['Apache-2.0']","['DataDog']"
|
|
4
|
+
"@datadog/libdatadog","https://github.com/DataDog/libdatadog-nodejs","['Apache-2.0']","['Datadog Inc.']"
|
|
5
|
+
"@datadog/native-appsec","https://github.com/DataDog/dd-native-appsec-js","['Apache-2.0']","['Datadog Inc.']"
|
|
6
|
+
"@datadog/native-iast-taint-tracking","https://github.com/DataDog/dd-native-iast-taint-tracking-js","['Apache-2.0']","['Datadog Inc.']"
|
|
7
|
+
"@datadog/native-metrics","https://github.com/DataDog/dd-native-metrics-js","['Apache-2.0']","['Datadog Inc.']"
|
|
8
|
+
"@datadog/openfeature-node-server","https://github.com/DataDog/openfeature-js-client","['Apache-2.0']","['DataDog']"
|
|
8
9
|
"@datadog/pprof","https://github.com/DataDog/pprof-nodejs","['Apache-2.0']","['Google Inc.']"
|
|
9
10
|
"@datadog/sketches-js","https://github.com/DataDog/sketches-js","['Apache-2.0']","['DataDog']"
|
|
10
11
|
"@datadog/wasm-js-rewriter","https://github.com/DataDog/dd-wasm-js-rewriter","['Apache-2.0']","['Datadog Inc.']"
|
|
@@ -44,59 +45,60 @@
|
|
|
44
45
|
"@protobufjs/aspromise","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
45
46
|
"@protobufjs/base64","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
46
47
|
"@protobufjs/codegen","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
47
|
-
"@protobufjs/eventemitter","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
48
|
-
"@protobufjs/fetch","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
49
|
-
"@protobufjs/float","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
50
|
-
"@protobufjs/inquire","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
48
|
+
"@protobufjs/eventemitter","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
49
|
+
"@protobufjs/fetch","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
50
|
+
"@protobufjs/float","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
51
|
+
"@protobufjs/inquire","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
51
52
|
"@protobufjs/path","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
52
53
|
"@protobufjs/pool","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
53
54
|
"@protobufjs/utf8","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
54
55
|
"@tybys/wasm-util","https://github.com/toyobayashi/wasm-util","['MIT']","['toyobayashi']"
|
|
56
|
+
"@types/estree","https://github.com/DefinitelyTyped/DefinitelyTyped","['MIT']","['DefinitelyTyped']"
|
|
55
57
|
"@types/node","https://github.com/DefinitelyTyped/DefinitelyTyped","['MIT']","['DefinitelyTyped']"
|
|
56
58
|
"acorn","https://github.com/acornjs/acorn","['MIT']","['acornjs']"
|
|
57
59
|
"acorn-import-attributes","https://github.com/xtuc/acorn-import-attributes","['MIT']","['Sven Sauleau']"
|
|
58
|
-
"argparse","https://github.com/nodeca/argparse","['Python-2.0']","['nodeca']"
|
|
59
|
-
"astring","https://github.com/davidbonnet/astring","['MIT']","['David Bonnet']"
|
|
60
|
-
"cjs-module-lexer","https://github.com/nodejs/cjs-module-lexer","['MIT']","['Guy Bedford']"
|
|
61
|
-
"crypto-randomuuid","npm:crypto-randomuuid","['MIT']","['Stephen Belanger']"
|
|
62
|
-
"dc-polyfill","https://github.com/DataDog/dc-polyfill","['MIT']","['Thomas Hunter II']"
|
|
63
|
-
"dd-trace","https://github.com/DataDog/dd-trace-js","['(Apache-2.0 OR BSD-3-Clause)']","['Datadog Inc. <info@datadoghq.com>']"
|
|
64
|
-
"detect-newline","https://github.com/sindresorhus/detect-newline","['MIT']","['Sindre Sorhus']"
|
|
65
|
-
"escape-string-regexp","https://github.com/sindresorhus/escape-string-regexp","['MIT']","['Sindre Sorhus']"
|
|
66
|
-
"esquery","https://github.com/estools/esquery","['BSD-3-Clause']","['Joel Feenstra']"
|
|
67
|
-
"estraverse","https://github.com/estools/estraverse","['BSD-2-Clause']","['estools']"
|
|
68
|
-
"fast-fifo","https://github.com/mafintosh/fast-fifo","['MIT']","['Mathias Buus']"
|
|
69
|
-
"ignore","https://github.com/kaelzhang/node-ignore","['MIT']","['kael']"
|
|
70
|
-
"import-in-the-middle","https://github.com/nodejs/import-in-the-middle","['Apache-2.0']","['Bryan English']"
|
|
71
|
-
"istanbul-lib-coverage","https://github.com/istanbuljs/istanbuljs","['BSD-3-Clause']","['Krishnan Anantheswaran']"
|
|
72
|
-
"jest-docblock","https://github.com/jestjs/jest","['MIT']","['jestjs']"
|
|
73
|
-
"js-yaml","https://github.com/nodeca/js-yaml","['MIT']","['Vladimir Zapparov']"
|
|
74
|
-
"jsep","https://github.com/EricSmekens/jsep","['MIT']","['Stephen Oney']"
|
|
75
|
-
"jsonpath-plus","https://github.com/JSONPath-Plus/JSONPath","['MIT']","['Stefan Goessner']"
|
|
76
|
-
"limiter","https://github.com/jhurliman/node-rate-limiter","['MIT']","['John Hurliman']"
|
|
77
|
-
"lodash.sortby","https://github.com/lodash/lodash","['MIT']","['John-David Dalton']"
|
|
78
|
-
"long","https://github.com/dcodeIO/long.js","['Apache-2.0']","['Daniel Wirtz']"
|
|
79
|
-
"lru-cache","https://github.com/isaacs/node-lru-cache","['ISC']","['Isaac Z. Schlueter']"
|
|
80
|
-
"meriyah","https://github.com/meriyah/meriyah","['ISC']","['Kenny F.']"
|
|
81
|
-
"module-details-from-path","https://github.com/watson/module-details-from-path","['MIT']","['Thomas Watson']"
|
|
82
|
-
"mutexify","https://github.com/mafintosh/mutexify","['MIT']","['Mathias Buus']"
|
|
60
|
+
"argparse","https://github.com/nodeca/argparse","['Python-2.0']","['nodeca']"
|
|
61
|
+
"astring","https://github.com/davidbonnet/astring","['MIT']","['David Bonnet']"
|
|
62
|
+
"cjs-module-lexer","https://github.com/nodejs/cjs-module-lexer","['MIT']","['Guy Bedford']"
|
|
63
|
+
"crypto-randomuuid","npm:crypto-randomuuid","['MIT']","['Stephen Belanger']"
|
|
64
|
+
"dc-polyfill","https://github.com/DataDog/dc-polyfill","['MIT']","['Thomas Hunter II']"
|
|
65
|
+
"dd-trace","https://github.com/DataDog/dd-trace-js","['(Apache-2.0 OR BSD-3-Clause)']","['Datadog Inc. <info@datadoghq.com>']"
|
|
66
|
+
"detect-newline","https://github.com/sindresorhus/detect-newline","['MIT']","['Sindre Sorhus']"
|
|
67
|
+
"escape-string-regexp","https://github.com/sindresorhus/escape-string-regexp","['MIT']","['Sindre Sorhus']"
|
|
68
|
+
"esquery","https://github.com/estools/esquery","['BSD-3-Clause']","['Joel Feenstra']"
|
|
69
|
+
"estraverse","https://github.com/estools/estraverse","['BSD-2-Clause']","['estools']"
|
|
70
|
+
"fast-fifo","https://github.com/mafintosh/fast-fifo","['MIT']","['Mathias Buus']"
|
|
71
|
+
"ignore","https://github.com/kaelzhang/node-ignore","['MIT']","['kael']"
|
|
72
|
+
"import-in-the-middle","https://github.com/nodejs/import-in-the-middle","['Apache-2.0']","['Bryan English']"
|
|
73
|
+
"istanbul-lib-coverage","https://github.com/istanbuljs/istanbuljs","['BSD-3-Clause']","['Krishnan Anantheswaran']"
|
|
74
|
+
"jest-docblock","https://github.com/jestjs/jest","['MIT']","['jestjs']"
|
|
75
|
+
"js-yaml","https://github.com/nodeca/js-yaml","['MIT']","['Vladimir Zapparov']"
|
|
76
|
+
"jsep","https://github.com/EricSmekens/jsep","['MIT']","['Stephen Oney']"
|
|
77
|
+
"jsonpath-plus","https://github.com/JSONPath-Plus/JSONPath","['MIT']","['Stefan Goessner']"
|
|
78
|
+
"limiter","https://github.com/jhurliman/node-rate-limiter","['MIT']","['John Hurliman']"
|
|
79
|
+
"lodash.sortby","https://github.com/lodash/lodash","['MIT']","['John-David Dalton']"
|
|
80
|
+
"long","https://github.com/dcodeIO/long.js","['Apache-2.0']","['Daniel Wirtz']"
|
|
81
|
+
"lru-cache","https://github.com/isaacs/node-lru-cache","['ISC']","['Isaac Z. Schlueter']"
|
|
82
|
+
"meriyah","https://github.com/meriyah/meriyah","['ISC']","['Kenny F.']"
|
|
83
|
+
"module-details-from-path","https://github.com/watson/module-details-from-path","['MIT']","['Thomas Watson']"
|
|
84
|
+
"mutexify","https://github.com/mafintosh/mutexify","['MIT']","['Mathias Buus']"
|
|
83
85
|
"node-addon-api","https://github.com/nodejs/node-addon-api","['MIT']","['nodejs']"
|
|
84
86
|
"node-gyp-build","https://github.com/prebuild/node-gyp-build","['MIT']","['Mathias Buus']"
|
|
85
87
|
"opentracing","https://github.com/opentracing/opentracing-javascript","['Apache-2.0']","['opentracing']"
|
|
86
88
|
"oxc-parser","https://github.com/oxc-project/oxc","['MIT']","['Boshen and oxc contributors']"
|
|
87
89
|
"path-to-regexp","https://github.com/pillarjs/path-to-regexp","['MIT']","['pillarjs']"
|
|
88
90
|
"pprof-format","https://github.com/DataDog/pprof-format","['MIT']","['Datadog Inc.']"
|
|
89
|
-
"protobufjs","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
90
|
-
"queue-tick","https://github.com/mafintosh/queue-tick","['MIT']","['Mathias Buus']"
|
|
91
|
-
"retry","https://github.com/tim-kos/node-retry","['MIT']","['Tim Koschützki']"
|
|
92
|
-
"rfdc","https://github.com/davidmarkclements/rfdc","['MIT']","['David Mark Clements']"
|
|
93
|
-
"semifies","https://github.com/holepunchto/semifies","['Apache-2.0']","['Holepunch Inc']"
|
|
94
|
-
"shell-quote","https://github.com/ljharb/shell-quote","['MIT']","['James Halliday']"
|
|
91
|
+
"protobufjs","https://github.com/protobufjs/protobuf.js","['BSD-3-Clause']","['Daniel Wirtz']"
|
|
92
|
+
"queue-tick","https://github.com/mafintosh/queue-tick","['MIT']","['Mathias Buus']"
|
|
93
|
+
"retry","https://github.com/tim-kos/node-retry","['MIT']","['Tim Koschützki']"
|
|
94
|
+
"rfdc","https://github.com/davidmarkclements/rfdc","['MIT']","['David Mark Clements']"
|
|
95
|
+
"semifies","https://github.com/holepunchto/semifies","['Apache-2.0']","['Holepunch Inc']"
|
|
96
|
+
"shell-quote","https://github.com/ljharb/shell-quote","['MIT']","['James Halliday']"
|
|
95
97
|
"source-map","https://github.com/mozilla/source-map","['BSD-3-Clause']","['Nick Fitzgerald']"
|
|
96
98
|
"spark-md5","https://github.com/satazor/js-spark-md5","['(WTFPL OR MIT)']","['André Cruz']"
|
|
97
99
|
"tlhunter-sorted-set","https://github.com/tlhunter/node-sorted-set","['MIT']","['Thomas Hunter II']"
|
|
98
100
|
"tslib","https://github.com/microsoft/tslib","['0BSD']","['Microsoft Corp.']"
|
|
99
101
|
"ttl-set","https://github.com/watson/ttl-set","['MIT']","['Thomas Watson']"
|
|
100
102
|
"undici-types","https://github.com/nodejs/undici","['MIT']","['nodejs']"
|
|
101
|
-
"aws-lambda-nodejs-runtime-interface-client","https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/v2.1.0/src/utils/UserFunction.ts","['Apache-2.0']","['Amazon.com Inc. or its affiliates']"
|
|
102
|
-
"is-git-url","https://github.com/jonschlinkert/is-git-url/blob/396965ffabf2f46656c8af4c47bef1d69f09292e/index.js#L9C15-L9C87","['MIT']","['Jon Schlinkert']"
|
|
103
|
+
"aws-lambda-nodejs-runtime-interface-client","https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/v2.1.0/src/utils/UserFunction.ts","['Apache-2.0']","['Amazon.com Inc. or its affiliates']"
|
|
104
|
+
"is-git-url","https://github.com/jonschlinkert/is-git-url/blob/396965ffabf2f46656c8af4c47bef1d69f09292e/index.js#L9C15-L9C87","['MIT']","['Jon Schlinkert']"
|
package/index.d.ts
CHANGED
|
@@ -456,11 +456,15 @@ declare namespace tracer {
|
|
|
456
456
|
export interface PropagationStyle {
|
|
457
457
|
/**
|
|
458
458
|
* Selection of context propagation injection mechanisms.
|
|
459
|
+
* @env DD_TRACE_PROPAGATION_STYLE, DD_TRACE_PROPAGATION_STYLE_INJECT
|
|
460
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
459
461
|
*/
|
|
460
462
|
inject: string[],
|
|
461
463
|
|
|
462
464
|
/**
|
|
463
465
|
* Selection and priority order of context propagation extraction mechanisms.
|
|
466
|
+
* @env DD_TRACE_PROPAGATION_STYLE, DD_TRACE_PROPAGATION_STYLE_EXTRACT
|
|
467
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
464
468
|
*/
|
|
465
469
|
extract: string[]
|
|
466
470
|
}
|
|
@@ -477,6 +481,14 @@ declare namespace tracer {
|
|
|
477
481
|
*/
|
|
478
482
|
apmTracingEnabled?: boolean
|
|
479
483
|
|
|
484
|
+
/**
|
|
485
|
+
* List of baggage tag keys to be included in the baggage.
|
|
486
|
+
* @default ['user.id', 'session.id', 'account.id']
|
|
487
|
+
* @env DD_TRACE_BAGGAGE_TAG_KEYS
|
|
488
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
489
|
+
*/
|
|
490
|
+
baggageTagKeys?: string[];
|
|
491
|
+
|
|
480
492
|
/**
|
|
481
493
|
* Whether to enable trace ID injection in log records to be able to correlate
|
|
482
494
|
* traces with logs.
|
|
@@ -577,7 +589,7 @@ declare namespace tracer {
|
|
|
577
589
|
|
|
578
590
|
/**
|
|
579
591
|
* Controls the ingestion sample rate (between 0 and 1) between the agent and the backend.
|
|
580
|
-
* @env DD_TRACE_SAMPLE_RATE
|
|
592
|
+
* @env DD_TRACE_SAMPLE_RATE
|
|
581
593
|
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
582
594
|
*/
|
|
583
595
|
sampleRate?: number;
|
|
@@ -682,7 +694,7 @@ declare namespace tracer {
|
|
|
682
694
|
ingestion?: {
|
|
683
695
|
/**
|
|
684
696
|
* Controls the ingestion sample rate (between 0 and 1) between the agent and the backend.
|
|
685
|
-
* @env DD_TRACE_SAMPLE_RATE
|
|
697
|
+
* @env DD_TRACE_SAMPLE_RATE
|
|
686
698
|
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
687
699
|
*/
|
|
688
700
|
sampleRate?: number
|
|
@@ -695,6 +707,22 @@ declare namespace tracer {
|
|
|
695
707
|
rateLimit?: number
|
|
696
708
|
};
|
|
697
709
|
|
|
710
|
+
/**
|
|
711
|
+
* Whether to enable inferred proxy services.
|
|
712
|
+
* @default false
|
|
713
|
+
* @env DD_TRACE_INFERRED_PROXY_SERVICES_ENABLED
|
|
714
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
715
|
+
*/
|
|
716
|
+
inferredProxyServicesEnabled?: boolean
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* The site to use for the trace.
|
|
720
|
+
* @default 'datadoghq.com'
|
|
721
|
+
* @env DD_SITE
|
|
722
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
723
|
+
*/
|
|
724
|
+
site?: string;
|
|
725
|
+
|
|
698
726
|
/**
|
|
699
727
|
* Experimental features can be enabled individually using key / value pairs.
|
|
700
728
|
* @default {}
|
|
@@ -725,24 +753,31 @@ declare namespace tracer {
|
|
|
725
753
|
|
|
726
754
|
/**
|
|
727
755
|
* Configuration of the IAST. Can be a boolean as an alias to `iast.enabled`.
|
|
756
|
+
* @deprecated Please use the non-experimental `iast` option instead.
|
|
728
757
|
*/
|
|
729
758
|
iast?: boolean | IastOptions
|
|
730
759
|
|
|
731
|
-
|
|
760
|
+
/**
|
|
761
|
+
* Configuration of the AppSec. Can be a boolean as an alias to `appsec.enabled`.
|
|
762
|
+
* @deprecated Please use the non-experimental `appsec` option instead.
|
|
763
|
+
*/
|
|
764
|
+
appsec?: boolean | {
|
|
732
765
|
/**
|
|
733
766
|
* Configuration of Standalone ASM mode
|
|
734
767
|
* Deprecated in favor of `apmTracingEnabled`.
|
|
735
768
|
*
|
|
736
|
-
* @deprecated
|
|
769
|
+
* @deprecated Please use `apmTracingEnabled` instead.
|
|
737
770
|
*/
|
|
738
771
|
standalone?: {
|
|
739
772
|
/**
|
|
740
773
|
* Whether to enable Standalone ASM.
|
|
741
774
|
* @default false
|
|
775
|
+
* @env DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED
|
|
776
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
742
777
|
*/
|
|
743
778
|
enabled?: boolean
|
|
744
779
|
}
|
|
745
|
-
},
|
|
780
|
+
} | TracerOptions['appsec'],
|
|
746
781
|
|
|
747
782
|
aiguard?: {
|
|
748
783
|
/**
|
|
@@ -751,6 +786,15 @@ declare namespace tracer {
|
|
|
751
786
|
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
752
787
|
*/
|
|
753
788
|
enabled?: boolean,
|
|
789
|
+
/**
|
|
790
|
+
* Whether to request blocking mode when evaluating prompts via auto-instrumentation.
|
|
791
|
+
* When `true`, AI Guard will block requests that violate security policies.
|
|
792
|
+
* When `false`, AI Guard evaluates but never blocks (monitor-only mode).
|
|
793
|
+
* @default false
|
|
794
|
+
* @env DD_AI_GUARD_BLOCK
|
|
795
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
796
|
+
*/
|
|
797
|
+
block?: boolean,
|
|
754
798
|
/**
|
|
755
799
|
* URL of the AI Guard REST API.
|
|
756
800
|
* @env DD_AI_GUARD_ENDPOINT
|
|
@@ -808,6 +852,7 @@ declare namespace tracer {
|
|
|
808
852
|
|
|
809
853
|
/**
|
|
810
854
|
* Whether to load all built-in plugins.
|
|
855
|
+
* @deprecated To deactivate plugins, use the specific DD_TRACE_<INTEGRATION>_ENABLED environment variables.
|
|
811
856
|
* @default true
|
|
812
857
|
*/
|
|
813
858
|
plugins?: boolean;
|
|
@@ -1092,6 +1137,18 @@ declare namespace tracer {
|
|
|
1092
1137
|
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1093
1138
|
*/
|
|
1094
1139
|
enabled?: boolean
|
|
1140
|
+
|
|
1141
|
+
experimental?: {
|
|
1142
|
+
exit_spans?: {
|
|
1143
|
+
/**
|
|
1144
|
+
* Whether to attach code origin data to exit spans.
|
|
1145
|
+
* @default false
|
|
1146
|
+
* @env DD_CODE_ORIGIN_FOR_SPANS_EXPERIMENTAL_EXIT_SPANS_ENABLED
|
|
1147
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1148
|
+
*/
|
|
1149
|
+
enabled?: boolean
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1095
1152
|
}
|
|
1096
1153
|
|
|
1097
1154
|
/**
|
|
@@ -1226,6 +1283,134 @@ declare namespace tracer {
|
|
|
1226
1283
|
*/
|
|
1227
1284
|
redactionExcludedIdentifiers?: string[]
|
|
1228
1285
|
}
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* Maximum size in bytes for serialized baggage items.
|
|
1289
|
+
* @default 8192
|
|
1290
|
+
* @env DD_TRACE_BAGGAGE_MAX_BYTES
|
|
1291
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1292
|
+
*/
|
|
1293
|
+
baggageMaxBytes?: number
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Maximum number of baggage items allowed on a context.
|
|
1297
|
+
* @default 64
|
|
1298
|
+
* @env DD_TRACE_BAGGAGE_MAX_ITEMS
|
|
1299
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1300
|
+
*/
|
|
1301
|
+
baggageMaxItems?: number
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* Header tags (key-value pairs comma separated) to extract and attach to spans.
|
|
1305
|
+
* TODO: In the next major version, this will become an object.
|
|
1306
|
+
* @env DD_TRACE_HEADER_TAGS
|
|
1307
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1308
|
+
*/
|
|
1309
|
+
headerTags?: string[]
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Whether to use Datadog legacy baggage extraction and injection behavior.
|
|
1313
|
+
* @default false
|
|
1314
|
+
* @env DD_TRACE_LEGACY_BAGGAGE_ENABLED
|
|
1315
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1316
|
+
*/
|
|
1317
|
+
legacyBaggageEnabled?: boolean
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* Whether middleware spans should be created.
|
|
1321
|
+
* @default true
|
|
1322
|
+
* @env DD_TRACE_MIDDLEWARE_TRACING_ENABLED
|
|
1323
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1324
|
+
*/
|
|
1325
|
+
middlewareTracingEnabled?: boolean
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* Whether to enable OpenAI log collection.
|
|
1329
|
+
* @default false
|
|
1330
|
+
* @env DD_OPENAI_LOGS_ENABLED
|
|
1331
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1332
|
+
*/
|
|
1333
|
+
openAiLogsEnabled?: boolean
|
|
1334
|
+
|
|
1335
|
+
/**
|
|
1336
|
+
* Peer service name remapping rules.
|
|
1337
|
+
* @env DD_TRACE_PEER_SERVICE_MAPPING
|
|
1338
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1339
|
+
*/
|
|
1340
|
+
peerServiceMapping?: { [key: string]: string }
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* Controls the naming schema version used for spans.
|
|
1344
|
+
* @default 'v0'
|
|
1345
|
+
* @env DD_TRACE_SPAN_ATTRIBUTE_SCHEMA
|
|
1346
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1347
|
+
*/
|
|
1348
|
+
spanAttributeSchema?: 'v0' | 'v1'
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* Whether to compute peer.service tags automatically.
|
|
1352
|
+
* @default false
|
|
1353
|
+
* @env DD_TRACE_PEER_SERVICE_DEFAULTS_ENABLED
|
|
1354
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1355
|
+
*/
|
|
1356
|
+
spanComputePeerService?: boolean
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* Whether to remove integration names from service names under the active schema.
|
|
1360
|
+
* @default false
|
|
1361
|
+
* @env DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED
|
|
1362
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1363
|
+
*/
|
|
1364
|
+
spanRemoveIntegrationFromService?: boolean
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* Whether to enable client-side stats computation.
|
|
1368
|
+
* @default false
|
|
1369
|
+
* @env DD_TRACE_STATS_COMPUTATION_ENABLED
|
|
1370
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1371
|
+
*/
|
|
1372
|
+
stats?: boolean
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* Whether to generate 128-bit trace IDs.
|
|
1376
|
+
* @default true
|
|
1377
|
+
* @env DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED
|
|
1378
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1379
|
+
*/
|
|
1380
|
+
traceId128BitGenerationEnabled?: boolean
|
|
1381
|
+
|
|
1382
|
+
/**
|
|
1383
|
+
* Whether to include the high 64 bits of 128-bit trace IDs in logs.
|
|
1384
|
+
* @default true
|
|
1385
|
+
* @env DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED
|
|
1386
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1387
|
+
*/
|
|
1388
|
+
traceId128BitLoggingEnabled?: boolean
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Whether websocket message spans should be created.
|
|
1392
|
+
* @default true
|
|
1393
|
+
* @env DD_TRACE_WEBSOCKET_MESSAGES_ENABLED
|
|
1394
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1395
|
+
*/
|
|
1396
|
+
traceWebsocketMessagesEnabled?: boolean
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Whether websocket message spans should inherit sampling decisions.
|
|
1400
|
+
* @default true
|
|
1401
|
+
* @env DD_TRACE_WEBSOCKET_MESSAGES_INHERIT_SAMPLING
|
|
1402
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1403
|
+
*/
|
|
1404
|
+
traceWebsocketMessagesInheritSampling?: boolean
|
|
1405
|
+
|
|
1406
|
+
/**
|
|
1407
|
+
* Whether websocket message spans should start separate traces.
|
|
1408
|
+
* @default true
|
|
1409
|
+
* @env DD_TRACE_WEBSOCKET_MESSAGES_SEPARATE_TRACES
|
|
1410
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
1411
|
+
*/
|
|
1412
|
+
traceWebsocketMessagesSeparateTraces?: boolean
|
|
1413
|
+
|
|
1229
1414
|
}
|
|
1230
1415
|
|
|
1231
1416
|
/**
|
|
@@ -3256,13 +3441,6 @@ declare namespace tracer {
|
|
|
3256
3441
|
*/
|
|
3257
3442
|
maxContextOperations?: number,
|
|
3258
3443
|
|
|
3259
|
-
/**
|
|
3260
|
-
* Defines the pattern to ignore cookie names in the vulnerability hash calculation
|
|
3261
|
-
* @default ".{32,}"
|
|
3262
|
-
* @deprecated This property has no effect because hash calculation algorithm has been updated for cookie vulnerabilities
|
|
3263
|
-
*/
|
|
3264
|
-
cookieFilterPattern?: string,
|
|
3265
|
-
|
|
3266
3444
|
/**
|
|
3267
3445
|
* Defines the number of rows to taint in data coming from databases
|
|
3268
3446
|
* @default 1
|
|
@@ -3304,7 +3482,7 @@ declare namespace tracer {
|
|
|
3304
3482
|
* Allows to enable security controls. This option is not supported when
|
|
3305
3483
|
* using ESM.
|
|
3306
3484
|
* @deprecated Please use the DD_IAST_SECURITY_CONTROLS_CONFIGURATION
|
|
3307
|
-
* environment variable instead.
|
|
3485
|
+
* environment variable instead. This option will be removed in the next major version.
|
|
3308
3486
|
* @env DD_IAST_SECURITY_CONTROLS_CONFIGURATION
|
|
3309
3487
|
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
3310
3488
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.96.0",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
],
|
|
140
140
|
"dependencies": {
|
|
141
141
|
"dc-polyfill": "^0.1.10",
|
|
142
|
-
"import-in-the-middle": "^3.0.
|
|
142
|
+
"import-in-the-middle": "^3.0.1"
|
|
143
143
|
},
|
|
144
144
|
"optionalDependencies": {
|
|
145
145
|
"@datadog/libdatadog": "0.9.2",
|
|
@@ -3,11 +3,113 @@
|
|
|
3
3
|
const { channel, tracingChannel } = require('dc-polyfill')
|
|
4
4
|
const shimmer = require('../../datadog-shimmer')
|
|
5
5
|
const { addHook, getHooks } = require('./helpers/instrument')
|
|
6
|
+
const { convertVercelPromptToMessages, buildOutputMessages } = require('./helpers/ai-messages')
|
|
6
7
|
|
|
7
8
|
const vercelAiTracingChannel = tracingChannel('dd-trace:vercel-ai')
|
|
8
9
|
const vercelAiSpanSetAttributesChannel = channel('dd-trace:vercel-ai:span:setAttributes')
|
|
10
|
+
const aiguardChannel = channel('dd-trace:ai:aiguard')
|
|
9
11
|
|
|
10
12
|
const tracers = new WeakSet()
|
|
13
|
+
const wrappedModels = new WeakSet()
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Publishes already-converted AI guard style messages to the AIGuard channel.
|
|
17
|
+
*
|
|
18
|
+
* @param {Array<object>} messages - AI guard style messages to evaluate
|
|
19
|
+
* @returns {Promise<void>}
|
|
20
|
+
*/
|
|
21
|
+
function publishToAIGuard (messages) {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
aiguardChannel.publish({ messages, resolve, reject })
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Wraps a Vercel AI language model's doGenerate and doStream methods to evaluate
|
|
29
|
+
* messages with AIGuard.
|
|
30
|
+
*
|
|
31
|
+
* @param {object} model - A Vercel AI language model instance
|
|
32
|
+
*/
|
|
33
|
+
function wrapModelWithAIGuard (model) {
|
|
34
|
+
if (!model || wrappedModels.has(model)) return
|
|
35
|
+
wrappedModels.add(model)
|
|
36
|
+
|
|
37
|
+
if (typeof model.doGenerate === 'function') {
|
|
38
|
+
shimmer.wrap(model, 'doGenerate', function (original) {
|
|
39
|
+
return function (options) {
|
|
40
|
+
const originalResult = original.call(this, options)
|
|
41
|
+
|
|
42
|
+
if (!aiguardChannel.hasSubscribers) return originalResult
|
|
43
|
+
if (!options.prompt?.length) return originalResult
|
|
44
|
+
|
|
45
|
+
const inputMessages = convertVercelPromptToMessages(options.prompt)
|
|
46
|
+
if (!inputMessages.length) return originalResult
|
|
47
|
+
|
|
48
|
+
// Run AI Guard input evaluation and LLM call in parallel.
|
|
49
|
+
// The LLM has no side effects so it is safe to discard its result if AI Guard blocks.
|
|
50
|
+
return Promise.all([publishToAIGuard(inputMessages), originalResult])
|
|
51
|
+
.then(([, result]) => {
|
|
52
|
+
if (!result.content?.length) return result
|
|
53
|
+
return publishToAIGuard(buildOutputMessages(inputMessages, result.content))
|
|
54
|
+
.then(() => result)
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (typeof model.doStream === 'function') {
|
|
61
|
+
shimmer.wrap(model, 'doStream', function (original) {
|
|
62
|
+
return function (options) {
|
|
63
|
+
const originalResult = original.call(this, options)
|
|
64
|
+
|
|
65
|
+
if (!aiguardChannel.hasSubscribers) return originalResult
|
|
66
|
+
if (!options.prompt?.length) return originalResult
|
|
67
|
+
|
|
68
|
+
const inputMessages = convertVercelPromptToMessages(options.prompt)
|
|
69
|
+
if (!inputMessages.length) return originalResult
|
|
70
|
+
|
|
71
|
+
// Run AI Guard input evaluation and LLM call in parallel.
|
|
72
|
+
// The LLM has no side effects so it is safe to discard its result if AI Guard blocks.
|
|
73
|
+
return Promise.all([publishToAIGuard(inputMessages), originalResult])
|
|
74
|
+
.then(([, result]) => {
|
|
75
|
+
const chunks = []
|
|
76
|
+
const reader = result.stream.getReader()
|
|
77
|
+
|
|
78
|
+
function readAll () {
|
|
79
|
+
return reader.read().then(({ done, value }) => {
|
|
80
|
+
if (done) return
|
|
81
|
+
chunks.push(value)
|
|
82
|
+
return readAll()
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return readAll().then(() => {
|
|
87
|
+
const toolCalls = chunks.filter(c => c?.type === 'tool-call')
|
|
88
|
+
const text = chunks.filter(c => c?.type === 'text-delta').map(c => c.textDelta).join('')
|
|
89
|
+
const content = toolCalls.length ? toolCalls : text ? [{ type: 'text', text }] : []
|
|
90
|
+
|
|
91
|
+
const evaluate = content.length
|
|
92
|
+
? publishToAIGuard(buildOutputMessages(inputMessages, content))
|
|
93
|
+
: Promise.resolve()
|
|
94
|
+
|
|
95
|
+
return evaluate.then(() => {
|
|
96
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
97
|
+
const stream = new ReadableStream({
|
|
98
|
+
start (controller) {
|
|
99
|
+
for (const chunk of chunks) {
|
|
100
|
+
controller.enqueue(chunk)
|
|
101
|
+
}
|
|
102
|
+
controller.close()
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
return { ...result, stream }
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
}
|
|
11
113
|
|
|
12
114
|
function wrapTracer (tracer) {
|
|
13
115
|
if (tracers.has(tracer)) {
|
|
@@ -114,6 +216,16 @@ for (const hook of getHooks('ai')) {
|
|
|
114
216
|
},
|
|
115
217
|
})
|
|
116
218
|
|
|
219
|
+
// resolveLanguageModel is called by all LLM entry points (generateText, streamText,
|
|
220
|
+
// generateObject, streamObject)
|
|
221
|
+
tracingChannel('orchestrion:ai:resolveLanguageModel').subscribe({
|
|
222
|
+
end (ctx) {
|
|
223
|
+
wrapModelWithAIGuard(ctx.result)
|
|
224
|
+
},
|
|
225
|
+
})
|
|
226
|
+
|
|
117
227
|
return exports
|
|
118
228
|
})
|
|
119
229
|
}
|
|
230
|
+
|
|
231
|
+
module.exports = { wrapModelWithAIGuard }
|
|
@@ -41,7 +41,7 @@ function wrapCreate (create) {
|
|
|
41
41
|
const options = arguments[0]
|
|
42
42
|
const stream = options.stream
|
|
43
43
|
|
|
44
|
-
const ctx = { options, resource: 'create' }
|
|
44
|
+
const ctx = { options, resource: 'create', baseUrl: this._client?.baseURL }
|
|
45
45
|
|
|
46
46
|
return anthropicTracingChannel.start.runStores(ctx, () => {
|
|
47
47
|
let apiPromise
|