dd-trace 5.94.0 → 5.95.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.
Files changed (39) hide show
  1. package/LICENSE-3rdparty.csv +46 -44
  2. package/index.d.ts +182 -13
  3. package/package.json +1 -1
  4. package/packages/datadog-instrumentations/src/anthropic.js +1 -1
  5. package/packages/datadog-instrumentations/src/helpers/rewriter/{orchestrion/compiler.js → compiler.js} +4 -13
  6. package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +16 -2
  7. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langgraph.js +2 -2
  8. package/packages/datadog-instrumentations/src/helpers/rewriter/{orchestrion/transforms.js → transforms.js} +3 -89
  9. package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -4
  10. package/packages/dd-trace/src/azure_metadata.js +15 -15
  11. package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +73 -1
  12. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +76 -1
  13. package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +259 -0
  14. package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +56 -0
  15. package/packages/dd-trace/src/config/config-base.d.ts +7 -0
  16. package/packages/dd-trace/src/config/config-base.js +5 -0
  17. package/packages/dd-trace/src/config/config-types.d.ts +78 -0
  18. package/packages/dd-trace/src/config/generated-config-types.d.ts +582 -0
  19. package/packages/dd-trace/src/config/supported-configurations.json +7 -0
  20. package/packages/dd-trace/src/llmobs/constants/tags.js +1 -0
  21. package/packages/dd-trace/src/llmobs/constants/text.js +1 -1
  22. package/packages/dd-trace/src/llmobs/constants/writers.js +1 -1
  23. package/packages/dd-trace/src/llmobs/plugins/anthropic.js +11 -2
  24. package/packages/dd-trace/src/llmobs/plugins/openai/index.js +4 -1
  25. package/packages/dd-trace/src/llmobs/writers/spans.js +1 -1
  26. package/packages/dd-trace/src/priority_sampler.js +1 -1
  27. package/packages/dd-trace/src/rate_limiter.js +2 -1
  28. package/packages/dd-trace/src/tagger.js +31 -35
  29. package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +28 -0
  30. package/vendor/dist/@apm-js-collab/code-transformer/index.js +133 -0
  31. package/vendor/dist/@opentelemetry/core/index.js +1 -1
  32. package/vendor/dist/@opentelemetry/resources/index.js +1 -1
  33. package/vendor/dist/esquery/index.js +1 -1
  34. package/vendor/dist/meriyah/index.js +1 -1
  35. package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/index.js +0 -43
  36. package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/matcher.js +0 -49
  37. package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/transformer.js +0 -121
  38. package/vendor/dist/astring/LICENSE +0 -19
  39. package/vendor/dist/astring/index.js +0 -1
@@ -1,10 +1,11 @@
1
- "component","origin","license","copyright"
2
- "@datadog/flagging-core","https://github.com/DataDog/openfeature-js-client","['Apache-2.0']","['DataDog']"
3
- "@datadog/libdatadog","https://github.com/DataDog/libdatadog-nodejs","['Apache-2.0']","['Datadog Inc.']"
4
- "@datadog/native-appsec","https://github.com/DataDog/dd-native-appsec-js","['Apache-2.0']","['Datadog Inc.']"
5
- "@datadog/native-iast-taint-tracking","https://github.com/DataDog/dd-native-iast-taint-tracking-js","['Apache-2.0']","['Datadog Inc.']"
6
- "@datadog/native-metrics","https://github.com/DataDog/dd-native-metrics-js","['Apache-2.0']","['Datadog Inc.']"
7
- "@datadog/openfeature-node-server","https://github.com/DataDog/openfeature-js-client","['Apache-2.0']","['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, OTEL_TRACES_SAMPLER, OTEL_TRACES_SAMPLER_ARG
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, OTEL_TRACES_SAMPLER, OTEL_TRACES_SAMPLER_ARG
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
- appsec?: {
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
  /**
@@ -808,6 +843,7 @@ declare namespace tracer {
808
843
 
809
844
  /**
810
845
  * Whether to load all built-in plugins.
846
+ * @deprecated To deactivate plugins, use the specific DD_TRACE_<INTEGRATION>_ENABLED environment variables.
811
847
  * @default true
812
848
  */
813
849
  plugins?: boolean;
@@ -1092,6 +1128,18 @@ declare namespace tracer {
1092
1128
  * Programmatic configuration takes precedence over the environment variables listed above.
1093
1129
  */
1094
1130
  enabled?: boolean
1131
+
1132
+ experimental?: {
1133
+ exit_spans?: {
1134
+ /**
1135
+ * Whether to attach code origin data to exit spans.
1136
+ * @default false
1137
+ * @env DD_CODE_ORIGIN_FOR_SPANS_EXPERIMENTAL_EXIT_SPANS_ENABLED
1138
+ * Programmatic configuration takes precedence over the environment variables listed above.
1139
+ */
1140
+ enabled?: boolean
1141
+ }
1142
+ }
1095
1143
  }
1096
1144
 
1097
1145
  /**
@@ -1226,6 +1274,134 @@ declare namespace tracer {
1226
1274
  */
1227
1275
  redactionExcludedIdentifiers?: string[]
1228
1276
  }
1277
+
1278
+ /**
1279
+ * Maximum size in bytes for serialized baggage items.
1280
+ * @default 8192
1281
+ * @env DD_TRACE_BAGGAGE_MAX_BYTES
1282
+ * Programmatic configuration takes precedence over the environment variables listed above.
1283
+ */
1284
+ baggageMaxBytes?: number
1285
+
1286
+ /**
1287
+ * Maximum number of baggage items allowed on a context.
1288
+ * @default 64
1289
+ * @env DD_TRACE_BAGGAGE_MAX_ITEMS
1290
+ * Programmatic configuration takes precedence over the environment variables listed above.
1291
+ */
1292
+ baggageMaxItems?: number
1293
+
1294
+ /**
1295
+ * Header tags (key-value pairs comma separated) to extract and attach to spans.
1296
+ * TODO: In the next major version, this will become an object.
1297
+ * @env DD_TRACE_HEADER_TAGS
1298
+ * Programmatic configuration takes precedence over the environment variables listed above.
1299
+ */
1300
+ headerTags?: string[]
1301
+
1302
+ /**
1303
+ * Whether to use Datadog legacy baggage extraction and injection behavior.
1304
+ * @default false
1305
+ * @env DD_TRACE_LEGACY_BAGGAGE_ENABLED
1306
+ * Programmatic configuration takes precedence over the environment variables listed above.
1307
+ */
1308
+ legacyBaggageEnabled?: boolean
1309
+
1310
+ /**
1311
+ * Whether middleware spans should be created.
1312
+ * @default true
1313
+ * @env DD_TRACE_MIDDLEWARE_TRACING_ENABLED
1314
+ * Programmatic configuration takes precedence over the environment variables listed above.
1315
+ */
1316
+ middlewareTracingEnabled?: boolean
1317
+
1318
+ /**
1319
+ * Whether to enable OpenAI log collection.
1320
+ * @default false
1321
+ * @env DD_OPENAI_LOGS_ENABLED
1322
+ * Programmatic configuration takes precedence over the environment variables listed above.
1323
+ */
1324
+ openAiLogsEnabled?: boolean
1325
+
1326
+ /**
1327
+ * Peer service name remapping rules.
1328
+ * @env DD_TRACE_PEER_SERVICE_MAPPING
1329
+ * Programmatic configuration takes precedence over the environment variables listed above.
1330
+ */
1331
+ peerServiceMapping?: { [key: string]: string }
1332
+
1333
+ /**
1334
+ * Controls the naming schema version used for spans.
1335
+ * @default 'v0'
1336
+ * @env DD_TRACE_SPAN_ATTRIBUTE_SCHEMA
1337
+ * Programmatic configuration takes precedence over the environment variables listed above.
1338
+ */
1339
+ spanAttributeSchema?: 'v0' | 'v1'
1340
+
1341
+ /**
1342
+ * Whether to compute peer.service tags automatically.
1343
+ * @default false
1344
+ * @env DD_TRACE_PEER_SERVICE_DEFAULTS_ENABLED
1345
+ * Programmatic configuration takes precedence over the environment variables listed above.
1346
+ */
1347
+ spanComputePeerService?: boolean
1348
+
1349
+ /**
1350
+ * Whether to remove integration names from service names under the active schema.
1351
+ * @default false
1352
+ * @env DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED
1353
+ * Programmatic configuration takes precedence over the environment variables listed above.
1354
+ */
1355
+ spanRemoveIntegrationFromService?: boolean
1356
+
1357
+ /**
1358
+ * Whether to enable client-side stats computation.
1359
+ * @default false
1360
+ * @env DD_TRACE_STATS_COMPUTATION_ENABLED
1361
+ * Programmatic configuration takes precedence over the environment variables listed above.
1362
+ */
1363
+ stats?: boolean
1364
+
1365
+ /**
1366
+ * Whether to generate 128-bit trace IDs.
1367
+ * @default true
1368
+ * @env DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED
1369
+ * Programmatic configuration takes precedence over the environment variables listed above.
1370
+ */
1371
+ traceId128BitGenerationEnabled?: boolean
1372
+
1373
+ /**
1374
+ * Whether to include the high 64 bits of 128-bit trace IDs in logs.
1375
+ * @default true
1376
+ * @env DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED
1377
+ * Programmatic configuration takes precedence over the environment variables listed above.
1378
+ */
1379
+ traceId128BitLoggingEnabled?: boolean
1380
+
1381
+ /**
1382
+ * Whether websocket message spans should be created.
1383
+ * @default true
1384
+ * @env DD_TRACE_WEBSOCKET_MESSAGES_ENABLED
1385
+ * Programmatic configuration takes precedence over the environment variables listed above.
1386
+ */
1387
+ traceWebsocketMessagesEnabled?: boolean
1388
+
1389
+ /**
1390
+ * Whether websocket message spans should inherit sampling decisions.
1391
+ * @default true
1392
+ * @env DD_TRACE_WEBSOCKET_MESSAGES_INHERIT_SAMPLING
1393
+ * Programmatic configuration takes precedence over the environment variables listed above.
1394
+ */
1395
+ traceWebsocketMessagesInheritSampling?: boolean
1396
+
1397
+ /**
1398
+ * Whether websocket message spans should start separate traces.
1399
+ * @default true
1400
+ * @env DD_TRACE_WEBSOCKET_MESSAGES_SEPARATE_TRACES
1401
+ * Programmatic configuration takes precedence over the environment variables listed above.
1402
+ */
1403
+ traceWebsocketMessagesSeparateTraces?: boolean
1404
+
1229
1405
  }
1230
1406
 
1231
1407
  /**
@@ -3256,13 +3432,6 @@ declare namespace tracer {
3256
3432
  */
3257
3433
  maxContextOperations?: number,
3258
3434
 
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
3435
  /**
3267
3436
  * Defines the number of rows to taint in data coming from databases
3268
3437
  * @default 1
@@ -3304,7 +3473,7 @@ declare namespace tracer {
3304
3473
  * Allows to enable security controls. This option is not supported when
3305
3474
  * using ESM.
3306
3475
  * @deprecated Please use the DD_IAST_SECURITY_CONTROLS_CONFIGURATION
3307
- * environment variable instead.
3476
+ * environment variable instead. This option will be removed in the next major version.
3308
3477
  * @env DD_IAST_SECURITY_CONTROLS_CONFIGURATION
3309
3478
  * Programmatic configuration takes precedence over the environment variables listed above.
3310
3479
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dd-trace",
3
- "version": "5.94.0",
3
+ "version": "5.95.0",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -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
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- const log = require('../../../../../dd-trace/src/log')
3
+ const log = require('../../../../dd-trace/src/log')
4
4
 
5
5
  // eslint-disable-next-line camelcase, no-undef
6
6
  const runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
@@ -25,7 +25,7 @@ const compiler = {
25
25
  log.error(e)
26
26
 
27
27
  // Fallback for when OXC is not available.
28
- const meriyah = require('../../../../../../vendor/dist/meriyah')
28
+ const meriyah = require('../../../../../vendor/dist/meriyah')
29
29
 
30
30
  compiler.parse = (sourceText, { range, sourceType } = {}) => {
31
31
  return meriyah.parse(sourceText.toString(), {
@@ -39,16 +39,8 @@ const compiler = {
39
39
  return compiler.parse(sourceText, options)
40
40
  },
41
41
 
42
- generate: (...args) => {
43
- const astring = require('../../../../../../vendor/dist/astring')
44
-
45
- compiler.generate = astring.generate
46
-
47
- return compiler.generate(...args)
48
- },
49
-
50
42
  traverse: (ast, query, visitor) => {
51
- const esquery = require('../../../../../../vendor/dist/esquery').default
43
+ const esquery = require('../../../../../vendor/dist/esquery')
52
44
 
53
45
  compiler.traverse = (ast, query, visitor) => {
54
46
  return esquery.traverse(ast, esquery.parse(query), visitor)
@@ -58,7 +50,7 @@ const compiler = {
58
50
  },
59
51
 
60
52
  query: (ast, query) => {
61
- const esquery = require('../../../../../../vendor/dist/esquery').default
53
+ const esquery = require('../../../../../vendor/dist/esquery')
62
54
 
63
55
  compiler.query = esquery.query
64
56
 
@@ -68,7 +60,6 @@ const compiler = {
68
60
 
69
61
  module.exports = {
70
62
  parse: (...args) => compiler.parse(...args),
71
- generate: (...args) => compiler.generate(...args),
72
63
  traverse: (...args) => compiler.traverse(...args),
73
64
  query: (...args) => compiler.query(...args),
74
65
  }
@@ -3,13 +3,27 @@
3
3
  const { readFileSync } = require('fs')
4
4
  const { join } = require('path')
5
5
  const log = require('../../../../dd-trace/src/log')
6
+ const { create } = require('../../../../../vendor/dist/@apm-js-collab/code-transformer')
7
+ const { traceAsyncIterator, traceIterator } = require('./transforms')
6
8
  const instrumentations = require('./instrumentations')
7
- const { create } = require('./orchestrion')
9
+
10
+ let dcPolyfill
11
+
12
+ try {
13
+ dcPolyfill = require.resolve('dc-polyfill').replaceAll('\\', '/')
14
+ } catch {
15
+ // The `dc-polyfill` module is unavailable for some reason (like bundling).
16
+ // Let's just keep the default of using `diagnostics-channel` as a fallback
17
+ // which works for most Node versions.
18
+ }
8
19
 
9
20
  /** @type {Record<string, string>} map of module base name to version */
10
21
  const moduleVersions = {}
11
22
  const disabled = new Set()
12
- const matcher = create(instrumentations, 'dc-polyfill')
23
+ const matcher = create(instrumentations, dcPolyfill)
24
+
25
+ matcher.addTransform('traceIterator', traceIterator)
26
+ matcher.addTransform('traceAsyncIterator', traceAsyncIterator)
13
27
 
14
28
  function rewrite (content, filename, format) {
15
29
  if (!content) return content
@@ -10,9 +10,9 @@ module.exports = [
10
10
  functionQuery: {
11
11
  methodName: 'stream',
12
12
  className: 'Pregel',
13
- kind: 'AsyncIterator',
14
13
  },
15
14
  channelName: 'Pregel_stream',
15
+ transform: 'traceAsyncIterator',
16
16
  },
17
17
  {
18
18
  module: {
@@ -23,8 +23,8 @@ module.exports = [
23
23
  functionQuery: {
24
24
  methodName: 'stream',
25
25
  className: 'Pregel',
26
- kind: 'AsyncIterator',
27
26
  },
28
27
  channelName: 'Pregel_stream',
28
+ transform: 'traceAsyncIterator',
29
29
  },
30
30
  ]
@@ -1,5 +1,7 @@
1
1
  'use strict'
2
2
 
3
+ // TODO: Move traceIterator to Orchestrion.
4
+
3
5
  const { parse, query, traverse } = require('./compiler')
4
6
 
5
7
  const tracingChannelPredicate = (node) => (
@@ -36,10 +38,7 @@ const transforms = module.exports = {
36
38
  },
37
39
 
38
40
  traceAsyncIterator: traceAny,
39
- traceCallback: traceAny,
40
41
  traceIterator: traceAny,
41
- tracePromise: traceAny,
42
- traceSync: traceAny,
43
42
  }
44
43
 
45
44
  function traceAny (state, node, _parent, ancestry) {
@@ -117,33 +116,10 @@ function traceInstanceMethod (state, node, program) {
117
116
  }
118
117
 
119
118
  function wrap (state, node, program) {
120
- const { channelName, operator } = state
119
+ const { operator } = state
121
120
 
122
121
  if (operator === 'traceAsyncIterator') return wrapIterator(state, node, program)
123
- if (operator === 'traceCallback') return wrapCallback(state, node)
124
122
  if (operator === 'traceIterator') return wrapIterator(state, node, program)
125
-
126
- const async = operator === 'tracePromise' ? 'async' : ''
127
- const channelVariable = 'tr_ch_apm$' + channelName.replaceAll(':', '_')
128
- const wrapper = parse(`
129
- function wrapper () {
130
- const __apm$traced = ${async} () => {
131
- const __apm$wrapped = () => {};
132
- return __apm$wrapped.apply(this, arguments);
133
- };
134
- if (!${channelVariable}.hasSubscribers) return __apm$traced();
135
- return ${channelVariable}.${operator}(__apm$traced, {
136
- arguments,
137
- self: this,
138
- moduleVersion: "1.0.0"
139
- });
140
- }
141
- `).body[0].body // Extract only block statement of function body.
142
-
143
- // Replace the right-hand side assignment of `const __apm$wrapped = () => {}`.
144
- query(wrapper, '[id.name=__apm$wrapped]')[0].init = node
145
-
146
- return wrapper
147
123
  }
148
124
 
149
125
  function wrapSuper (_state, node) {
@@ -195,68 +171,6 @@ function wrapSuper (_state, node) {
195
171
  }
196
172
  }
197
173
 
198
- function wrapCallback (state, node) {
199
- const { channelName, functionQuery: { callbackIndex = -1 } } = state
200
- const channelVariable = 'tr_ch_apm$' + channelName.replaceAll(':', '_')
201
- const wrapper = parse(`
202
- function wrapper () {
203
- const __apm$cb = Array.prototype.at.call(arguments, ${callbackIndex});
204
- const __apm$ctx = {
205
- arguments,
206
- self: this,
207
- moduleVersion: "1.0.0"
208
- };
209
- const __apm$traced = () => {
210
- const __apm$wrapped = () => {};
211
- return __apm$wrapped.apply(this, arguments);
212
- };
213
-
214
- if (!${channelVariable}.start.hasSubscribers) return __apm$traced();
215
-
216
- function __apm$wrappedCb(err, res) {
217
- if (err) {
218
- __apm$ctx.error = err;
219
- ${channelVariable}.error.publish(__apm$ctx);
220
- } else {
221
- __apm$ctx.result = res;
222
- }
223
-
224
- ${channelVariable}.asyncStart.runStores(__apm$ctx, () => {
225
- try {
226
- if (__apm$cb) {
227
- return __apm$cb.apply(this, arguments);
228
- }
229
- } finally {
230
- ${channelVariable}.asyncEnd.publish(__apm$ctx);
231
- }
232
- });
233
- }
234
-
235
- if (typeof __apm$cb !== 'function') {
236
- return __apm$traced();
237
- }
238
- Array.prototype.splice.call(arguments, ${callbackIndex}, 1, __apm$wrappedCb);
239
-
240
- return ${channelVariable}.start.runStores(__apm$ctx, () => {
241
- try {
242
- return __apm$traced();
243
- } catch (err) {
244
- __apm$ctx.error = err;
245
- ${channelVariable}.error.publish(__apm$ctx);
246
- throw err;
247
- } finally {
248
- ${channelVariable}.end.publish(__apm$ctx);
249
- }
250
- });
251
- }
252
- `).body[0].body // Extract only block statement of function body.
253
-
254
- // Replace the right-hand side assignment of `const __apm$wrapped = () => {}`.
255
- query(wrapper, '[id.name=__apm$wrapped]')[0].init = node
256
-
257
- return wrapper
258
- }
259
-
260
174
  function wrapIterator (state, node, program) {
261
175
  const { channelName, operator } = state
262
176
  const baseChannel = channelName.replaceAll(':', '_')