dd-trace 5.51.0 → 5.53.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 (98) hide show
  1. package/LICENSE-3rdparty.csv +0 -6
  2. package/README.md +5 -0
  3. package/index.d.ts +88 -6
  4. package/package.json +3 -9
  5. package/packages/datadog-instrumentations/src/amqplib.js +8 -5
  6. package/packages/datadog-instrumentations/src/child_process.js +2 -1
  7. package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +406 -0
  8. package/packages/datadog-instrumentations/src/couchbase.js +2 -1
  9. package/packages/datadog-instrumentations/src/cucumber.js +43 -45
  10. package/packages/datadog-instrumentations/src/dns.js +16 -14
  11. package/packages/datadog-instrumentations/src/express.js +2 -6
  12. package/packages/datadog-instrumentations/src/fs.js +43 -51
  13. package/packages/datadog-instrumentations/src/helpers/hooks.js +2 -0
  14. package/packages/datadog-instrumentations/src/helpers/register.js +17 -12
  15. package/packages/datadog-instrumentations/src/http/client.js +2 -1
  16. package/packages/datadog-instrumentations/src/iovalkey.js +51 -0
  17. package/packages/datadog-instrumentations/src/jest.js +53 -40
  18. package/packages/datadog-instrumentations/src/kafkajs.js +21 -8
  19. package/packages/datadog-instrumentations/src/mocha/main.js +33 -46
  20. package/packages/datadog-instrumentations/src/mocha/utils.js +76 -74
  21. package/packages/datadog-instrumentations/src/mysql2.js +3 -1
  22. package/packages/datadog-instrumentations/src/net.js +27 -29
  23. package/packages/datadog-instrumentations/src/next.js +6 -14
  24. package/packages/datadog-instrumentations/src/pg.js +15 -7
  25. package/packages/datadog-instrumentations/src/playwright.js +64 -67
  26. package/packages/datadog-instrumentations/src/url.js +9 -17
  27. package/packages/datadog-instrumentations/src/vitest.js +66 -72
  28. package/packages/datadog-plugin-confluentinc-kafka-javascript/src/batch-consumer.js +11 -0
  29. package/packages/datadog-plugin-confluentinc-kafka-javascript/src/consumer.js +11 -0
  30. package/packages/datadog-plugin-confluentinc-kafka-javascript/src/index.js +19 -0
  31. package/packages/datadog-plugin-confluentinc-kafka-javascript/src/producer.js +11 -0
  32. package/packages/datadog-plugin-cucumber/src/index.js +32 -18
  33. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +3 -0
  34. package/packages/datadog-plugin-dns/src/lookup.js +10 -5
  35. package/packages/datadog-plugin-dns/src/lookup_service.js +6 -2
  36. package/packages/datadog-plugin-dns/src/resolve.js +5 -2
  37. package/packages/datadog-plugin-dns/src/reverse.js +6 -2
  38. package/packages/datadog-plugin-fs/src/index.js +9 -2
  39. package/packages/datadog-plugin-iovalkey/src/index.js +18 -0
  40. package/packages/datadog-plugin-jest/src/index.js +17 -8
  41. package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +2 -1
  42. package/packages/datadog-plugin-kafkajs/src/consumer.js +12 -21
  43. package/packages/datadog-plugin-kafkajs/src/producer.js +12 -5
  44. package/packages/datadog-plugin-kafkajs/src/utils.js +27 -0
  45. package/packages/datadog-plugin-langchain/src/index.js +0 -1
  46. package/packages/datadog-plugin-mocha/src/index.js +58 -35
  47. package/packages/datadog-plugin-net/src/ipc.js +6 -4
  48. package/packages/datadog-plugin-net/src/tcp.js +15 -9
  49. package/packages/datadog-plugin-pg/src/index.js +5 -1
  50. package/packages/datadog-plugin-playwright/src/index.js +29 -20
  51. package/packages/datadog-plugin-redis/src/index.js +8 -3
  52. package/packages/datadog-plugin-vitest/src/index.js +67 -44
  53. package/packages/datadog-shimmer/src/shimmer.js +164 -33
  54. package/packages/dd-trace/src/appsec/api_security_sampler.js +20 -12
  55. package/packages/dd-trace/src/appsec/graphql.js +2 -2
  56. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +14 -9
  57. package/packages/dd-trace/src/appsec/index.js +15 -12
  58. package/packages/dd-trace/src/appsec/rasp/index.js +4 -2
  59. package/packages/dd-trace/src/appsec/rasp/utils.js +11 -6
  60. package/packages/dd-trace/src/appsec/sdk/user_blocking.js +2 -2
  61. package/packages/dd-trace/src/appsec/telemetry/index.js +1 -2
  62. package/packages/dd-trace/src/appsec/telemetry/rasp.js +0 -9
  63. package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +6 -6
  64. package/packages/dd-trace/src/baggage.js +36 -0
  65. package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +4 -2
  66. package/packages/dd-trace/src/config.js +14 -2
  67. package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +61 -7
  68. package/packages/dd-trace/src/debugger/devtools_client/index.js +10 -26
  69. package/packages/dd-trace/src/debugger/devtools_client/send.js +8 -7
  70. package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +15 -7
  71. package/packages/dd-trace/src/debugger/devtools_client/state.js +22 -2
  72. package/packages/dd-trace/src/dogstatsd.js +2 -0
  73. package/packages/dd-trace/src/exporters/common/docker.js +13 -31
  74. package/packages/dd-trace/src/guardrails/telemetry.js +2 -5
  75. package/packages/dd-trace/src/llmobs/tagger.js +3 -3
  76. package/packages/dd-trace/src/llmobs/writers/base.js +33 -12
  77. package/packages/dd-trace/src/noop/proxy.js +5 -0
  78. package/packages/dd-trace/src/opentelemetry/context_manager.js +2 -0
  79. package/packages/dd-trace/src/opentracing/propagation/text_map.js +17 -9
  80. package/packages/dd-trace/src/plugin_manager.js +2 -0
  81. package/packages/dd-trace/src/plugins/index.js +4 -0
  82. package/packages/dd-trace/src/plugins/log_plugin.js +9 -20
  83. package/packages/dd-trace/src/plugins/outbound.js +11 -3
  84. package/packages/dd-trace/src/plugins/tracing.js +8 -4
  85. package/packages/dd-trace/src/plugins/util/test.js +1 -1
  86. package/packages/dd-trace/src/profiling/exporter_cli.js +1 -1
  87. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookup.js +1 -1
  88. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookupservice.js +1 -1
  89. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_resolve.js +2 -2
  90. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_reverse.js +1 -1
  91. package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +15 -14
  92. package/packages/dd-trace/src/proxy.js +12 -4
  93. package/packages/dd-trace/src/serverless.js +0 -48
  94. package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +8 -0
  95. package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +8 -0
  96. package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +8 -0
  97. package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +4 -0
  98. package/packages/dd-trace/src/standalone/product.js +3 -5
@@ -38,15 +38,10 @@ dev,@eslint/eslintrc,MIT,Copyright OpenJS Foundation and other contributors, <ww
38
38
  dev,@eslint/js,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
39
39
  dev,@msgpack/msgpack,ISC,Copyright 2019 The MessagePack Community
40
40
  dev,@stylistic/eslint-plugin-js,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
41
- dev,autocannon,MIT,Copyright 2016 Matteo Collina
42
41
  dev,axios,MIT,Copyright 2014-present Matt Zabriskie
43
42
  dev,benchmark,MIT,Copyright 2010-2016 Mathias Bynens Robert Kieffer John-David Dalton
44
43
  dev,body-parser,MIT,Copyright 2014 Jonathan Ong 2014-2015 Douglas Christopher Wilson
45
44
  dev,chai,MIT,Copyright 2017 Chai.js Assertion Library
46
- dev,chalk,MIT,Copyright Sindre Sorhus
47
- dev,checksum,MIT,Copyright Daniel D. Shaw
48
- dev,cli-table3,MIT,Copyright 2014 James Talmage
49
- dev,dotenv,BSD-2-Clause,Copyright 2015 Scott Motte
50
45
  dev,eslint,MIT,Copyright JS Foundation and other contributors https://js.foundation
51
46
  dev,eslint-config-standard,MIT,Copyright Feross Aboukhadijeh
52
47
  dev,eslint-plugin-import,MIT,Copyright 2015 Ben Mosher
@@ -60,7 +55,6 @@ dev,glob,ISC,Copyright Isaac Z. Schlueter and Contributors
60
55
  dev,globals,MIT,Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
61
56
  dev,graphql,MIT,Copyright 2015 Facebook Inc.
62
57
  dev,jszip,MIT,Copyright 2015-2016 Stuart Knightley and contributors
63
- dev,mkdirp,MIT,Copyright 2010 James Halliday
64
58
  dev,mocha,MIT,Copyright 2011-2018 JS Foundation and contributors https://js.foundation
65
59
  dev,multer,MIT,Copyright 2014 Hage Yaapa
66
60
  dev,nock,MIT,Copyright 2017 Pedro Teixeira and other contributors
package/README.md CHANGED
@@ -22,6 +22,11 @@ Most of the documentation for `dd-trace` is available on these webpages:
22
22
 
23
23
  ## Version Release Lines and Maintenance
24
24
 
25
+ > **Node.js v24 Notice**: We're currently adding compatibility for Node.js v24. To use the tracer with your application either continue to use Node.js v22 (LTS), or do both of the following as a workaround:
26
+ > * Install v5.52.0 (or newer) of the tracer
27
+ > * Set `--no-async-context-frame` either using a CLI argument or via `NODE_OPTIONS`
28
+ > Once support for Node.js v24 is complete this flag will no longer be needed.
29
+
25
30
  | Release Line | Latest Version | Node.js | [SSI](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/single-step-apm/?tab=linuxhostorvm) | [K8s Injection](https://docs.datadoghq.com/tracing/trace_collection/library_injection_local/?tab=kubernetes) |Status |Initial Release | End of Life |
26
31
  | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
27
32
  | [`v1`](https://github.com/DataDog/dd-trace-js/tree/v1.x) | ![npm v1](https://img.shields.io/npm/v/dd-trace/legacy-v1?color=white&label=%20&style=flat-square) | `>= v12` | NO | NO | **EOL** | 2021-07-13 | 2022-02-25 |
package/index.d.ts CHANGED
@@ -138,6 +138,22 @@ interface Tracer extends opentracing.Tracer {
138
138
  * LLM Observability SDK
139
139
  */
140
140
  llmobs: tracer.llmobs.LLMObs;
141
+
142
+ /**
143
+ * @experimental
144
+ * Provide same functionality as OpenTelemetry Baggage:
145
+ * https://opentelemetry.io/docs/concepts/signals/baggage/
146
+ *
147
+ * Since the equivalent of OTel Context is implicit in dd-trace-js,
148
+ * these APIs act on the currently active baggage
149
+ *
150
+ * Work with storage('baggage'), therefore do not follow the same continuity as other APIs
151
+ */
152
+ setBaggageItem (key: string, value: string): Record<string, string>;
153
+ getBaggageItem (key: string): string | undefined;
154
+ getAllBaggageItems (): Record<string, string>;
155
+ removeBaggageItem (key: string): Record<string, string>;
156
+ removeAllBaggageItems (): Record<string, string>;
141
157
  }
142
158
 
143
159
  // left out of the namespace, so it
@@ -154,6 +170,7 @@ interface Plugins {
154
170
  "bunyan": tracer.plugins.bunyan;
155
171
  "cassandra-driver": tracer.plugins.cassandra_driver;
156
172
  "child_process": tracer.plugins.child_process;
173
+ "confluentinc-kafka-javascript": tracer.plugins.confluentinc_kafka_javascript;
157
174
  "connect": tracer.plugins.connect;
158
175
  "couchbase": tracer.plugins.couchbase;
159
176
  "cucumber": tracer.plugins.cucumber;
@@ -172,6 +189,7 @@ interface Plugins {
172
189
  "http": tracer.plugins.http;
173
190
  "http2": tracer.plugins.http2;
174
191
  "ioredis": tracer.plugins.ioredis;
192
+ "iovalkey": tracer.plugins.iovalkey;
175
193
  "jest": tracer.plugins.jest;
176
194
  "kafkajs": tracer.plugins.kafkajs
177
195
  "knex": tracer.plugins.knex;
@@ -717,7 +735,18 @@ declare namespace tracer {
717
735
  */
718
736
  maxDepth?: number,
719
737
  }
720
- };
738
+ }
739
+
740
+ /**
741
+ * Configuration for Code Origin for Spans.
742
+ */
743
+ codeOriginForSpans?: {
744
+ /**
745
+ * Whether to enable Code Origin for Spans.
746
+ * @default true
747
+ */
748
+ enabled?: boolean
749
+ }
721
750
 
722
751
  /**
723
752
  * Configuration of the IAST. Can be a boolean as an alias to `iast.enabled`.
@@ -827,7 +856,7 @@ declare namespace tracer {
827
856
  * @param value The amount to increment the stat by.
828
857
  * @param tags Tags to pass along, such as `{ foo: 'bar' }`. Values are combined with config.tags.
829
858
  */
830
- increment(stat: string, value?: number, tags?: Record<string, string|number>): void
859
+ increment(stat: string, value?: number, tags?: Record<string, string|number> | string[]): void
831
860
 
832
861
  /**
833
862
  * Decrements a metric by the specified value, optionally specifying tags.
@@ -835,7 +864,7 @@ declare namespace tracer {
835
864
  * @param value The amount to decrement the stat by.
836
865
  * @param tags Tags to pass along, such as `{ foo: 'bar' }`. Values are combined with config.tags.
837
866
  */
838
- decrement(stat: string, value?: number, tags?: Record<string, string|number>): void
867
+ decrement(stat: string, value?: number, tags?: Record<string, string|number> | string[]): void
839
868
 
840
869
  /**
841
870
  * Sets a distribution value, optionally specifying tags.
@@ -843,7 +872,7 @@ declare namespace tracer {
843
872
  * @param value The amount to increment the stat by.
844
873
  * @param tags Tags to pass along, such as `{ foo: 'bar' }`. Values are combined with config.tags.
845
874
  */
846
- distribution(stat: string, value?: number, tags?: Record<string, string|number>): void
875
+ distribution(stat: string, value?: number, tags?: Record<string, string|number> | string[]): void
847
876
 
848
877
  /**
849
878
  * Sets a gauge value, optionally specifying tags.
@@ -851,7 +880,7 @@ declare namespace tracer {
851
880
  * @param value The amount to increment the stat by.
852
881
  * @param tags Tags to pass along, such as `{ foo: 'bar' }`. Values are combined with config.tags.
853
882
  */
854
- gauge(stat: string, value?: number, tags?: Record<string, string|number>): void
883
+ gauge(stat: string, value?: number, tags?: Record<string, string|number> | string[]): void
855
884
 
856
885
  /**
857
886
  * Sets a histogram value, optionally specifying tags.
@@ -859,7 +888,7 @@ declare namespace tracer {
859
888
  * @param value The amount to increment the stat by.
860
889
  * @param tags Tags to pass along, such as `{ foo: 'bar' }`. Values are combined with config.tags.
861
890
  */
862
- histogram(stat: string, value?: number, tags?: Record<string, string|number>): void
891
+ histogram(stat: string, value?: number, tags?: Record<string, string|number> | string[]): void
863
892
 
864
893
  /**
865
894
  * Forces any unsent metrics to be sent
@@ -1334,6 +1363,12 @@ declare namespace tracer {
1334
1363
  */
1335
1364
  interface child_process extends Instrumentation {}
1336
1365
 
1366
+ /**
1367
+ * This plugin automatically instruments the
1368
+ * [confluentinc-kafka-javascript](https://github.com/confluentinc/confluent-kafka-js) module.
1369
+ */
1370
+ interface confluentinc_kafka_javascript extends Instrumentation {}
1371
+
1337
1372
  /**
1338
1373
  * This plugin automatically instruments the
1339
1374
  * [connect](https://github.com/senchalabs/connect) module.
@@ -1632,6 +1667,53 @@ declare namespace tracer {
1632
1667
  splitByInstance?: boolean;
1633
1668
  }
1634
1669
 
1670
+ /**
1671
+ * This plugin automatically instruments the
1672
+ * [iovalkey](https://github.com/valkey-io/iovalkey) module.
1673
+ */
1674
+ interface iovalkey extends Instrumentation {
1675
+ /**
1676
+ * List of commands that should be instrumented. Commands must be in
1677
+ * lowercase for example 'xread'.
1678
+ *
1679
+ * @default /^.*$/
1680
+ */
1681
+ allowlist?: string | RegExp | ((command: string) => boolean) | (string | RegExp | ((command: string) => boolean))[];
1682
+
1683
+ /**
1684
+ * Deprecated in favor of `allowlist`.
1685
+ *
1686
+ * @deprecated
1687
+ * @hidden
1688
+ */
1689
+ whitelist?: string | RegExp | ((command: string) => boolean) | (string | RegExp | ((command: string) => boolean))[];
1690
+
1691
+ /**
1692
+ * List of commands that should not be instrumented. Takes precedence over
1693
+ * allowlist if a command matches an entry in both. Commands must be in
1694
+ * lowercase for example 'xread'.
1695
+ *
1696
+ * @default []
1697
+ */
1698
+ blocklist?: string | RegExp | ((command: string) => boolean) | (string | RegExp | ((command: string) => boolean))[];
1699
+
1700
+ /**
1701
+ * Deprecated in favor of `blocklist`.
1702
+ *
1703
+ * @deprecated
1704
+ * @hidden
1705
+ */
1706
+ blacklist?: string | RegExp | ((command: string) => boolean) | (string | RegExp | ((command: string) => boolean))[];
1707
+
1708
+ /**
1709
+ * Whether to use a different service name for each Redis instance based
1710
+ * on the configured connection name of the client.
1711
+ *
1712
+ * @default false
1713
+ */
1714
+ splitByInstance?: boolean;
1715
+ }
1716
+
1635
1717
  /**
1636
1718
  * This plugin automatically instruments the
1637
1719
  * [jest](https://github.com/jestjs/jest) module.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dd-trace",
3
- "version": "5.51.0",
3
+ "version": "5.53.0",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -85,9 +85,9 @@
85
85
  "dependencies": {
86
86
  "@datadog/libdatadog": "^0.5.1",
87
87
  "@datadog/native-appsec": "8.5.2",
88
- "@datadog/native-iast-taint-tracking": "3.3.1",
88
+ "@datadog/native-iast-taint-tracking": "4.0.0",
89
89
  "@datadog/native-metrics": "^3.1.1",
90
- "@datadog/pprof": "5.7.1",
90
+ "@datadog/pprof": "5.8.0",
91
91
  "@datadog/sketches-js": "^2.1.0",
92
92
  "@datadog/wasm-js-rewriter": "4.0.1",
93
93
  "@isaacs/ttlcache": "^1.4.1",
@@ -124,15 +124,10 @@
124
124
  "@msgpack/msgpack": "^3.0.0-beta3",
125
125
  "@stylistic/eslint-plugin-js": "^3.0.1",
126
126
  "@types/node": "^16.0.0",
127
- "autocannon": "^4.5.2",
128
127
  "axios": "^1.8.2",
129
128
  "benchmark": "^2.1.4",
130
129
  "body-parser": "^1.20.3",
131
130
  "chai": "^4.3.7",
132
- "chalk": "^5.3.0",
133
- "checksum": "^1.0.0",
134
- "cli-table3": "^0.6.3",
135
- "dotenv": "16.3.1",
136
131
  "eslint": "^9.19.0",
137
132
  "eslint-config-standard": "^17.1.0",
138
133
  "eslint-plugin-import": "^2.31.0",
@@ -146,7 +141,6 @@
146
141
  "globals": "^15.10.0",
147
142
  "graphql": "0.13.2",
148
143
  "jszip": "^3.5.0",
149
- "mkdirp": "^3.0.1",
150
144
  "mocha": "^10",
151
145
  "multer": "^1.4.5-lts.1",
152
146
  "nock": "^11.3.3",
@@ -15,13 +15,16 @@ const startCh = channel('apm:amqplib:command:start')
15
15
  const finishCh = channel('apm:amqplib:command:finish')
16
16
  const errorCh = channel('apm:amqplib:command:error')
17
17
 
18
- let methods = {}
18
+ const methods = {}
19
19
 
20
20
  addHook({ name: 'amqplib', file: 'lib/defs.js', versions: [MIN_VERSION] }, defs => {
21
- methods = Object.keys(defs)
22
- .filter(key => Number.isInteger(defs[key]))
23
- .filter(key => isCamelCase(key))
24
- .reduce((acc, key) => Object.assign(acc, { [defs[key]]: kebabCase(key).replace('-', '.') }), {})
21
+ for (const [key, value] of Object.entries(defs)) {
22
+ if (Number.isInteger(value) && isCamelCase(key)) {
23
+ // TODO(BridgeAR): It should replace all `-` with `.`, so it has to be replaceAll or use a regex.
24
+ // Example method that is not renamed properly: BasicGetEmpty = 3932232
25
+ methods[value] = kebabCase(key).replace('-', '.')
26
+ }
27
+ }
25
28
  return defs
26
29
  })
27
30
 
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
+ const { errorMonitor } = require('events')
3
4
  const util = require('util')
4
5
 
5
6
  const {
@@ -227,7 +228,7 @@ function wrapChildProcessAsyncMethod (ChildProcess, shell = false) {
227
228
  if (childProcess) {
228
229
  let errorExecuted = false
229
230
 
230
- childProcess.on('error', (e) => {
231
+ childProcess.on(errorMonitor, (e) => {
231
232
  errorExecuted = true
232
233
  childProcessChannel.error.publish(e)
233
234
  })