dd-trace 5.102.0 → 5.104.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 (201) hide show
  1. package/ext/exporters.js +1 -0
  2. package/index.d.ts +25 -3
  3. package/package.json +15 -13
  4. package/packages/datadog-esbuild/src/utils.js +2 -2
  5. package/packages/datadog-instrumentations/src/ai.js +1 -1
  6. package/packages/datadog-instrumentations/src/aws-sdk.js +2 -2
  7. package/packages/datadog-instrumentations/src/cassandra-driver.js +5 -2
  8. package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +32 -15
  9. package/packages/datadog-instrumentations/src/couchbase.js +69 -220
  10. package/packages/datadog-instrumentations/src/cucumber.js +104 -31
  11. package/packages/datadog-instrumentations/src/elasticsearch.js +4 -4
  12. package/packages/datadog-instrumentations/src/electron/preload.js +42 -0
  13. package/packages/datadog-instrumentations/src/electron.js +240 -0
  14. package/packages/datadog-instrumentations/src/fetch.js +5 -5
  15. package/packages/datadog-instrumentations/src/graphql.js +13 -17
  16. package/packages/datadog-instrumentations/src/grpc/client.js +48 -32
  17. package/packages/datadog-instrumentations/src/helpers/callback-instrumentor.js +2 -2
  18. package/packages/datadog-instrumentations/src/helpers/hook.js +4 -1
  19. package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
  20. package/packages/datadog-instrumentations/src/helpers/instrument.js +2 -2
  21. package/packages/datadog-instrumentations/src/helpers/kafka.js +58 -0
  22. package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +3 -2
  23. package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +19 -5
  24. package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +14 -13
  25. package/packages/datadog-instrumentations/src/http/client.js +2 -2
  26. package/packages/datadog-instrumentations/src/ioredis.js +18 -14
  27. package/packages/datadog-instrumentations/src/jest.js +382 -84
  28. package/packages/datadog-instrumentations/src/kafkajs.js +184 -174
  29. package/packages/datadog-instrumentations/src/mariadb.js +1 -1
  30. package/packages/datadog-instrumentations/src/memcached.js +2 -1
  31. package/packages/datadog-instrumentations/src/mocha/main.js +309 -56
  32. package/packages/datadog-instrumentations/src/mocha/utils.js +48 -8
  33. package/packages/datadog-instrumentations/src/mongodb-core.js +34 -9
  34. package/packages/datadog-instrumentations/src/mongoose.js +10 -12
  35. package/packages/datadog-instrumentations/src/mysql.js +2 -2
  36. package/packages/datadog-instrumentations/src/mysql2.js +1 -1
  37. package/packages/datadog-instrumentations/src/pg.js +25 -11
  38. package/packages/datadog-instrumentations/src/playwright.js +449 -60
  39. package/packages/datadog-instrumentations/src/redis.js +19 -10
  40. package/packages/datadog-instrumentations/src/router.js +4 -2
  41. package/packages/datadog-instrumentations/src/vitest.js +246 -149
  42. package/packages/datadog-plugin-apollo/src/gateway/request.js +1 -21
  43. package/packages/datadog-plugin-aws-sdk/src/base.js +18 -24
  44. package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
  45. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +1 -1
  46. package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +1 -1
  47. package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +1 -1
  48. package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -1
  49. package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
  50. package/packages/datadog-plugin-aws-sdk/src/services/sns.js +2 -2
  51. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +1 -1
  52. package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +1 -1
  53. package/packages/datadog-plugin-couchbase/src/index.js +58 -52
  54. package/packages/datadog-plugin-cucumber/src/index.js +1 -0
  55. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +239 -40
  56. package/packages/datadog-plugin-cypress/src/support.js +13 -1
  57. package/packages/datadog-plugin-elasticsearch/src/index.js +28 -8
  58. package/packages/datadog-plugin-electron/src/index.js +17 -0
  59. package/packages/datadog-plugin-electron/src/ipc.js +143 -0
  60. package/packages/datadog-plugin-electron/src/net.js +82 -0
  61. package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +27 -18
  62. package/packages/datadog-plugin-graphql/src/execute.js +6 -28
  63. package/packages/datadog-plugin-graphql/src/resolve.js +30 -35
  64. package/packages/datadog-plugin-graphql/src/tools/signature.js +32 -7
  65. package/packages/datadog-plugin-graphql/src/tools/transforms.js +118 -100
  66. package/packages/datadog-plugin-graphql/src/utils.js +33 -1
  67. package/packages/datadog-plugin-grpc/src/client.js +6 -7
  68. package/packages/datadog-plugin-grpc/src/util.js +57 -22
  69. package/packages/datadog-plugin-http/src/client.js +2 -2
  70. package/packages/datadog-plugin-jest/src/index.js +92 -50
  71. package/packages/datadog-plugin-kafkajs/src/producer.js +32 -0
  72. package/packages/datadog-plugin-mocha/src/index.js +1 -0
  73. package/packages/datadog-plugin-mongodb-core/src/index.js +70 -69
  74. package/packages/datadog-plugin-mysql/src/index.js +1 -1
  75. package/packages/datadog-plugin-openai/src/services.js +2 -1
  76. package/packages/datadog-plugin-pg/src/index.js +3 -3
  77. package/packages/datadog-plugin-playwright/src/index.js +4 -0
  78. package/packages/datadog-plugin-redis/src/index.js +54 -24
  79. package/packages/datadog-plugin-undici/src/index.js +19 -0
  80. package/packages/datadog-plugin-vitest/src/index.js +19 -7
  81. package/packages/datadog-shimmer/src/shimmer.js +35 -0
  82. package/packages/dd-trace/src/aiguard/index.js +3 -1
  83. package/packages/dd-trace/src/aiguard/sdk.js +36 -30
  84. package/packages/dd-trace/src/aiguard/tags.js +20 -11
  85. package/packages/dd-trace/src/appsec/blocking.js +2 -2
  86. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +2 -2
  87. package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +1 -1
  88. package/packages/dd-trace/src/appsec/index.js +10 -3
  89. package/packages/dd-trace/src/appsec/reporter.js +19 -5
  90. package/packages/dd-trace/src/azure_metadata.js +17 -6
  91. package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +4 -4
  92. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +4 -2
  93. package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +6 -4
  94. package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +1 -1
  95. package/packages/dd-trace/src/ci-visibility/requests/request.js +3 -1
  96. package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +5 -3
  97. package/packages/dd-trace/src/config/defaults.js +3 -14
  98. package/packages/dd-trace/src/config/generated-config-types.d.ts +4 -1
  99. package/packages/dd-trace/src/config/helper.js +4 -0
  100. package/packages/dd-trace/src/config/index.js +2 -2
  101. package/packages/dd-trace/src/config/major-overrides.js +98 -0
  102. package/packages/dd-trace/src/config/parsers.js +7 -1
  103. package/packages/dd-trace/src/config/supported-configurations.json +60 -38
  104. package/packages/dd-trace/src/crashtracking/crashtracker.js +15 -3
  105. package/packages/dd-trace/src/datastreams/checkpointer.js +2 -2
  106. package/packages/dd-trace/src/datastreams/context.js +4 -2
  107. package/packages/dd-trace/src/datastreams/manager.js +1 -1
  108. package/packages/dd-trace/src/datastreams/processor.js +2 -2
  109. package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +2 -2
  110. package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +1 -1
  111. package/packages/dd-trace/src/debugger/devtools_client/state.js +2 -1
  112. package/packages/dd-trace/src/debugger/index.js +7 -7
  113. package/packages/dd-trace/src/dogstatsd.js +2 -2
  114. package/packages/dd-trace/src/encode/0.4.js +45 -54
  115. package/packages/dd-trace/src/encode/0.5.js +34 -3
  116. package/packages/dd-trace/src/encode/agentless-ci-visibility.js +26 -19
  117. package/packages/dd-trace/src/encode/agentless-json.js +1 -1
  118. package/packages/dd-trace/src/exporter.js +2 -0
  119. package/packages/dd-trace/src/exporters/agent/index.js +2 -1
  120. package/packages/dd-trace/src/exporters/agentless/index.js +3 -2
  121. package/packages/dd-trace/src/exporters/agentless/writer.js +2 -2
  122. package/packages/dd-trace/src/exporters/common/agents.js +3 -1
  123. package/packages/dd-trace/src/exporters/common/buffering-exporter.js +2 -1
  124. package/packages/dd-trace/src/exporters/common/request.js +4 -2
  125. package/packages/dd-trace/src/exporters/electron/index.js +49 -0
  126. package/packages/dd-trace/src/external-logger/src/index.js +2 -1
  127. package/packages/dd-trace/src/git_metadata.js +10 -8
  128. package/packages/dd-trace/src/id.js +17 -4
  129. package/packages/dd-trace/src/lambda/handler-paths.js +52 -0
  130. package/packages/dd-trace/src/lambda/handler.js +2 -4
  131. package/packages/dd-trace/src/lambda/index.js +62 -14
  132. package/packages/dd-trace/src/lambda/runtime/patch.js +21 -46
  133. package/packages/dd-trace/src/llmobs/index.js +13 -2
  134. package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +45 -15
  135. package/packages/dd-trace/src/llmobs/sdk.js +10 -0
  136. package/packages/dd-trace/src/llmobs/writers/base.js +2 -1
  137. package/packages/dd-trace/src/log/writer.js +3 -1
  138. package/packages/dd-trace/src/noop/span.js +3 -1
  139. package/packages/dd-trace/src/openfeature/writers/base.js +2 -1
  140. package/packages/dd-trace/src/openfeature/writers/exposures.js +51 -20
  141. package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +3 -2
  142. package/packages/dd-trace/src/opentracing/propagation/text_map.js +20 -9
  143. package/packages/dd-trace/src/payload-tagging/config/index.js +2 -2
  144. package/packages/dd-trace/src/plugins/apollo.js +3 -1
  145. package/packages/dd-trace/src/plugins/ci_plugin.js +52 -17
  146. package/packages/dd-trace/src/plugins/database.js +54 -12
  147. package/packages/dd-trace/src/plugins/index.js +1 -0
  148. package/packages/dd-trace/src/plugins/log_plugin.js +3 -1
  149. package/packages/dd-trace/src/plugins/plugin.js +2 -4
  150. package/packages/dd-trace/src/plugins/tracing.js +5 -3
  151. package/packages/dd-trace/src/plugins/util/ci.js +8 -8
  152. package/packages/dd-trace/src/plugins/util/git-cache.js +20 -18
  153. package/packages/dd-trace/src/plugins/util/git.js +3 -1
  154. package/packages/dd-trace/src/plugins/util/stacktrace.js +2 -2
  155. package/packages/dd-trace/src/plugins/util/test.js +119 -5
  156. package/packages/dd-trace/src/plugins/util/user-provided-git.js +17 -15
  157. package/packages/dd-trace/src/plugins/util/web.js +11 -0
  158. package/packages/dd-trace/src/priority_sampler.js +1 -1
  159. package/packages/dd-trace/src/profiling/profiler.js +1 -1
  160. package/packages/dd-trace/src/profiling/profilers/wall.js +1 -1
  161. package/packages/dd-trace/src/profiling/ssi-heuristics.js +1 -1
  162. package/packages/dd-trace/src/rate_limiter.js +1 -1
  163. package/packages/dd-trace/src/remote_config/scheduler.js +1 -1
  164. package/packages/dd-trace/src/ritm.js +2 -1
  165. package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +5 -8
  166. package/packages/dd-trace/src/scope.js +7 -5
  167. package/packages/dd-trace/src/serverless.js +5 -2
  168. package/packages/dd-trace/src/service-naming/extra-services.js +14 -0
  169. package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +20 -0
  170. package/packages/dd-trace/src/service-naming/schemas/v0/web.js +4 -0
  171. package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +20 -0
  172. package/packages/dd-trace/src/service-naming/schemas/v1/web.js +4 -0
  173. package/packages/dd-trace/src/span_stats.js +1 -1
  174. package/packages/dd-trace/src/telemetry/dependencies.js +1 -1
  175. package/packages/dd-trace/src/telemetry/endpoints.js +1 -1
  176. package/packages/dd-trace/src/telemetry/telemetry.js +2 -2
  177. package/packages/dd-trace/src/lambda/runtime/ritm.js +0 -133
  178. package/vendor/dist/opentracing/LICENSE +0 -201
  179. package/vendor/dist/opentracing/binary_carrier.d.ts +0 -11
  180. package/vendor/dist/opentracing/constants.d.ts +0 -61
  181. package/vendor/dist/opentracing/examples/demo/demo.d.ts +0 -2
  182. package/vendor/dist/opentracing/ext/tags.d.ts +0 -90
  183. package/vendor/dist/opentracing/functions.d.ts +0 -20
  184. package/vendor/dist/opentracing/global_tracer.d.ts +0 -14
  185. package/vendor/dist/opentracing/index.d.ts +0 -12
  186. package/vendor/dist/opentracing/index.js +0 -1
  187. package/vendor/dist/opentracing/mock_tracer/index.d.ts +0 -5
  188. package/vendor/dist/opentracing/mock_tracer/mock_context.d.ts +0 -13
  189. package/vendor/dist/opentracing/mock_tracer/mock_report.d.ts +0 -16
  190. package/vendor/dist/opentracing/mock_tracer/mock_span.d.ts +0 -50
  191. package/vendor/dist/opentracing/mock_tracer/mock_tracer.d.ts +0 -26
  192. package/vendor/dist/opentracing/noop.d.ts +0 -8
  193. package/vendor/dist/opentracing/reference.d.ts +0 -33
  194. package/vendor/dist/opentracing/span.d.ts +0 -147
  195. package/vendor/dist/opentracing/span_context.d.ts +0 -26
  196. package/vendor/dist/opentracing/test/api_compatibility.d.ts +0 -16
  197. package/vendor/dist/opentracing/test/mocktracer_implemenation.d.ts +0 -3
  198. package/vendor/dist/opentracing/test/noop_implementation.d.ts +0 -4
  199. package/vendor/dist/opentracing/test/opentracing_api.d.ts +0 -3
  200. package/vendor/dist/opentracing/test/unittest.d.ts +0 -2
  201. package/vendor/dist/opentracing/tracer.d.ts +0 -127
@@ -31,11 +31,13 @@ const {
31
31
  TEST_SKIPPED_BY_ITR,
32
32
  TEST_ITR_UNSKIPPABLE,
33
33
  TEST_ITR_FORCED_RUN,
34
+ TEST_ITR_SKIPPING_ENABLED,
34
35
  ITR_CORRELATION_ID,
35
36
  TEST_SOURCE_FILE,
36
37
  TEST_IS_NEW,
37
38
  TEST_IS_RETRY,
38
39
  TEST_EARLY_FLAKE_ENABLED,
40
+ TEST_EARLY_FLAKE_ABORT_REASON,
39
41
  getTestSessionName,
40
42
  TEST_SESSION_NAME,
41
43
  TEST_LEVEL_EVENT_TYPES,
@@ -52,19 +54,27 @@ const {
52
54
  getPullRequestDiff,
53
55
  getModifiedFilesFromDiff,
54
56
  getSessionRequestErrorTags,
55
- DD_CI_LIBRARY_CONFIGURATION_ERROR,
57
+ DD_CI_LIBRARY_CONFIGURATION_ERROR_SETTINGS,
58
+ DD_CI_LIBRARY_CONFIGURATION_ERROR_KNOWN_TESTS,
59
+ DD_CI_LIBRARY_CONFIGURATION_ERROR_SKIPPABLE_TESTS,
60
+ DD_CI_LIBRARY_CONFIGURATION_ERROR_TEST_MANAGEMENT_TESTS,
61
+ getSessionItrSkippingEnabledTags,
56
62
  TEST_IS_MODIFIED,
57
63
  TEST_HAS_DYNAMIC_NAME,
64
+ getIsFaultyEarlyFlakeDetection,
58
65
  DYNAMIC_NAME_RE,
59
66
  recordAttemptToFixExecution,
60
67
  logAttemptToFixTestExecution,
61
68
  logTestOptimizationSummary,
69
+ getEfdRetryCount,
70
+ getMaxEfdRetryCount,
62
71
  getPullRequestBaseBranch,
63
72
  TEST_FINAL_STATUS,
73
+ getTestOptimizationRequestResults,
64
74
  } = require('../../dd-trace/src/plugins/util/test')
65
75
  const { isMarkedAsUnskippable } = require('../../datadog-plugin-jest/src/util')
66
76
  const { ORIGIN_KEY, COMPONENT } = require('../../dd-trace/src/constants')
67
- const { getValueFromEnvSources } = require('../../dd-trace/src/config/helper')
77
+ const getConfig = require('../../dd-trace/src/config')
68
78
  const { appClosing: appClosingTelemetry } = require('../../dd-trace/src/telemetry')
69
79
  const log = require('../../dd-trace/src/log')
70
80
 
@@ -263,6 +273,36 @@ function getSuiteStatus (suiteStats) {
263
273
  return 'pass'
264
274
  }
265
275
 
276
+ function getMatchingCypressTest (cypressTests, testName, attemptIndex, testStatus, preferIndexedMatch = false) {
277
+ let matchingTestByIndex
278
+ let matchingTestByStatus
279
+ let matchingTestIndex = 0
280
+
281
+ for (const cypressTest of cypressTests) {
282
+ if (cypressTest.title.join(' ') !== testName) {
283
+ continue
284
+ }
285
+
286
+ if (matchingTestIndex === attemptIndex) {
287
+ matchingTestByIndex = cypressTest
288
+ }
289
+ matchingTestIndex++
290
+
291
+ if (!matchingTestByStatus && CYPRESS_STATUS_TO_TEST_STATUS[cypressTest.state] === testStatus) {
292
+ matchingTestByStatus = cypressTest
293
+ }
294
+ }
295
+
296
+ return preferIndexedMatch
297
+ ? matchingTestByIndex || matchingTestByStatus
298
+ : matchingTestByStatus || matchingTestByIndex
299
+ }
300
+
301
+ function isCypressHookFailure (cypressTest) {
302
+ return CYPRESS_STATUS_TO_TEST_STATUS[cypressTest.state] === 'fail' &&
303
+ /\bhook\b/.test(String(cypressTest.displayError || ''))
304
+ }
305
+
266
306
  const FINAL_STATUS_RETRY_KIND = {
267
307
  none: 'none',
268
308
  atr: 'atr',
@@ -320,14 +360,20 @@ class CypressPlugin {
320
360
 
321
361
  finishedTestsByFile = {}
322
362
  testStatuses = {}
363
+ hasLibraryConfiguration = false
323
364
  isTestsSkipped = false
324
365
  isSuitesSkippingEnabled = false
325
366
  isCodeCoverageEnabled = false
326
367
  isFlakyTestRetriesEnabled = false
327
368
  flakyTestRetriesCount = 0
328
369
  isEarlyFlakeDetectionEnabled = false
370
+ isEarlyFlakeDetectionFaulty = false
329
371
  isKnownTestsEnabled = false
330
372
  earlyFlakeDetectionNumRetries = 0
373
+ earlyFlakeDetectionSlowTestRetries = {}
374
+ efdRetryCountByTest = {}
375
+ efdSlowAbortedTests = {}
376
+ earlyFlakeDetectionFaultyThreshold = 0
331
377
  testsToSkip = []
332
378
  skippedTests = []
333
379
  hasForcedToRunSuites = false
@@ -393,14 +439,20 @@ class CypressPlugin {
393
439
  this._isInit = false
394
440
  this.finishedTestsByFile = {}
395
441
  this.testStatuses = {}
442
+ this.hasLibraryConfiguration = false
396
443
  this.isTestsSkipped = false
397
444
  this.isSuitesSkippingEnabled = false
398
445
  this.isCodeCoverageEnabled = false
399
446
  this.isFlakyTestRetriesEnabled = false
400
447
  this.flakyTestRetriesCount = 0
401
448
  this.isEarlyFlakeDetectionEnabled = false
449
+ this.isEarlyFlakeDetectionFaulty = false
402
450
  this.isKnownTestsEnabled = false
403
451
  this.earlyFlakeDetectionNumRetries = 0
452
+ this.earlyFlakeDetectionSlowTestRetries = {}
453
+ this.efdRetryCountByTest = {}
454
+ this.efdSlowAbortedTests = {}
455
+ this.earlyFlakeDetectionFaultyThreshold = 0
404
456
  this.testsToSkip = []
405
457
  this.skippedTests = []
406
458
  this.hasForcedToRunSuites = false
@@ -454,8 +506,7 @@ class CypressPlugin {
454
506
 
455
507
  this.isTestIsolationEnabled = getIsTestIsolationEnabled(cypressConfig)
456
508
 
457
- const envFlushWait = Number(getValueFromEnvSources('DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS'))
458
- this.rumFlushWaitMillis = Number.isFinite(envFlushWait) ? envFlushWait : undefined
509
+ this.rumFlushWaitMillis = getConfig().DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS
459
510
 
460
511
  if (!this.isTestIsolationEnabled) {
461
512
  log.warn('Test isolation is disabled, retries will not be enabled')
@@ -471,16 +522,19 @@ class CypressPlugin {
471
522
  if (libraryConfigurationResponse.err) {
472
523
  log.error('Cypress plugin library config response error', libraryConfigurationResponse.err)
473
524
  this._pendingRequestErrorTags.push({
474
- tag: DD_CI_LIBRARY_CONFIGURATION_ERROR,
525
+ tag: DD_CI_LIBRARY_CONFIGURATION_ERROR_SETTINGS,
475
526
  value: 'true',
476
527
  })
477
528
  } else {
529
+ this.hasLibraryConfiguration = true
478
530
  const {
479
531
  libraryConfig: {
480
532
  isSuitesSkippingEnabled,
481
533
  isCodeCoverageEnabled,
482
534
  isEarlyFlakeDetectionEnabled,
483
535
  earlyFlakeDetectionNumRetries,
536
+ earlyFlakeDetectionSlowTestRetries,
537
+ earlyFlakeDetectionFaultyThreshold,
484
538
  isFlakyTestRetriesEnabled,
485
539
  flakyTestRetriesCount,
486
540
  isKnownTestsEnabled,
@@ -493,6 +547,8 @@ class CypressPlugin {
493
547
  this.isCodeCoverageEnabled = isCodeCoverageEnabled
494
548
  this.isEarlyFlakeDetectionEnabled = isEarlyFlakeDetectionEnabled
495
549
  this.earlyFlakeDetectionNumRetries = earlyFlakeDetectionNumRetries
550
+ this.earlyFlakeDetectionSlowTestRetries = earlyFlakeDetectionSlowTestRetries ?? {}
551
+ this.earlyFlakeDetectionFaultyThreshold = earlyFlakeDetectionFaultyThreshold
496
552
  this.isKnownTestsEnabled = isKnownTestsEnabled
497
553
  if (isFlakyTestRetriesEnabled && this.isTestIsolationEnabled) {
498
554
  this.isFlakyTestRetriesEnabled = true
@@ -533,9 +589,76 @@ class CypressPlugin {
533
589
  return { isAttemptToFix, isDisabled, isQuarantined }
534
590
  }
535
591
 
592
+ /**
593
+ * Returns how many EFD retries must be scheduled before the first duration is known.
594
+ *
595
+ * @returns {number}
596
+ */
597
+ getConfiguredEfdRetryCount () {
598
+ const { earlyFlakeDetectionSlowTestRetries } = this
599
+ if (!earlyFlakeDetectionSlowTestRetries || !Object.keys(earlyFlakeDetectionSlowTestRetries).length) {
600
+ return this.earlyFlakeDetectionNumRetries
601
+ }
602
+ return getMaxEfdRetryCount(earlyFlakeDetectionSlowTestRetries)
603
+ }
604
+
605
+ /**
606
+ * Returns the selected EFD retry count for a test, or the scheduling count if it has not run yet.
607
+ *
608
+ * @param {string} testSuite
609
+ * @param {string} testName
610
+ * @returns {number}
611
+ */
612
+ getEfdRetryCountForTest (testSuite, testName) {
613
+ const testSuiteRetries = this.efdRetryCountByTest[testSuite]
614
+ if (!testSuiteRetries || testSuiteRetries[testName] === undefined) {
615
+ return this.getConfiguredEfdRetryCount()
616
+ }
617
+ return testSuiteRetries[testName]
618
+ }
619
+
620
+ /**
621
+ * Stores the selected EFD retry count for a test after its first execution duration is known.
622
+ *
623
+ * @param {string} testSuite
624
+ * @param {string} testName
625
+ * @param {number | undefined} duration
626
+ * @returns {number}
627
+ */
628
+ setEfdRetryCountForTest (testSuite, testName, duration) {
629
+ if (!this.efdRetryCountByTest[testSuite]) {
630
+ this.efdRetryCountByTest[testSuite] = {}
631
+ }
632
+ const retryCount = getEfdRetryCount(duration ?? 0, this.earlyFlakeDetectionSlowTestRetries)
633
+ this.efdRetryCountByTest[testSuite][testName] = retryCount
634
+ if (retryCount === 0) {
635
+ if (!this.efdSlowAbortedTests[testSuite]) {
636
+ this.efdSlowAbortedTests[testSuite] = {}
637
+ }
638
+ this.efdSlowAbortedTests[testSuite][testName] = true
639
+ }
640
+ return retryCount
641
+ }
642
+
643
+ /**
644
+ * Returns whether an EFD retry clone is beyond the selected retry count and should be discarded.
645
+ *
646
+ * @param {string} testSuite
647
+ * @param {string} testName
648
+ * @param {number} efdRetryIndex
649
+ * @returns {boolean}
650
+ */
651
+ shouldSkipEfdRetry (testSuite, testName, efdRetryIndex) {
652
+ const testSuiteRetries = this.efdRetryCountByTest[testSuite]
653
+ return testSuiteRetries?.[testName] !== undefined && efdRetryIndex > testSuiteRetries[testName]
654
+ }
655
+
536
656
  getTestSuiteSpan ({ testSuite, testSuiteAbsolutePath }) {
537
- const testSuiteSpanMetadata =
538
- getTestSuiteCommonTags(this.command, this.frameworkVersion, testSuite, TEST_FRAMEWORK_NAME)
657
+ const testSuiteSpanMetadata = {
658
+ ...getTestSuiteCommonTags(this.command, this.frameworkVersion, testSuite, TEST_FRAMEWORK_NAME),
659
+ ...this.getSessionRequestErrorTags(),
660
+ ...this.getSessionItrSkippingEnabledTags(),
661
+ }
539
662
 
540
663
  this.ciVisEvent(TELEMETRY_EVENT_CREATED, 'suite')
541
664
 
@@ -588,6 +711,7 @@ class CypressPlugin {
588
711
  if (testSourceFile) {
589
712
  testSpanMetadata[TEST_SOURCE_FILE] = testSourceFile
590
713
  }
714
+ Object.assign(testSpanMetadata, this.getSessionItrSkippingEnabledTags())
591
715
 
592
716
  const codeOwners = this.getTestCodeOwners({ testSuite, testSourceFile })
593
717
  if (codeOwners) {
@@ -637,6 +761,15 @@ class CypressPlugin {
637
761
  return getSessionRequestErrorTags(this.testSessionSpan)
638
762
  }
639
763
 
764
+ /**
765
+ * Returns ITR skipping-enabled tags from the test session span for propagation to child events.
766
+ *
767
+ * @returns {Record<string, string>}
768
+ */
769
+ getSessionItrSkippingEnabledTags () {
770
+ return getSessionItrSkippingEnabledTags(this.testSessionSpan)
771
+ }
772
+
640
773
  ciVisEvent (name, testLevel, tags = {}) {
641
774
  incrementCountMetric(name, {
642
775
  testLevel,
@@ -655,18 +788,29 @@ class CypressPlugin {
655
788
  this.frameworkVersion = getCypressVersion(details)
656
789
  this.rootDir = getRootDir(details)
657
790
 
791
+ const {
792
+ knownTestsResponse,
793
+ testManagementTestsResponse,
794
+ skippableSuitesResponse: skippableTestsRequestResponse,
795
+ } = await getTestOptimizationRequestResults({
796
+ isKnownTestsEnabled: this.isKnownTestsEnabled,
797
+ isTestManagementTestsEnabled: this.isTestManagementTestsEnabled,
798
+ isSuitesSkippingEnabled: this.isSuitesSkippingEnabled,
799
+ getKnownTests: () => getKnownTests(this.tracer, this.testConfiguration),
800
+ getTestManagementTests: () => getTestManagementTests(this.tracer, this.testConfiguration),
801
+ getSkippableSuites: () => getSkippableTests(this.tracer, this.testConfiguration),
802
+ })
803
+
658
804
  if (this.isKnownTestsEnabled) {
659
- const knownTestsResponse = await getKnownTests(
660
- this.tracer,
661
- this.testConfiguration
662
- )
663
- if (knownTestsResponse.err) {
664
- log.error('Cypress known tests response error', knownTestsResponse.err)
805
+ const currentKnownTestsResponse = knownTestsResponse || await getKnownTests(this.tracer, this.testConfiguration)
806
+ if (currentKnownTestsResponse.err) {
807
+ log.error('Cypress known tests response error', currentKnownTestsResponse.err)
808
+ this._pendingRequestErrorTags.push({ tag: DD_CI_LIBRARY_CONFIGURATION_ERROR_KNOWN_TESTS, value: 'true' })
665
809
  this.isEarlyFlakeDetectionEnabled = false
666
810
  this.isKnownTestsEnabled = false
667
811
  } else {
668
- if (knownTestsResponse.knownTests[TEST_FRAMEWORK_NAME]) {
669
- this.knownTestsByTestSuite = knownTestsResponse.knownTests[TEST_FRAMEWORK_NAME]
812
+ if (currentKnownTestsResponse.knownTests?.[TEST_FRAMEWORK_NAME]) {
813
+ this.knownTestsByTestSuite = currentKnownTestsResponse.knownTests[TEST_FRAMEWORK_NAME]
670
814
  } else {
671
815
  this.isEarlyFlakeDetectionEnabled = false
672
816
  this.isKnownTestsEnabled = false
@@ -674,13 +818,27 @@ class CypressPlugin {
674
818
  }
675
819
  }
676
820
 
677
- if (this.isSuitesSkippingEnabled) {
678
- const skippableTestsResponse = await getSkippableTests(
679
- this.tracer,
680
- this.testConfiguration
821
+ if (this.isKnownTestsEnabled && details.specs) {
822
+ const testSuites = details.specs.map(({ relative }) => relative)
823
+ const isFaulty = getIsFaultyEarlyFlakeDetection(
824
+ testSuites,
825
+ this.knownTestsByTestSuite,
826
+ this.earlyFlakeDetectionFaultyThreshold
681
827
  )
828
+ if (isFaulty) {
829
+ log.warn('New test detection is disabled because the number of new test files is too high.')
830
+ this.isEarlyFlakeDetectionEnabled = false
831
+ this.isEarlyFlakeDetectionFaulty = true
832
+ this.isKnownTestsEnabled = false
833
+ }
834
+ }
835
+
836
+ if (this.isSuitesSkippingEnabled) {
837
+ const skippableTestsResponse =
838
+ skippableTestsRequestResponse || await getSkippableTests(this.tracer, this.testConfiguration)
682
839
  if (skippableTestsResponse.err) {
683
840
  log.error('Cypress skippable tests response error', skippableTestsResponse.err)
841
+ this._pendingRequestErrorTags.push({ tag: DD_CI_LIBRARY_CONFIGURATION_ERROR_SKIPPABLE_TESTS, value: 'true' })
684
842
  } else {
685
843
  const { skippableTests, correlationId } = skippableTestsResponse
686
844
  this.testsToSkip = skippableTests || []
@@ -690,15 +848,17 @@ class CypressPlugin {
690
848
  }
691
849
 
692
850
  if (this.isTestManagementTestsEnabled) {
693
- const testManagementTestsResponse = await getTestManagementTests(
694
- this.tracer,
695
- this.testConfiguration
696
- )
697
- if (testManagementTestsResponse.err) {
698
- log.error('Cypress test management tests response error', testManagementTestsResponse.err)
851
+ const currentTestManagementTestsResponse =
852
+ testManagementTestsResponse || await getTestManagementTests(this.tracer, this.testConfiguration)
853
+ if (currentTestManagementTestsResponse.err) {
854
+ log.error('Cypress test management tests response error', currentTestManagementTestsResponse.err)
855
+ this._pendingRequestErrorTags.push({
856
+ tag: DD_CI_LIBRARY_CONFIGURATION_ERROR_TEST_MANAGEMENT_TESTS,
857
+ value: 'true',
858
+ })
699
859
  this.isTestManagementTestsEnabled = false
700
860
  } else {
701
- this.testManagementTests = testManagementTestsResponse.testManagementTests
861
+ this.testManagementTests = currentTestManagementTestsResponse.testManagementTests
702
862
  }
703
863
  }
704
864
 
@@ -731,6 +891,9 @@ class CypressPlugin {
731
891
  if (this.isEarlyFlakeDetectionEnabled) {
732
892
  testSessionSpanMetadata[TEST_EARLY_FLAKE_ENABLED] = 'true'
733
893
  }
894
+ if (this.isEarlyFlakeDetectionFaulty) {
895
+ testSessionSpanMetadata[TEST_EARLY_FLAKE_ABORT_REASON] = 'faulty'
896
+ }
734
897
 
735
898
  const trimmedCommand = DD_MAJOR < 6 ? this.command : 'cypress run'
736
899
 
@@ -789,6 +952,11 @@ class CypressPlugin {
789
952
  },
790
953
  integrationName: TEST_FRAMEWORK_NAME,
791
954
  })
955
+ if (this.hasLibraryConfiguration) {
956
+ const skippingEnabled = this.isSuitesSkippingEnabled ? 'true' : 'false'
957
+ this.testSessionSpan.setTag(TEST_ITR_SKIPPING_ENABLED, skippingEnabled)
958
+ this.testModuleSpan.setTag(TEST_ITR_SKIPPING_ENABLED, skippingEnabled)
959
+ }
792
960
  this.ciVisEvent(TELEMETRY_EVENT_CREATED, 'module')
793
961
 
794
962
  return details
@@ -833,7 +1001,7 @@ class CypressPlugin {
833
1001
  this.ciVisEvent(TELEMETRY_EVENT_FINISHED, 'session')
834
1002
  incrementCountMetric(TELEMETRY_TEST_SESSION, {
835
1003
  provider: this.ciProviderName,
836
- autoInjected: !!getValueFromEnvSources('DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER'),
1004
+ autoInjected: !!getConfig().DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER,
837
1005
  })
838
1006
 
839
1007
  finishAllTraceSpans(this.testSessionSpan)
@@ -934,17 +1102,25 @@ class CypressPlugin {
934
1102
 
935
1103
  for (const [testName, finishedTestAttempts] of Object.entries(finishedTestsByTestName)) {
936
1104
  for (const [attemptIndex, finishedTest] of finishedTestAttempts.entries()) {
937
- // TODO: there could be multiple if there have been retries!
938
- // potentially we need to match the test status!
939
- const cypressTest = cypressTests.find(test => test.title.join(' ') === testName)
1105
+ // We can check if this is the last attempt regardless of the retry mechanism
1106
+ const isLastAttempt = attemptIndex === finishedTestAttempts.length - 1
1107
+ const isDatadogManagedAttempt = finishedTest.isEfdManagedTest || finishedTest.isAttemptToFix
1108
+ const cypressTest = isDatadogManagedAttempt
1109
+ ? getMatchingCypressTest(cypressTests, testName, attemptIndex, finishedTest.testStatus, isLastAttempt) ||
1110
+ cypressTests.find(test => test.title.join(' ') === testName)
1111
+ : cypressTests.find(test => test.title.join(' ') === testName)
940
1112
  if (!cypressTest) {
941
1113
  continue
942
1114
  }
943
1115
  // finishedTests can include multiple tests with the same name if they have been retried
944
1116
  // by early flake detection. Cypress is unaware of this so .attempts does not necessarily have
945
1117
  // the same length as `finishedTestAttempts`
946
- let cypressTestStatus = CYPRESS_STATUS_TO_TEST_STATUS[cypressTest.state]
947
- if (cypressTest.attempts && cypressTest.attempts[attemptIndex]) {
1118
+ const shouldUseCapturedStatus = isDatadogManagedAttempt && !(isLastAttempt && isCypressHookFailure(cypressTest))
1119
+ let cypressTestStatus = shouldUseCapturedStatus
1120
+ ? finishedTest.testStatus
1121
+ : CYPRESS_STATUS_TO_TEST_STATUS[cypressTest.state]
1122
+ if (!finishedTest.isEfdManagedTest && !finishedTest.isAttemptToFix &&
1123
+ cypressTest.attempts && cypressTest.attempts[attemptIndex]) {
948
1124
  cypressTestStatus = CYPRESS_STATUS_TO_TEST_STATUS[cypressTest.attempts[attemptIndex].state]
949
1125
  const isAtrRetry = attemptIndex > 0 &&
950
1126
  this.isFlakyTestRetriesEnabled &&
@@ -961,6 +1137,9 @@ class CypressPlugin {
961
1137
  }
962
1138
  }
963
1139
  }
1140
+ if (finishedTest.isEfdManagedTest && finishedTest.testStatus !== 'skip' && cypressTestStatus === 'skip') {
1141
+ cypressTestStatus = finishedTest.testStatus
1142
+ }
964
1143
  if (cypressTest.displayError) {
965
1144
  latestError = new Error(cypressTest.displayError)
966
1145
  }
@@ -970,6 +1149,9 @@ class CypressPlugin {
970
1149
  if (cypressTestStatus !== finishedTest.testStatus && (!isQuarantinedTest || finishedTest.isAttemptToFix)) {
971
1150
  finishedTest.testSpan.setTag(TEST_STATUS, cypressTestStatus)
972
1151
  finishedTest.testSpan.setTag('error', latestError)
1152
+ if (finishedTest.isAttemptToFix && cypressTestStatus === 'fail') {
1153
+ finishedTest.testSpan.setTag(TEST_MANAGEMENT_ATTEMPT_TO_FIX_PASSED, 'false')
1154
+ }
973
1155
  }
974
1156
  if (this.itrCorrelationId) {
975
1157
  finishedTest.testSpan.setTag(ITR_CORRELATION_ID, this.itrCorrelationId)
@@ -989,8 +1171,6 @@ class CypressPlugin {
989
1171
  finishedTest.testSpan.setTag(TEST_CODE_OWNERS, codeOwners)
990
1172
  }
991
1173
 
992
- // We can check if this is the last attempt regardless of the retry mechanism
993
- const isLastAttempt = attemptIndex === finishedTestAttempts.length - 1
994
1174
  if (isLastAttempt) {
995
1175
  const testSpanTags = finishedTest.testSpan.context()._tags
996
1176
  const retryKind = getFinalStatusRetryKind({
@@ -1042,7 +1222,8 @@ class CypressPlugin {
1042
1222
  const suitePayload = {
1043
1223
  isEarlyFlakeDetectionEnabled: this.isEarlyFlakeDetectionEnabled,
1044
1224
  knownTestsForSuite: this.knownTestsByTestSuite?.[testSuite] || [],
1045
- earlyFlakeDetectionNumRetries: this.earlyFlakeDetectionNumRetries,
1225
+ earlyFlakeDetectionNumRetries: this.getConfiguredEfdRetryCount(),
1226
+ earlyFlakeDetectionSlowTestRetries: this.earlyFlakeDetectionSlowTestRetries,
1046
1227
  isKnownTestsEnabled: this.isKnownTestsEnabled,
1047
1228
  isTestManagementEnabled: this.isTestManagementTestsEnabled,
1048
1229
  testManagementAttemptToFixRetries: this.testManagementAttemptToFixRetries,
@@ -1058,7 +1239,10 @@ class CypressPlugin {
1058
1239
  return suitePayload
1059
1240
  },
1060
1241
  'dd:beforeEach': (test) => {
1061
- const { testName, testSuite } = test
1242
+ const { testName, testSuite, isEfdRetry, efdRetryIndex } = test
1243
+ if (isEfdRetry && this.shouldSkipEfdRetry(testSuite, testName, efdRetryIndex)) {
1244
+ return { shouldSkip: true, shouldDiscard: true }
1245
+ }
1062
1246
  const shouldSkip = this.testsToSkip.some(test => {
1063
1247
  return testName === test.name && testSuite === test.suite
1064
1248
  })
@@ -1115,6 +1299,7 @@ class CypressPlugin {
1115
1299
  isEfdRetry,
1116
1300
  isAttemptToFix,
1117
1301
  isModified,
1302
+ duration,
1118
1303
  isQuarantined: isQuarantinedFromSupport,
1119
1304
  isDisabled: isDisabledFromSupport,
1120
1305
  } = test
@@ -1136,7 +1321,19 @@ class CypressPlugin {
1136
1321
  }
1137
1322
  this.tracer._tracer._exporter.exportCoverage(formattedCoverage)
1138
1323
  }
1139
- const testStatus = CYPRESS_STATUS_TO_TEST_STATUS[state]
1324
+ const isEfdManagedTest = (isNew || isModified) && this.isEarlyFlakeDetectionEnabled && !isAttemptToFix
1325
+ let testStatus = CYPRESS_STATUS_TO_TEST_STATUS[state]
1326
+ let didAbortSlowEfdRetries = false
1327
+ if (isEfdManagedTest && !isEfdRetry && this.efdRetryCountByTest[testSuite]?.[testName] === undefined) {
1328
+ const retryCount = this.setEfdRetryCountForTest(testSuite, testName, duration)
1329
+ if (retryCount === 0) {
1330
+ didAbortSlowEfdRetries = true
1331
+ this.activeTestSpan.setTag(TEST_EARLY_FLAKE_ABORT_REASON, 'slow')
1332
+ }
1333
+ }
1334
+ if (didAbortSlowEfdRetries && testStatus === 'skip' && !error && duration > 0) {
1335
+ testStatus = 'pass'
1336
+ }
1140
1337
  this.activeTestSpan.setTag(TEST_STATUS, testStatus)
1141
1338
 
1142
1339
  // Save the test status to know if it has passed all retries
@@ -1199,9 +1396,10 @@ class CypressPlugin {
1199
1396
  }
1200
1397
  }
1201
1398
  // Check if all EFD retries failed
1202
- if ((isNew || isModified) && this.earlyFlakeDetectionNumRetries > 0) {
1203
- const isLastEfdAttempt = testStatuses.length === this.earlyFlakeDetectionNumRetries + 1
1204
- if (isLastEfdAttempt && testStatuses.every(status => status === 'fail')) {
1399
+ if (isEfdManagedTest) {
1400
+ const efdRetryCount = this.getEfdRetryCountForTest(testSuite, testName)
1401
+ const isLastEfdAttempt = testStatuses.length === efdRetryCount + 1
1402
+ if (efdRetryCount > 0 && isLastEfdAttempt && testStatuses.every(status => status === 'fail')) {
1205
1403
  this.activeTestSpan.setTag(TEST_HAS_FAILED_ALL_RETRIES, 'true')
1206
1404
  }
1207
1405
  }
@@ -1252,6 +1450,7 @@ class CypressPlugin {
1252
1450
  finishTime: this._now(),
1253
1451
  testSpan: this.activeTestSpan,
1254
1452
  isEfdRetry,
1453
+ isEfdManagedTest,
1255
1454
  isAttemptToFix,
1256
1455
  }
1257
1456
  if (this.finishedTestsByFile[testSuite]) {
@@ -79,6 +79,9 @@ function getRetriedTests (test, numRetries, tags) {
79
79
  // TODO: signal in framework logs that this is a retry.
80
80
  // TODO: Change it so these tests are allowed to fail.
81
81
  const clonedTest = test.clone()
82
+ if (tags.includes('_ddIsEfdRetry')) {
83
+ clonedTest._ddEfdRetryIndex = retryIndex + 1
84
+ }
82
85
  for (const tag of tags) {
83
86
  if (tag) {
84
87
  clonedTest[tag] = true
@@ -173,7 +176,12 @@ beforeEach(function () {
173
176
  cy.task('dd:beforeEach', {
174
177
  testName,
175
178
  testSuite: Cypress.mocha.getRootSuite().file,
176
- }).then(({ traceId, shouldSkip }) => {
179
+ isEfdRetry: Cypress.mocha.getRunner().suite.ctx.currentTest._ddIsEfdRetry,
180
+ efdRetryIndex: Cypress.mocha.getRunner().suite.ctx.currentTest._ddEfdRetryIndex,
181
+ }).then(({ traceId, shouldSkip, shouldDiscard }) => {
182
+ if (shouldDiscard) {
183
+ this.currentTest._ddShouldDiscard = true
184
+ }
177
185
  if (traceId) {
178
186
  cy.setCookie(DD_CIVISIBILITY_TEST_EXECUTION_ID_COOKIE_NAME, traceId).then(() => {
179
187
  // When testIsolation:false, the page is not reset between tests, so the RUM session
@@ -242,6 +250,9 @@ after(() => {
242
250
 
243
251
  afterEach(function () {
244
252
  const currentTest = Cypress.mocha.getRunner().suite.ctx.currentTest
253
+ if (currentTest._ddShouldDiscard) {
254
+ return
255
+ }
245
256
  const testName = currentTest.fullTitle()
246
257
 
247
258
  // Check if this was a test management test that we suppressed the failure for.
@@ -267,6 +278,7 @@ afterEach(function () {
267
278
  isEfdRetry: currentTest._ddIsEfdRetry,
268
279
  isAttemptToFix: currentTest._ddIsAttemptToFix,
269
280
  isModified: currentTest._ddIsModified,
281
+ duration: currentTest.duration,
270
282
  // Mark suppressed tests so the plugin can tag them with the correct test management reason.
271
283
  isQuarantined: isTestManagementTestThatFailed && suppressedTestFailure.isQuarantined,
272
284
  isDisabled: isTestManagementTestThatFailed && suppressedTestFailure.isDisabled,
@@ -5,23 +5,43 @@ const DatabasePlugin = require('../../dd-trace/src/plugins/database')
5
5
  class ElasticsearchPlugin extends DatabasePlugin {
6
6
  static id = 'elasticsearch'
7
7
 
8
+ #urlTag
9
+ #methodTag
10
+ #bodyTag
11
+ #paramsTag
12
+
13
+ constructor (...args) {
14
+ super(...args)
15
+
16
+ // Per-instance because `system` differs on the OpenSearchPlugin subclass.
17
+ const { system } = this
18
+ this.#urlTag = `${system}.url`
19
+ this.#methodTag = `${system}.method`
20
+ this.#bodyTag = `${system}.body`
21
+ this.#paramsTag = `${system}.params`
22
+ }
23
+
8
24
  bindStart (ctx) {
9
25
  const { params } = ctx
10
26
 
11
- const body = getBody(params.body || params.bulkBody)
27
+ const meta = {
28
+ 'db.type': this.system,
29
+ [this.#urlTag]: params.path,
30
+ [this.#methodTag]: params.method,
31
+ [this.#bodyTag]: getBody(params.body || params.bulkBody),
32
+ }
33
+
34
+ const queryString = params.querystring || params.query
35
+ if (queryString) {
36
+ meta[this.#paramsTag] = JSON.stringify(queryString)
37
+ }
12
38
 
13
39
  this.startSpan(this.operationName(), {
14
40
  service: this.serviceName({ pluginConfig: this.config }),
15
41
  resource: `${params.method} ${quantizePath(params.path)}`,
16
42
  type: 'elasticsearch',
17
43
  kind: 'client',
18
- meta: {
19
- 'db.type': this.system,
20
- [`${this.system}.url`]: params.path,
21
- [`${this.system}.method`]: params.method,
22
- [`${this.system}.body`]: body,
23
- [`${this.system}.params`]: JSON.stringify(params.querystring || params.query),
24
- },
44
+ meta,
25
45
  }, ctx)
26
46
 
27
47
  return ctx.currentStore
@@ -0,0 +1,17 @@
1
+ 'use strict'
2
+
3
+ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
4
+ const ElectronIpcPlugin = require('./ipc')
5
+ const ElectronNetPlugin = require('./net')
6
+
7
+ class ElectronPlugin extends CompositePlugin {
8
+ static id = 'electron'
9
+ static get plugins () {
10
+ return {
11
+ net: ElectronNetPlugin,
12
+ ipc: ElectronIpcPlugin,
13
+ }
14
+ }
15
+ }
16
+
17
+ module.exports = ElectronPlugin