dd-trace 5.123.0 → 6.11.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 (55) hide show
  1. package/LICENSE-3rdparty.csv +0 -5
  2. package/index.d.ts +25 -240
  3. package/package.json +18 -19
  4. package/packages/datadog-instrumentations/src/cucumber.js +4 -4
  5. package/packages/datadog-instrumentations/src/mocha/utils.js +2 -5
  6. package/packages/datadog-instrumentations/src/playwright-reporter.js +1 -149
  7. package/packages/datadog-instrumentations/src/playwright.js +33 -33
  8. package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +8 -6
  9. package/packages/datadog-plugin-playwright/src/index.js +0 -4
  10. package/packages/dd-trace/src/appsec/reporter.js +0 -2
  11. package/packages/dd-trace/src/appsec/telemetry/index.js +0 -13
  12. package/packages/dd-trace/src/appsec/telemetry/rasp.js +0 -16
  13. package/packages/dd-trace/src/appsec/telemetry/waf.js +0 -24
  14. package/packages/dd-trace/src/carrier.js +48 -107
  15. package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +5 -5
  16. package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +0 -2
  17. package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +3 -5
  18. package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +2 -4
  19. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +4 -6
  20. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +3 -5
  21. package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -4
  22. package/packages/dd-trace/src/ci-visibility/requests/upload-coverage-report.js +2 -4
  23. package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +2 -4
  24. package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +5 -5
  25. package/packages/dd-trace/src/debugger/constants.js +0 -1
  26. package/packages/dd-trace/src/debugger/devtools_client/condition.js +1 -1
  27. package/packages/dd-trace/src/debugger/devtools_client/index.js +10 -3
  28. package/packages/dd-trace/src/debugger/index.js +2 -4
  29. package/packages/dd-trace/src/exporters/common/request.js +2 -5
  30. package/packages/dd-trace/src/llmobs/experiments/client.js +2 -6
  31. package/packages/dd-trace/src/llmobs/experiments/dataset.js +11 -249
  32. package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -23
  33. package/packages/dd-trace/src/llmobs/experiments/index.js +6 -18
  34. package/packages/dd-trace/src/llmobs/experiments/noop.js +4 -64
  35. package/packages/dd-trace/src/llmobs/experiments/util.js +4 -60
  36. package/packages/dd-trace/src/openfeature/constants/constants.js +18 -0
  37. package/packages/dd-trace/src/openfeature/index.js +4 -7
  38. package/packages/dd-trace/src/openfeature/writers/base.js +11 -153
  39. package/packages/dd-trace/src/openfeature/writers/exposures.js +14 -62
  40. package/packages/dd-trace/src/openfeature/writers/util.js +15 -97
  41. package/packages/dd-trace/src/opentracing/propagation/text_map.js +13 -22
  42. package/packages/dd-trace/src/telemetry/metrics.js +8 -62
  43. package/packages/dd-trace/src/telemetry/send-data.js +0 -1
  44. package/vendor/dist/@datadog/sketches-js/index.js +1 -1
  45. package/vendor/dist/protobufjs/index.js +1 -1
  46. package/vendor/dist/protobufjs/minimal/index.js +1 -1
  47. package/packages/dd-trace/src/debugger/inspect-segment.js +0 -154
  48. package/packages/dd-trace/src/evp_proxy/constants.js +0 -8
  49. package/packages/dd-trace/src/evp_proxy/direct.js +0 -64
  50. package/packages/dd-trace/src/evp_proxy/discovery.js +0 -133
  51. package/packages/dd-trace/src/evp_proxy/path.js +0 -22
  52. package/vendor/dist/https-proxy-agent/LICENSE +0 -22
  53. package/vendor/dist/https-proxy-agent/index.js +0 -4
  54. package/vendor/dist/proxy-from-env/LICENSE +0 -20
  55. package/vendor/dist/proxy-from-env/index.js +0 -1
@@ -9,23 +9,6 @@ const FIELD_HAS = 4
9
9
  const FIELD_DELETE = 8
10
10
  const FIELD_NAME_LENGTH = 16
11
11
 
12
- const b3FlagsHeader = 'x-b3-flags'
13
- const b3Header = 'b3'
14
- const b3SampledHeader = 'x-b3-sampled'
15
- const b3SpanIdHeader = 'x-b3-spanid'
16
- const b3TraceIdHeader = 'x-b3-traceid'
17
- const baggageHeader = 'baggage'
18
- const datadogOriginHeader = 'x-datadog-origin'
19
- const datadogParentIdHeader = 'x-datadog-parent-id'
20
- const datadogSamplingPriorityHeader = 'x-datadog-sampling-priority'
21
- const datadogTagsHeader = 'x-datadog-tags'
22
- const datadogTraceIdHeader = 'x-datadog-trace-id'
23
- const dsmBase64Header = 'dd-pathway-ctx-base64'
24
- const dsmBinaryHeader = 'dd-pathway-ctx'
25
- const sqsdHeader = 'x-aws-sqsd-attr-_datadog'
26
- const traceparentHeader = 'traceparent'
27
- const tracestateHeader = 'tracestate'
28
-
29
12
  /** @type {Record<string, unknown>} */
30
13
  const carrierOperations = {}
31
14
 
@@ -41,7 +24,7 @@ const carrierOperations = {}
41
24
  /**
42
25
  * @template Value
43
26
  * @typedef {object} CarrierField
44
- * @property {((carrier: Carrier) => Value | undefined) | undefined} read
27
+ * @property {(carrier: Carrier) => Value | undefined} read
45
28
  * @property {(carrier: Carrier, value: Value) => void} write
46
29
  * @property {(carrier: Carrier) => boolean} has
47
30
  * @property {(carrier: Carrier) => void} delete
@@ -70,13 +53,19 @@ function defineCapability (name, operations, capability) {
70
53
  * @template Value
71
54
  * @param {string} fieldName
72
55
  * @param {string} headerName
73
- * @param {((carrier: Carrier) => Value | undefined) | undefined} read
56
+ * @param {(value: unknown) => Value | undefined} resolve
74
57
  * @param {number} operations
75
58
  * @returns {CarrierField<Value>}
76
59
  */
77
- function defineField (fieldName, headerName, read, operations) {
60
+ function defineField (fieldName, headerName, resolve, operations) {
78
61
  return defineCapability(fieldName, operations, {
79
- read,
62
+ /**
63
+ * @param {Carrier} carrier
64
+ * @returns {Value | undefined}
65
+ */
66
+ read (carrier) {
67
+ return resolve(carrier[headerName])
68
+ },
80
69
 
81
70
  /**
82
71
  * @param {Carrier} carrier
@@ -194,96 +183,48 @@ function readLastPathway (value) {
194
183
  return result
195
184
  }
196
185
 
197
- /** @param {Carrier} carrier */
198
- function readB3Flags (carrier) { return readLastText(carrier[b3FlagsHeader]) }
199
-
200
- /** @param {Carrier} carrier */
201
- function readB3 (carrier) { return readLastText(carrier[b3Header]) }
202
-
203
- /** @param {Carrier} carrier */
204
- function readB3Sampled (carrier) { return readLastText(carrier[b3SampledHeader]) }
205
-
206
- /** @param {Carrier} carrier */
207
- function readB3SpanId (carrier) { return readLastText(carrier[b3SpanIdHeader]) }
208
-
209
- /** @param {Carrier} carrier */
210
- function readB3TraceId (carrier) { return readLastText(carrier[b3TraceIdHeader]) }
211
-
212
- /** @param {Carrier} carrier */
213
- function readBaggage (carrier) { return readListText(carrier[baggageHeader]) }
214
-
215
- /** @param {Carrier} carrier */
216
- function readDatadogOrigin (carrier) { return readLastText(carrier[datadogOriginHeader]) }
217
-
218
- /** @param {Carrier} carrier */
219
- function readDatadogParentId (carrier) { return readLastText(carrier[datadogParentIdHeader]) }
220
-
221
- /** @param {Carrier} carrier */
222
- function readDatadogSamplingPriority (carrier) { return readLastText(carrier[datadogSamplingPriorityHeader]) }
223
-
224
- /** @param {Carrier} carrier */
225
- function readDatadogTags (carrier) { return readListText(carrier[datadogTagsHeader]) }
226
-
227
- /** @param {Carrier} carrier */
228
- function readDatadogTraceId (carrier) { return readLastText(carrier[datadogTraceIdHeader]) }
229
-
230
- /** @param {Carrier} carrier */
231
- function readDsmBase64 (carrier) { return readLastPathway(carrier[dsmBase64Header]) }
232
-
233
- /** @param {Carrier} carrier */
234
- function readDsmBinary (carrier) { return readLastPathway(carrier[dsmBinaryHeader]) }
235
-
236
- /** @param {Carrier} carrier */
237
- function readSqsd (carrier) { return readLastText(carrier[sqsdHeader]) }
238
-
239
- /** @param {Carrier} carrier */
240
- function readTraceparent (carrier) { return readUniqueText(carrier[traceparentHeader]) }
241
-
242
- /** @param {Carrier} carrier */
243
- function readTracestate (carrier) { return readListText(carrier[tracestateHeader]) }
244
-
245
186
  const datadogTraceId = defineField(
246
187
  'datadogTraceId',
247
- datadogTraceIdHeader,
248
- readDatadogTraceId,
188
+ 'x-datadog-trace-id',
189
+ readLastText,
249
190
  FIELD_READ | FIELD_WRITE
250
191
  )
251
192
  const datadogParentId = defineField(
252
193
  'datadogParentId',
253
- datadogParentIdHeader,
254
- readDatadogParentId,
194
+ 'x-datadog-parent-id',
195
+ readLastText,
255
196
  FIELD_READ | FIELD_WRITE | FIELD_DELETE
256
197
  )
257
198
  const datadogOrigin = defineField(
258
199
  'datadogOrigin',
259
- datadogOriginHeader,
260
- readDatadogOrigin,
200
+ 'x-datadog-origin',
201
+ readLastText,
261
202
  FIELD_READ | FIELD_WRITE
262
203
  )
263
204
  const datadogSamplingPriority = defineField(
264
205
  'datadogSamplingPriority',
265
- datadogSamplingPriorityHeader,
266
- readDatadogSamplingPriority,
206
+ 'x-datadog-sampling-priority',
207
+ readLastText,
267
208
  FIELD_READ | FIELD_WRITE
268
209
  )
269
- defineField('datadogTags', datadogTagsHeader, readDatadogTags, FIELD_READ | FIELD_WRITE)
270
- defineField('baggage', baggageHeader, readBaggage, FIELD_READ | FIELD_WRITE)
271
- const b3TraceId = defineField('b3TraceId', b3TraceIdHeader, readB3TraceId, FIELD_READ | FIELD_WRITE)
272
- const b3SpanId = defineField('b3SpanId', b3SpanIdHeader, readB3SpanId, FIELD_READ | FIELD_WRITE)
273
- const b3ParentId = defineField('b3ParentId', 'x-b3-parentspanid', undefined, FIELD_WRITE)
274
- const b3Sampled = defineField('b3Sampled', b3SampledHeader, readB3Sampled, FIELD_READ | FIELD_WRITE)
275
- const b3Flags = defineField('b3Flags', b3FlagsHeader, readB3Flags, FIELD_READ | FIELD_WRITE)
276
- const b3 = defineField('b3', b3Header, readB3, FIELD_READ | FIELD_WRITE)
277
- defineField('sqsd', sqsdHeader, readSqsd, FIELD_READ)
278
- const traceparent = defineField('traceparent', traceparentHeader, readTraceparent, FIELD_READ | FIELD_WRITE)
279
- const tracestate = defineField('tracestate', tracestateHeader, readTracestate, FIELD_READ | FIELD_WRITE)
210
+ defineField('datadogTags', 'x-datadog-tags', readListText, FIELD_READ | FIELD_WRITE)
211
+ defineField('baggage', 'baggage', readListText, FIELD_READ | FIELD_WRITE)
212
+ const b3TraceId = defineField('b3TraceId', 'x-b3-traceid', readLastText, FIELD_READ | FIELD_WRITE)
213
+ const b3SpanId = defineField('b3SpanId', 'x-b3-spanid', readLastText, FIELD_READ | FIELD_WRITE)
214
+ const b3ParentId = defineField('b3ParentId', 'x-b3-parentspanid', readLastText, FIELD_WRITE)
215
+ const b3Sampled = defineField('b3Sampled', 'x-b3-sampled', readLastText, FIELD_READ | FIELD_WRITE)
216
+ const b3Flags = defineField('b3Flags', 'x-b3-flags', readLastText, FIELD_READ | FIELD_WRITE)
217
+ const b3 = defineField('b3', 'b3', readLastText, FIELD_READ | FIELD_WRITE)
218
+ defineField('sqsd', 'x-aws-sqsd-attr-_datadog', readLastText, FIELD_READ)
219
+ const traceparent = defineField('traceparent', 'traceparent', readUniqueText, FIELD_READ | FIELD_WRITE)
220
+ const tracestate = defineField('tracestate', 'tracestate', readListText, FIELD_READ | FIELD_WRITE)
280
221
  const dsmBase64 = defineField(
281
222
  'dsmBase64',
282
- dsmBase64Header,
283
- readDsmBase64,
223
+ 'dd-pathway-ctx-base64',
224
+ readLastPathway,
284
225
  FIELD_READ | FIELD_WRITE | FIELD_HAS | FIELD_NAME_LENGTH
285
226
  )
286
- const dsmBinary = defineField('dsmBinary', dsmBinaryHeader, readDsmBinary, FIELD_READ | FIELD_HAS)
227
+ const dsmBinary = defineField('dsmBinary', 'dd-pathway-ctx', readLastPathway, FIELD_READ | FIELD_HAS)
287
228
 
288
229
  const legacyBaggagePrefix = 'ot-baggage-'
289
230
  // RFC 7230 `token`, compatible with Node.js header-name validation.
@@ -373,23 +314,23 @@ function pickDsm (carrier) {
373
314
  * @property {typeof dsmBinary.has} hasDsmBinary
374
315
  * @property {typeof pickDsm} pickDsm
375
316
  * @property {typeof pickTextMap} pickTextMap
376
- * @property {typeof readBaggage} readBaggage
377
- * @property {typeof readB3} readB3
378
- * @property {typeof readB3Flags} readB3Flags
379
- * @property {typeof readB3Sampled} readB3Sampled
380
- * @property {typeof readB3SpanId} readB3SpanId
381
- * @property {typeof readB3TraceId} readB3TraceId
382
- * @property {typeof readDatadogOrigin} readDatadogOrigin
383
- * @property {typeof readDatadogParentId} readDatadogParentId
384
- * @property {typeof readDatadogSamplingPriority} readDatadogSamplingPriority
385
- * @property {typeof readDatadogTags} readDatadogTags
386
- * @property {typeof readDatadogTraceId} readDatadogTraceId
387
- * @property {typeof readDsmBase64} readDsmBase64
388
- * @property {typeof readDsmBinary} readDsmBinary
317
+ * @property {(carrier: Carrier) => string | undefined} readBaggage
318
+ * @property {typeof b3.read} readB3
319
+ * @property {typeof b3Flags.read} readB3Flags
320
+ * @property {typeof b3Sampled.read} readB3Sampled
321
+ * @property {typeof b3SpanId.read} readB3SpanId
322
+ * @property {typeof b3TraceId.read} readB3TraceId
323
+ * @property {typeof datadogOrigin.read} readDatadogOrigin
324
+ * @property {typeof datadogParentId.read} readDatadogParentId
325
+ * @property {typeof datadogSamplingPriority.read} readDatadogSamplingPriority
326
+ * @property {(carrier: Carrier) => string | undefined} readDatadogTags
327
+ * @property {typeof datadogTraceId.read} readDatadogTraceId
328
+ * @property {typeof dsmBase64.read} readDsmBase64
329
+ * @property {typeof dsmBinary.read} readDsmBinary
389
330
  * @property {(carrier: Carrier, target: Record<string, string>) => void} readLegacyBaggage
390
- * @property {typeof readSqsd} readSqsd
391
- * @property {typeof readTraceparent} readTraceparent
392
- * @property {typeof readTracestate} readTracestate
331
+ * @property {(carrier: Carrier) => string | undefined} readSqsd
332
+ * @property {typeof traceparent.read} readTraceparent
333
+ * @property {typeof tracestate.read} readTracestate
393
334
  * @property {(carrier: Carrier, value: string) => void} writeBaggage
394
335
  * @property {typeof b3.write} writeB3
395
336
  * @property {typeof b3Flags.write} writeB3Flags
@@ -1,10 +1,10 @@
1
1
  'use strict'
2
2
 
3
3
  const getConfig = require('../../config')
4
- const { EVP_SUBDOMAIN_HEADER_NAME } = require('../../evp_proxy/constants')
5
- const { joinEVPProxyPath } = require('../../evp_proxy/path')
4
+ const request = require('../requests/request')
6
5
  const id = require('../../id')
7
6
  const log = require('../../log')
7
+
8
8
  const {
9
9
  incrementCountMetric,
10
10
  distributionMetric,
@@ -14,8 +14,8 @@ const {
14
14
  TELEMETRY_KNOWN_TESTS_RESPONSE_TESTS,
15
15
  TELEMETRY_KNOWN_TESTS_RESPONSE_BYTES,
16
16
  } = require('../../ci-visibility/telemetry')
17
+
17
18
  const { getNumFromKnownTests } = require('../../plugins/util/test')
18
- const request = require('../requests/request')
19
19
  const { buildCacheKey, writeToCache, withCache } = require('../requests/fs-cache')
20
20
  const { validateKnownTestsResponse } = require('../test-optimization-http-cache-schema')
21
21
 
@@ -162,8 +162,8 @@ function fetchFromApi ({
162
162
  }
163
163
 
164
164
  if (isEvpProxy) {
165
- options.path = joinEVPProxyPath(evpProxyPrefix, '/api/v2/ci/libraries/tests')
166
- options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'api'
165
+ options.path = `${evpProxyPrefix}/api/v2/ci/libraries/tests`
166
+ options.headers['X-Datadog-EVP-Subdomain'] = 'api'
167
167
  } else {
168
168
  const { DD_API_KEY } = getConfig()
169
169
  if (!DD_API_KEY) {
@@ -8,8 +8,6 @@ const request = require('../request')
8
8
  const { fetchAgentInfo } = require('../../../agent/info')
9
9
  const { DEBUGGER_INPUT_V1 } = require('../../../debugger/constants')
10
10
 
11
- // Product-specific discovery: newest advertised version, skip v3 (citestcycle), gzip if >= v4.
12
- // Shared `evp_proxy` discovery is an explicit path allowlist and does not cover this contract.
13
11
  const AGENT_EVP_PROXY_PATH_PREFIX = '/evp_proxy/v'
14
12
  const AGENT_EVP_PROXY_PATH_REGEX = /\/evp_proxy\/v(\d+)\/?/
15
13
 
@@ -1,9 +1,7 @@
1
1
  'use strict'
2
2
  const getConfig = require('../../../config')
3
- const { EVP_SUBDOMAIN_HEADER_NAME } = require('../../../evp_proxy/constants')
4
- const { joinEVPProxyPath } = require('../../../evp_proxy/path')
5
- const { safeJSONStringify } = require('../../../exporters/common/util')
6
3
  const log = require('../../../log')
4
+ const { safeJSONStringify } = require('../../../exporters/common/util')
7
5
 
8
6
  const {
9
7
  incrementCountMetric,
@@ -55,9 +53,9 @@ class Writer extends BaseWriter {
55
53
  }
56
54
 
57
55
  if (this._evpProxyPrefix) {
58
- options.path = joinEVPProxyPath(this._evpProxyPrefix, '/api/v2/citestcov')
56
+ options.path = `${this._evpProxyPrefix}/api/v2/citestcov`
59
57
  delete options.headers['dd-api-key']
60
- options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'citestcov-intake'
58
+ options.headers['X-Datadog-EVP-Subdomain'] = 'citestcov-intake'
61
59
  }
62
60
 
63
61
  // eslint-disable-next-line eslint-rules/eslint-log-printf-style
@@ -1,7 +1,5 @@
1
1
  'use strict'
2
2
  const getConfig = require('../../../config')
3
- const { EVP_SUBDOMAIN_HEADER_NAME } = require('../../../evp_proxy/constants')
4
- const { joinEVPProxyPath } = require('../../../evp_proxy/path')
5
3
  const { safeJSONStringify } = require('../../../exporters/common/util')
6
4
  const log = require('../../../log')
7
5
 
@@ -56,9 +54,9 @@ class Writer extends BaseWriter {
56
54
  }
57
55
 
58
56
  if (this._evpProxyPrefix) {
59
- options.path = joinEVPProxyPath(this._evpProxyPrefix, '/api/v2/citestcycle')
57
+ options.path = `${this._evpProxyPrefix}/api/v2/citestcycle`
60
58
  delete options.headers['dd-api-key']
61
- options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'citestcycle-intake'
59
+ options.headers['X-Datadog-EVP-Subdomain'] = 'citestcycle-intake'
62
60
  }
63
61
 
64
62
  // eslint-disable-next-line eslint-rules/eslint-log-printf-style
@@ -4,8 +4,6 @@ const fs = require('fs')
4
4
  const path = require('path')
5
5
 
6
6
  const getConfig = require('../../../config')
7
- const { EVP_SUBDOMAIN_HEADER_NAME } = require('../../../evp_proxy/constants')
8
- const { joinEVPProxyPath } = require('../../../evp_proxy/path')
9
7
  const FormData = require('../../../exporters/common/form-data')
10
8
  const request = require('../../../exporters/common/request')
11
9
 
@@ -85,8 +83,8 @@ function getCommitsToUpload ({ url, repositoryUrl, latestCommits, isEvpProxy, ev
85
83
  }
86
84
 
87
85
  if (isEvpProxy) {
88
- options.path = joinEVPProxyPath(evpProxyPrefix, '/api/v2/git/repository/search_commits')
89
- options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'api'
86
+ options.path = `${evpProxyPrefix}/api/v2/git/repository/search_commits`
87
+ options.headers['X-Datadog-EVP-Subdomain'] = 'api'
90
88
  delete options.headers['dd-api-key']
91
89
  }
92
90
 
@@ -181,8 +179,8 @@ function uploadPackFile ({ url, isEvpProxy, evpProxyPrefix, packFileToUpload, re
181
179
  }
182
180
 
183
181
  if (isEvpProxy) {
184
- options.path = joinEVPProxyPath(evpProxyPrefix, '/api/v2/git/repository/packfile')
185
- options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'api'
182
+ options.path = `${evpProxyPrefix}/api/v2/git/repository/packfile`
183
+ options.headers['X-Datadog-EVP-Subdomain'] = 'api'
186
184
  delete options.headers['dd-api-key']
187
185
  }
188
186
 
@@ -1,8 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const getConfig = require('../../config')
4
- const { EVP_SUBDOMAIN_HEADER_NAME } = require('../../evp_proxy/constants')
5
- const { joinEVPProxyPath } = require('../../evp_proxy/path')
4
+ const request = require('../requests/request')
6
5
  const log = require('../../log')
7
6
  const {
8
7
  incrementCountMetric,
@@ -14,7 +13,6 @@ const {
14
13
  TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS,
15
14
  TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_BYTES,
16
15
  } = require('../../ci-visibility/telemetry')
17
- const request = require('../requests/request')
18
16
  const { buildCacheKey, writeToCache, withCache } = require('../requests/fs-cache')
19
17
  const { validateSkippableTestsResponse } = require('../test-optimization-http-cache-schema')
20
18
 
@@ -229,8 +227,8 @@ function fetchFromApi ({
229
227
  }
230
228
 
231
229
  if (isEvpProxy) {
232
- options.path = joinEVPProxyPath(evpProxyPrefix, '/api/v2/ci/tests/skippable')
233
- options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'api'
230
+ options.path = `${evpProxyPrefix}/api/v2/ci/tests/skippable`
231
+ options.headers['X-Datadog-EVP-Subdomain'] = 'api'
234
232
  } else {
235
233
  const { DD_API_KEY } = getConfig()
236
234
  if (!DD_API_KEY) {
@@ -1,8 +1,6 @@
1
1
  'use strict'
2
2
 
3
3
  const getConfig = require('../../config')
4
- const { EVP_SUBDOMAIN_HEADER_NAME } = require('../../evp_proxy/constants')
5
- const { joinEVPProxyPath } = require('../../evp_proxy/path')
6
4
  const id = require('../../id')
7
5
  const log = require('../../log')
8
6
  const { EARLY_FLAKE_DETECTION_RETRY_BUCKETS, createEfdRetryPolicy } = require('../efd-retry-policy')
@@ -240,8 +238,8 @@ function getLibraryConfiguration ({
240
238
  }
241
239
 
242
240
  if (isEvpProxy) {
243
- options.path = joinEVPProxyPath(evpProxyPrefix, '/api/v2/libraries/tests/services/setting')
244
- options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'api'
241
+ options.path = `${evpProxyPrefix}/api/v2/libraries/tests/services/setting`
242
+ options.headers['X-Datadog-EVP-Subdomain'] = 'api'
245
243
  } else {
246
244
  if (!config.DD_API_KEY) {
247
245
  return done(new Error('Request to settings endpoint was not done because Datadog API key is not defined.'))
@@ -4,8 +4,6 @@ const { closeSync, constants, fstatSync, openSync, readFileSync } = require('nod
4
4
  const { gzipSync } = require('node:zlib')
5
5
 
6
6
  const getConfig = require('../../config')
7
- const { EVP_SUBDOMAIN_HEADER_NAME } = require('../../evp_proxy/constants')
8
- const { joinEVPProxyPath } = require('../../evp_proxy/path')
9
7
  const FormData = require('../../exporters/common/form-data')
10
8
  const request = require('../../exporters/common/request')
11
9
  const log = require('../../log')
@@ -100,8 +98,8 @@ function uploadCoverageReport (
100
98
  }
101
99
 
102
100
  if (isEvpProxy) {
103
- options.path = joinEVPProxyPath(evpProxyPrefix, '/api/v2/cicovreprt')
104
- options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'ci-intake'
101
+ options.path = `${evpProxyPrefix}/api/v2/cicovreprt`
102
+ options.headers['X-Datadog-EVP-Subdomain'] = 'ci-intake'
105
103
  } else {
106
104
  options.path = '/api/v2/cicovreprt'
107
105
  options.headers['dd-api-key'] = DD_API_KEY
@@ -4,8 +4,6 @@ const { readFileSync } = require('node:fs')
4
4
  const { extname } = require('node:path')
5
5
 
6
6
  const getConfig = require('../../config')
7
- const { EVP_SUBDOMAIN_HEADER_NAME } = require('../../evp_proxy/constants')
8
- const { joinEVPProxyPath } = require('../../evp_proxy/path')
9
7
  const log = require('../../log')
10
8
  const request = require('../exporters/request')
11
9
 
@@ -136,8 +134,8 @@ function uploadTestScreenshot (
136
134
  if (isEvpProxy) {
137
135
  // Agent mode: prefix the evp_proxy path, tell the proxy which subdomain to forward to, and
138
136
  // drop the API key — the Agent injects it. The query params survive the proxy.
139
- options.path = `${joinEVPProxyPath(evpProxyPrefix, basePath)}?${query}`
140
- options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'api'
137
+ options.path = `${evpProxyPrefix}${basePath}?${query}`
138
+ options.headers['X-Datadog-EVP-Subdomain'] = 'api'
141
139
  } else {
142
140
  options.headers['DD-API-KEY'] = DD_API_KEY
143
141
  }
@@ -1,10 +1,10 @@
1
1
  'use strict'
2
2
 
3
3
  const getConfig = require('../../config')
4
- const { EVP_SUBDOMAIN_HEADER_NAME } = require('../../evp_proxy/constants')
5
- const { joinEVPProxyPath } = require('../../evp_proxy/path')
4
+ const request = require('../requests/request')
6
5
  const id = require('../../id')
7
6
  const log = require('../../log')
7
+
8
8
  const {
9
9
  incrementCountMetric,
10
10
  distributionMetric,
@@ -14,7 +14,7 @@ const {
14
14
  TELEMETRY_TEST_MANAGEMENT_TESTS_RESPONSE_TESTS,
15
15
  TELEMETRY_TEST_MANAGEMENT_TESTS_RESPONSE_BYTES,
16
16
  } = require('../telemetry')
17
- const request = require('../requests/request')
17
+
18
18
  const { buildCacheKey, writeToCache, withCache } = require('../requests/fs-cache')
19
19
  const { validateTestManagementTestsResponse } = require('../test-optimization-http-cache-schema')
20
20
 
@@ -132,8 +132,8 @@ function fetchFromApi ({
132
132
  }
133
133
 
134
134
  if (isEvpProxy) {
135
- options.path = joinEVPProxyPath(evpProxyPrefix, '/api/v2/test/libraries/test-management/tests')
136
- options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'api'
135
+ options.path = `${evpProxyPrefix}/api/v2/test/libraries/test-management/tests`
136
+ options.headers['X-Datadog-EVP-Subdomain'] = 'api'
137
137
  } else {
138
138
  const { DD_API_KEY } = getConfig()
139
139
  if (!DD_API_KEY) {
@@ -4,5 +4,4 @@ module.exports = {
4
4
  DEBUGGER_DIAGNOSTICS_V1: '/debugger/v1/diagnostics',
5
5
  DEBUGGER_INPUT_V1: '/debugger/v1/input',
6
6
  DEBUGGER_INPUT_V2: '/debugger/v2/input',
7
- INSPECT_SEGMENT_GLOBAL_PROPERTY: 'debuggerInspectSegment',
8
7
  }
@@ -55,7 +55,7 @@ function compileSegments (segments) {
55
55
  ? `(() => {
56
56
  try {
57
57
  const result = ${compile(json)}
58
- return typeof result === 'string' ? result : $dd_inspectSegment(result)
58
+ return typeof result === 'string' ? result : $dd_inspect(result, $dd_segmentInspectOptions)
59
59
  } catch (e) {
60
60
  return { expr: ${JSON.stringify(dsl)}, message: \`\${e.name}: \${e.message}\` }
61
61
  }
@@ -4,7 +4,6 @@ const { randomUUID } = require('crypto')
4
4
  const { workerData: { probeSamplerBuffer } } = require('worker_threads')
5
5
  const { version } = require('../../../../../package.json')
6
6
  const processTags = require('../../process-tags')
7
- const { INSPECT_SEGMENT_GLOBAL_PROPERTY } = require('../constants')
8
7
  const {
9
8
  MAX_SAMPLED_PROBES_PER_PAUSE,
10
9
  SAMPLED_PROBE_COUNT_INDEX,
@@ -24,8 +23,16 @@ require('./remote_config')
24
23
 
25
24
  /** @typedef {import('node:inspector').Debugger.EvaluateOnCallFrameReturnType} EvaluateOnCallFrameResult */
26
25
 
27
- const templateExpressionSetupCode = 'const $dd_inspectSegment = ' +
28
- `globalThis[Symbol.for('dd-trace')][${JSON.stringify(INSPECT_SEGMENT_GLOBAL_PROPERTY)}];`
26
+ const templateExpressionSetupCode = `
27
+ const $dd_inspect = global.require('node:util').inspect;
28
+ const $dd_segmentInspectOptions = {
29
+ depth: 0,
30
+ customInspect: false,
31
+ maxArrayLength: 3,
32
+ maxStringLength: 8 * 1024,
33
+ breakLength: Infinity
34
+ };
35
+ `
29
36
 
30
37
  // Expression to run on a call frame of the paused thread to get its active trace and span id.
31
38
  const getDDTagsExpression = `(() => {
@@ -7,7 +7,7 @@ const { Worker, MessageChannel, threadId: parentThreadId } = require('worker_thr
7
7
  const log = require('../log')
8
8
  const { fetchAgentInfo } = require('../agent/info')
9
9
  const getDebuggerConfig = require('./config')
10
- const { DEBUGGER_DIAGNOSTICS_V1, DEBUGGER_INPUT_V2, INSPECT_SEGMENT_GLOBAL_PROPERTY } = require('./constants')
10
+ const { DEBUGGER_DIAGNOSTICS_V1, DEBUGGER_INPUT_V2 } = require('./constants')
11
11
  const { installProbeSampler, uninstallProbeSampler } = require('./probe_sampler')
12
12
 
13
13
  /**
@@ -64,9 +64,7 @@ function start (config, rcInstance) {
64
64
  const logChannel = new MessageChannel()
65
65
  configChannel = new MessageChannel()
66
66
 
67
- const debuggerGlobals = globalThis[Symbol.for('dd-trace')]
68
- debuggerGlobals.utilTypes = types
69
- debuggerGlobals[INSPECT_SEGMENT_GLOBAL_PROPERTY] = require('./inspect-segment')
67
+ globalThis[Symbol.for('dd-trace')].utilTypes = types
70
68
 
71
69
  const probeSamplerBuffer = installProbeSampler()
72
70
 
@@ -93,10 +93,7 @@ function request (data, options, callback) {
93
93
 
94
94
  docker.inject(options.headers)
95
95
 
96
- const connectionOptions = {
97
- ...options,
98
- agent: options.agent ?? (isSecure ? httpsAgent : httpAgent),
99
- }
96
+ options.agent = isSecure ? httpsAgent : httpAgent
100
97
 
101
98
  /**
102
99
  * @param {import('node:http').IncomingMessage} res
@@ -221,7 +218,7 @@ function request (data, options, callback) {
221
218
  }
222
219
  }
223
220
 
224
- const req = client.request(connectionOptions, (res) => onResponse(res, complete, handleError))
221
+ const req = client.request(options, (res) => onResponse(res, complete, handleError))
225
222
 
226
223
  req.once('close', finalize)
227
224
  req.once('timeout', finalize)
@@ -33,8 +33,7 @@ function datasetRecordFromResource (resource) {
33
33
  attrs.input ?? null,
34
34
  attrs.expected_output ?? null,
35
35
  attrs.metadata ?? {},
36
- id,
37
- attrs.tags ?? []
36
+ id
38
37
  )
39
38
  }
40
39
 
@@ -196,7 +195,7 @@ class ExperimentsClient {
196
195
  const resources = Array.isArray(response?.records)
197
196
  ? response.records
198
197
  : (Array.isArray(response?.data) ? response.data : [])
199
- return datasetMutationResultFromResources(resources)
198
+ return resources.map(datasetRecordFromResource)
200
199
  }
201
200
 
202
201
  async batchUpdateDatasetRecords (projectId, datasetId, attributes) {
@@ -227,9 +226,6 @@ class ExperimentsClient {
227
226
  const query = new URLSearchParams()
228
227
  if (options.cursor) query.set('page[cursor]', options.cursor)
229
228
  if (options.version !== undefined && options.version !== null) query.set('filter[version]', String(options.version))
230
- if (Array.isArray(options.tags)) {
231
- for (const tag of options.tags) query.append('filter[tags]', tag)
232
- }
233
229
  const response = await this.request(
234
230
  'GET',
235
231
  `${API_BASE_PATH}/${projectId}/datasets/${datasetId}/records?${query.toString()}`