dd-trace 5.61.0 → 5.62.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 (192) hide show
  1. package/package.json +1 -1
  2. package/packages/datadog-instrumentations/src/apollo-server.js +50 -8
  3. package/packages/datadog-instrumentations/src/aws-sdk.js +49 -60
  4. package/packages/datadog-instrumentations/src/fastify.js +61 -55
  5. package/packages/datadog-instrumentations/src/graphql.js +90 -122
  6. package/packages/datadog-instrumentations/src/http2/server.js +14 -20
  7. package/packages/datadog-instrumentations/src/microgateway-core.js +16 -15
  8. package/packages/datadog-instrumentations/src/mongodb-core.js +34 -29
  9. package/packages/datadog-instrumentations/src/mongodb.js +9 -13
  10. package/packages/datadog-instrumentations/src/mongoose.js +25 -29
  11. package/packages/datadog-instrumentations/src/openai.js +0 -2
  12. package/packages/datadog-instrumentations/src/oracledb.js +39 -33
  13. package/packages/datadog-instrumentations/src/router.js +1 -1
  14. package/packages/datadog-plugin-aerospike/src/index.js +5 -9
  15. package/packages/datadog-plugin-amqp10/src/consumer.js +2 -2
  16. package/packages/datadog-plugin-amqp10/src/index.js +1 -1
  17. package/packages/datadog-plugin-amqp10/src/producer.js +3 -3
  18. package/packages/datadog-plugin-amqplib/src/client.js +3 -3
  19. package/packages/datadog-plugin-amqplib/src/consumer.js +2 -2
  20. package/packages/datadog-plugin-amqplib/src/index.js +1 -1
  21. package/packages/datadog-plugin-amqplib/src/producer.js +2 -2
  22. package/packages/datadog-plugin-apollo/src/gateway/execute.js +2 -4
  23. package/packages/datadog-plugin-apollo/src/gateway/fetch.js +2 -4
  24. package/packages/datadog-plugin-apollo/src/gateway/index.js +1 -1
  25. package/packages/datadog-plugin-apollo/src/gateway/plan.js +2 -4
  26. package/packages/datadog-plugin-apollo/src/gateway/postprocessing.js +2 -4
  27. package/packages/datadog-plugin-apollo/src/gateway/request.js +2 -4
  28. package/packages/datadog-plugin-apollo/src/gateway/validate.js +2 -4
  29. package/packages/datadog-plugin-apollo/src/index.js +1 -1
  30. package/packages/datadog-plugin-avsc/src/index.js +2 -2
  31. package/packages/datadog-plugin-aws-sdk/src/base.js +70 -46
  32. package/packages/datadog-plugin-aws-sdk/src/index.js +1 -3
  33. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +1 -3
  34. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/tracing.js +1 -1
  35. package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
  36. package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +3 -3
  37. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -2
  38. package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +22 -20
  39. package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +1 -1
  40. package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -1
  41. package/packages/datadog-plugin-aws-sdk/src/services/s3.js +3 -3
  42. package/packages/datadog-plugin-aws-sdk/src/services/sfn.js +1 -1
  43. package/packages/datadog-plugin-aws-sdk/src/services/sns.js +3 -3
  44. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +17 -15
  45. package/packages/datadog-plugin-aws-sdk/src/services/states.js +1 -1
  46. package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +1 -1
  47. package/packages/datadog-plugin-azure-functions/src/index.js +5 -5
  48. package/packages/datadog-plugin-azure-service-bus/src/index.js +1 -1
  49. package/packages/datadog-plugin-azure-service-bus/src/producer.js +2 -2
  50. package/packages/datadog-plugin-bunyan/src/index.js +3 -5
  51. package/packages/datadog-plugin-cassandra-driver/src/index.js +3 -3
  52. package/packages/datadog-plugin-child_process/src/index.js +2 -2
  53. package/packages/datadog-plugin-confluentinc-kafka-javascript/src/batch-consumer.js +1 -3
  54. package/packages/datadog-plugin-confluentinc-kafka-javascript/src/consumer.js +1 -3
  55. package/packages/datadog-plugin-confluentinc-kafka-javascript/src/index.js +1 -1
  56. package/packages/datadog-plugin-confluentinc-kafka-javascript/src/producer.js +1 -3
  57. package/packages/datadog-plugin-connect/src/index.js +1 -3
  58. package/packages/datadog-plugin-couchbase/src/index.js +2 -2
  59. package/packages/datadog-plugin-cucumber/src/index.js +1 -3
  60. package/packages/datadog-plugin-cypress/src/index.js +1 -3
  61. package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -3
  62. package/packages/datadog-plugin-dns/src/index.js +1 -1
  63. package/packages/datadog-plugin-dns/src/lookup.js +2 -2
  64. package/packages/datadog-plugin-dns/src/lookup_service.js +2 -2
  65. package/packages/datadog-plugin-dns/src/resolve.js +2 -2
  66. package/packages/datadog-plugin-dns/src/reverse.js +2 -2
  67. package/packages/datadog-plugin-elasticsearch/src/index.js +1 -1
  68. package/packages/datadog-plugin-express/src/code_origin.js +1 -3
  69. package/packages/datadog-plugin-express/src/index.js +1 -1
  70. package/packages/datadog-plugin-express/src/tracing.js +1 -3
  71. package/packages/datadog-plugin-fastify/src/code_origin.js +1 -3
  72. package/packages/datadog-plugin-fastify/src/index.js +1 -1
  73. package/packages/datadog-plugin-fastify/src/tracing.js +18 -3
  74. package/packages/datadog-plugin-fetch/src/index.js +2 -2
  75. package/packages/datadog-plugin-find-my-way/src/index.js +1 -3
  76. package/packages/datadog-plugin-fs/src/index.js +2 -2
  77. package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +3 -3
  78. package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -2
  79. package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +1 -1
  80. package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +2 -2
  81. package/packages/datadog-plugin-google-cloud-vertexai/src/index.js +1 -1
  82. package/packages/datadog-plugin-google-cloud-vertexai/src/tracing.js +2 -4
  83. package/packages/datadog-plugin-graphql/src/execute.js +16 -9
  84. package/packages/datadog-plugin-graphql/src/index.js +1 -1
  85. package/packages/datadog-plugin-graphql/src/parse.js +12 -7
  86. package/packages/datadog-plugin-graphql/src/resolve.js +50 -16
  87. package/packages/datadog-plugin-graphql/src/validate.js +13 -7
  88. package/packages/datadog-plugin-grpc/src/client.js +4 -4
  89. package/packages/datadog-plugin-grpc/src/index.js +1 -1
  90. package/packages/datadog-plugin-grpc/src/server.js +3 -3
  91. package/packages/datadog-plugin-hapi/src/index.js +1 -3
  92. package/packages/datadog-plugin-hono/src/index.js +1 -3
  93. package/packages/datadog-plugin-http/src/client.js +2 -2
  94. package/packages/datadog-plugin-http/src/index.js +1 -1
  95. package/packages/datadog-plugin-http/src/server.js +3 -7
  96. package/packages/datadog-plugin-http2/src/client.js +2 -2
  97. package/packages/datadog-plugin-http2/src/index.js +1 -1
  98. package/packages/datadog-plugin-http2/src/server.js +22 -11
  99. package/packages/datadog-plugin-ioredis/src/index.js +1 -3
  100. package/packages/datadog-plugin-iovalkey/src/index.js +2 -4
  101. package/packages/datadog-plugin-jest/src/index.js +1 -3
  102. package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +2 -2
  103. package/packages/datadog-plugin-kafkajs/src/consumer.js +2 -2
  104. package/packages/datadog-plugin-kafkajs/src/index.js +1 -1
  105. package/packages/datadog-plugin-kafkajs/src/producer.js +3 -3
  106. package/packages/datadog-plugin-koa/src/index.js +1 -3
  107. package/packages/datadog-plugin-langchain/src/index.js +2 -2
  108. package/packages/datadog-plugin-langchain/src/tracing.js +30 -48
  109. package/packages/datadog-plugin-mariadb/src/index.js +2 -2
  110. package/packages/datadog-plugin-memcached/src/index.js +1 -1
  111. package/packages/datadog-plugin-microgateway-core/src/index.js +4 -4
  112. package/packages/datadog-plugin-mocha/src/index.js +1 -3
  113. package/packages/datadog-plugin-moleculer/src/client.js +2 -2
  114. package/packages/datadog-plugin-moleculer/src/index.js +1 -1
  115. package/packages/datadog-plugin-moleculer/src/server.js +2 -2
  116. package/packages/datadog-plugin-mongodb-core/src/index.js +9 -5
  117. package/packages/datadog-plugin-mongoose/src/index.js +20 -0
  118. package/packages/datadog-plugin-mysql/src/index.js +2 -2
  119. package/packages/datadog-plugin-mysql2/src/index.js +1 -1
  120. package/packages/datadog-plugin-net/src/index.js +1 -1
  121. package/packages/datadog-plugin-net/src/ipc.js +2 -2
  122. package/packages/datadog-plugin-net/src/tcp.js +2 -2
  123. package/packages/datadog-plugin-next/src/index.js +1 -3
  124. package/packages/datadog-plugin-nyc/src/index.js +1 -3
  125. package/packages/datadog-plugin-openai/src/index.js +1 -1
  126. package/packages/datadog-plugin-openai/src/tracing.js +7 -411
  127. package/packages/datadog-plugin-opensearch/src/index.js +1 -3
  128. package/packages/datadog-plugin-oracledb/src/index.js +9 -5
  129. package/packages/datadog-plugin-pg/src/index.js +3 -3
  130. package/packages/datadog-plugin-pino/src/index.js +3 -5
  131. package/packages/datadog-plugin-playwright/src/index.js +1 -3
  132. package/packages/datadog-plugin-prisma/src/client.js +4 -6
  133. package/packages/datadog-plugin-prisma/src/engine.js +3 -3
  134. package/packages/datadog-plugin-prisma/src/index.js +1 -1
  135. package/packages/datadog-plugin-protobufjs/src/index.js +2 -6
  136. package/packages/datadog-plugin-redis/src/index.js +2 -2
  137. package/packages/datadog-plugin-restify/src/index.js +1 -3
  138. package/packages/datadog-plugin-rhea/src/consumer.js +1 -1
  139. package/packages/datadog-plugin-rhea/src/index.js +1 -1
  140. package/packages/datadog-plugin-rhea/src/producer.js +2 -2
  141. package/packages/datadog-plugin-router/src/index.js +1 -3
  142. package/packages/datadog-plugin-selenium/src/index.js +1 -3
  143. package/packages/datadog-plugin-sharedb/src/index.js +1 -1
  144. package/packages/datadog-plugin-tedious/src/index.js +3 -3
  145. package/packages/datadog-plugin-undici/src/index.js +2 -4
  146. package/packages/datadog-plugin-vitest/src/index.js +1 -3
  147. package/packages/datadog-plugin-web/src/index.js +1 -3
  148. package/packages/datadog-plugin-winston/src/index.js +3 -5
  149. package/packages/dd-trace/src/appsec/channels.js +1 -0
  150. package/packages/dd-trace/src/appsec/graphql.js +14 -12
  151. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -1
  152. package/packages/dd-trace/src/appsec/waf/waf_manager.js +1 -1
  153. package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +1 -3
  154. package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +1 -3
  155. package/packages/dd-trace/src/config.js +1 -1
  156. package/packages/dd-trace/src/datastreams/checkpointer.js +23 -2
  157. package/packages/dd-trace/src/datastreams/processor.js +4 -3
  158. package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +30 -50
  159. package/packages/dd-trace/src/llmobs/plugins/openai.js +3 -5
  160. package/packages/dd-trace/src/llmobs/plugins/vertexai.js +3 -5
  161. package/packages/dd-trace/src/opentracing/propagation/text_map.js +25 -2
  162. package/packages/dd-trace/src/plugins/apollo.js +3 -3
  163. package/packages/dd-trace/src/plugins/cache.js +1 -1
  164. package/packages/dd-trace/src/plugins/client.js +3 -3
  165. package/packages/dd-trace/src/plugins/consumer.js +3 -3
  166. package/packages/dd-trace/src/plugins/database.js +2 -2
  167. package/packages/dd-trace/src/plugins/index.js +1 -0
  168. package/packages/dd-trace/src/plugins/log_plugin.js +1 -5
  169. package/packages/dd-trace/src/plugins/outbound.js +1 -1
  170. package/packages/dd-trace/src/plugins/plugin.js +1 -1
  171. package/packages/dd-trace/src/plugins/producer.js +3 -3
  172. package/packages/dd-trace/src/plugins/server.js +3 -3
  173. package/packages/dd-trace/src/plugins/storage.js +1 -1
  174. package/packages/dd-trace/src/plugins/tracing.js +24 -6
  175. package/packages/dd-trace/src/plugins/util/ci.js +11 -7
  176. package/packages/dd-trace/src/plugins/util/inferred_proxy.js +15 -19
  177. package/packages/dd-trace/src/plugins/util/tags.js +2 -0
  178. package/packages/dd-trace/src/plugins/util/web.js +26 -7
  179. package/packages/dd-trace/src/profiling/config.js +2 -0
  180. package/packages/dd-trace/src/profiling/exporters/event_serializer.js +2 -21
  181. package/packages/dd-trace/src/profiling/libuv-size.js +49 -0
  182. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns.js +2 -6
  183. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookup.js +1 -3
  184. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookupservice.js +1 -3
  185. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_resolve.js +1 -3
  186. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_reverse.js +1 -3
  187. package/packages/dd-trace/src/profiling/profilers/event_plugins/fs.js +3 -9
  188. package/packages/dd-trace/src/profiling/profilers/event_plugins/net.js +3 -9
  189. package/packages/dd-trace/src/profiling/profilers/events.js +80 -62
  190. package/packages/dd-trace/src/profiling/profilers/poisson.js +105 -0
  191. package/packages/dd-trace/src/profiling/profilers/wall.js +1 -1
  192. package/packages/dd-trace/src/remote_config/manager.js +1 -1
@@ -4,9 +4,7 @@ const RouterPlugin = require('../../datadog-plugin-router/src')
4
4
  const web = require('../../dd-trace/src/plugins/util/web')
5
5
 
6
6
  class HonoPlugin extends RouterPlugin {
7
- static get id () {
8
- return 'hono'
9
- }
7
+ static id = 'hono'
10
8
 
11
9
  constructor (...args) {
12
10
  super(...args)
@@ -16,8 +16,8 @@ const HTTP_REQUEST_HEADERS = tags.HTTP_REQUEST_HEADERS
16
16
  const HTTP_RESPONSE_HEADERS = tags.HTTP_RESPONSE_HEADERS
17
17
 
18
18
  class HttpClientPlugin extends ClientPlugin {
19
- static get id () { return 'http' }
20
- static get prefix () { return 'apm:http:client:request' }
19
+ static id = 'http'
20
+ static prefix = 'apm:http:client:request'
21
21
 
22
22
  bindStart (message) {
23
23
  const { args, http = {} } = message
@@ -5,7 +5,7 @@ const HttpClientPlugin = require('./client')
5
5
  const CompositePlugin = require('../../dd-trace/src/plugins/composite')
6
6
 
7
7
  class HttpPlugin extends CompositePlugin {
8
- static get id () { return 'http' }
8
+ static id = 'http'
9
9
  static get plugins () {
10
10
  return {
11
11
  server: HttpServerPlugin,
@@ -7,9 +7,9 @@ const { incomingHttpRequestStart, incomingHttpRequestEnd } = require('../../dd-t
7
7
  const { COMPONENT } = require('../../dd-trace/src/constants')
8
8
 
9
9
  class HttpServerPlugin extends ServerPlugin {
10
- static get id () {
11
- return 'http'
12
- }
10
+ static id = 'http'
11
+
12
+ static prefix = 'apm:http:server:request'
13
13
 
14
14
  constructor (...args) {
15
15
  super(...args)
@@ -17,10 +17,6 @@ class HttpServerPlugin extends ServerPlugin {
17
17
  this.addTraceSub('exit', message => this.exit(message))
18
18
  }
19
19
 
20
- addTraceSub (eventName, handler) {
21
- this.addSub(`apm:${this.constructor.id}:server:${this.operation}:${eventName}`, handler)
22
- }
23
-
24
20
  start ({ req, res, abortController }) {
25
21
  const store = storage('legacy').getStore()
26
22
  const span = web.startSpan(
@@ -24,8 +24,8 @@ const HTTP2_HEADER_STATUS = ':status'
24
24
  const HTTP2_METHOD_GET = 'GET'
25
25
 
26
26
  class Http2ClientPlugin extends ClientPlugin {
27
- static get id () { return 'http2' }
28
- static get prefix () { return 'apm:http2:client:request' }
27
+ static id = 'http2'
28
+ static prefix = 'apm:http2:client:request'
29
29
 
30
30
  bindStart (message) {
31
31
  const { authority, options, headers = {} } = message
@@ -5,7 +5,7 @@ const Http2ClientPlugin = require('./client')
5
5
  const CompositePlugin = require('../../dd-trace/src/plugins/composite')
6
6
 
7
7
  class Http2Plugin extends CompositePlugin {
8
- static get id () { return 'http2' }
8
+ static id = 'http2'
9
9
  static get plugins () {
10
10
  return {
11
11
  server: Http2ServerPlugin,
@@ -3,21 +3,22 @@
3
3
  // Plugin temporarily disabled. See https://github.com/DataDog/dd-trace-js/issues/312
4
4
 
5
5
  const ServerPlugin = require('../../dd-trace/src/plugins/server')
6
- const { storage } = require('../../datadog-core')
7
6
  const web = require('../../dd-trace/src/plugins/util/web')
8
7
  const { COMPONENT } = require('../../dd-trace/src/constants')
9
8
 
10
9
  class Http2ServerPlugin extends ServerPlugin {
11
- static get id () {
12
- return 'http2'
10
+ constructor (tracer, config) {
11
+ super(tracer, config)
12
+ this.addBind('apm:http2:server:response:emit', this.bindEmit)
13
13
  }
14
14
 
15
- addTraceSub (eventName, handler) {
16
- this.addSub(`apm:${this.constructor.id}:server:${this.operation}:${eventName}`, handler)
17
- }
15
+ static id = 'http2'
16
+
17
+ static prefix = 'apm:http2:server:request'
18
+
19
+ bindStart (ctx) {
20
+ const { req, res } = ctx
18
21
 
19
- start ({ req, res }) {
20
- const store = storage('legacy').getStore()
21
22
  const span = web.startSpan(
22
23
  this.tracer,
23
24
  {
@@ -26,13 +27,15 @@ class Http2ServerPlugin extends ServerPlugin {
26
27
  },
27
28
  req,
28
29
  res,
29
- this.operationName()
30
+ this.operationName(),
31
+ ctx
30
32
  )
31
33
 
32
34
  span.setTag(COMPONENT, this.constructor.id)
33
35
  span._integrationName = this.constructor.id
34
36
 
35
- this.enter(span, { ...store, req, res })
37
+ ctx.currentStore.req = req
38
+ ctx.currentStore.res = res
36
39
 
37
40
  const context = web.getContext(req)
38
41
 
@@ -40,14 +43,22 @@ class Http2ServerPlugin extends ServerPlugin {
40
43
  context.res.writeHead = web.wrapWriteHead(context)
41
44
  context.instrumented = true
42
45
  }
46
+
47
+ return ctx.currentStore
43
48
  }
44
49
 
45
- finish ({ req }) {
50
+ bindEmit (ctx) {
51
+ if (ctx.eventName !== 'close') return ctx.currentStore
52
+
53
+ const { req } = ctx
54
+
46
55
  const context = web.getContext(req)
47
56
 
48
57
  if (!context || !context.res) return // Not created by a http.Server instance.
49
58
 
50
59
  web.finishAll(context)
60
+
61
+ return ctx.currentStore
51
62
  }
52
63
 
53
64
  error (error) {
@@ -3,9 +3,7 @@
3
3
  const RedisPlugin = require('../../datadog-plugin-redis/src')
4
4
 
5
5
  class IORedisPlugin extends RedisPlugin {
6
- static get id () {
7
- return 'ioredis'
8
- }
6
+ static id = 'ioredis'
9
7
  }
10
8
 
11
9
  module.exports = IORedisPlugin
@@ -3,11 +3,9 @@
3
3
  const RedisPlugin = require('../../datadog-plugin-redis/src')
4
4
 
5
5
  class IOValkeyPlugin extends RedisPlugin {
6
- static get id () {
7
- return 'iovalkey'
8
- }
6
+ static id = 'iovalkey'
9
7
 
10
- static get system () { return 'valkey' }
8
+ static system = 'valkey'
11
9
 
12
10
  constructor (...args) {
13
11
  super(...args)
@@ -67,9 +67,7 @@ function withTimeout (promise, timeoutMs) {
67
67
  }
68
68
 
69
69
  class JestPlugin extends CiPlugin {
70
- static get id () {
71
- return 'jest'
72
- }
70
+ static id = 'jest'
73
71
 
74
72
  // The lists are the same for every test suite, so we can cache them
75
73
  getUnskippableSuites (unskippableSuitesList) {
@@ -5,8 +5,8 @@ const { getMessageSize } = require('../../dd-trace/src/datastreams')
5
5
  const { convertToTextMap } = require('./utils')
6
6
 
7
7
  class KafkajsBatchConsumerPlugin extends ConsumerPlugin {
8
- static get id () { return 'kafkajs' }
9
- static get operation () { return 'consume-batch' }
8
+ static id = 'kafkajs'
9
+ static operation = 'consume-batch'
10
10
 
11
11
  start (ctx) {
12
12
  const { topic, messages, groupId, clusterId } = ctx.extractedArgs || ctx
@@ -10,8 +10,8 @@ const beforeFinishCh = dc.channel('dd-trace:kafkajs:consumer:beforeFinish')
10
10
  const MESSAGING_DESTINATION_KEY = 'messaging.destination.name'
11
11
 
12
12
  class KafkajsConsumerPlugin extends ConsumerPlugin {
13
- static get id () { return 'kafkajs' }
14
- static get operation () { return 'consume' }
13
+ static id = 'kafkajs'
14
+ static operation = 'consume'
15
15
 
16
16
  constructor () {
17
17
  super(...arguments)
@@ -6,7 +6,7 @@ const BatchConsumerPlugin = require('./batch-consumer')
6
6
  const CompositePlugin = require('../../dd-trace/src/plugins/composite')
7
7
 
8
8
  class KafkajsPlugin extends CompositePlugin {
9
- static get id () { return 'kafkajs' }
9
+ static id = 'kafkajs'
10
10
  static get plugins () {
11
11
  return {
12
12
  producer: ProducerPlugin,
@@ -7,9 +7,9 @@ const BOOTSTRAP_SERVERS_KEY = 'messaging.kafka.bootstrap.servers'
7
7
  const MESSAGING_DESTINATION_KEY = 'messaging.destination.name'
8
8
 
9
9
  class KafkajsProducerPlugin extends ProducerPlugin {
10
- static get id () { return 'kafkajs' }
11
- static get operation () { return 'produce' }
12
- static get peerServicePrecursors () { return [BOOTSTRAP_SERVERS_KEY] }
10
+ static id = 'kafkajs'
11
+ static operation = 'produce'
12
+ static peerServicePrecursors = [BOOTSTRAP_SERVERS_KEY]
13
13
 
14
14
  constructor () {
15
15
  super(...arguments)
@@ -4,9 +4,7 @@ const RouterPlugin = require('../../datadog-plugin-router/src')
4
4
  const web = require('../../dd-trace/src/plugins/util/web')
5
5
 
6
6
  class KoaPlugin extends RouterPlugin {
7
- static get id () {
8
- return 'koa'
9
- }
7
+ static id = 'koa'
10
8
 
11
9
  constructor (...args) {
12
10
  super(...args)
@@ -19,8 +19,8 @@ for (const Plugin of langChainTracingPlugins) {
19
19
  }
20
20
 
21
21
  class LangChainPlugin extends CompositePlugin {
22
- static get id () { return 'langchain' }
23
- static get plugins () { return plugins }
22
+ static id = 'langchain'
23
+ static plugins = plugins
24
24
  }
25
25
 
26
26
  module.exports = LangChainPlugin
@@ -13,9 +13,9 @@ const LangChainLanguageModelHandler = require('./handlers/language_models')
13
13
  const LangChainEmbeddingHandler = require('./handlers/embedding')
14
14
 
15
15
  class BaseLangChainTracingPlugin extends TracingPlugin {
16
- static get id () { return 'langchain' }
17
- static get operation () { return 'invoke' }
18
- static get system () { return 'langchain' }
16
+ static id = 'langchain'
17
+ static operation = 'invoke'
18
+ static system = 'langchain'
19
19
 
20
20
  constructor () {
21
21
  super(...arguments)
@@ -85,75 +85,57 @@ class BaseLangChainTracingPlugin extends TracingPlugin {
85
85
  }
86
86
 
87
87
  class RunnableSequenceInvokePlugin extends BaseLangChainTracingPlugin {
88
- static get id () { return 'langchain_rs_invoke' }
89
- static get lcType () { return 'chain' }
90
- static get prefix () {
91
- return 'tracing:orchestrion:@langchain/core:RunnableSequence_invoke'
92
- }
88
+ static id = 'langchain_rs_invoke'
89
+ static lcType = 'chain'
90
+ static prefix = 'tracing:orchestrion:@langchain/core:RunnableSequence_invoke'
93
91
  }
94
92
 
95
93
  class RunnableSequenceBatchPlugin extends BaseLangChainTracingPlugin {
96
- static get id () { return 'langchain_rs_batch' }
97
- static get lcType () { return 'chain' }
98
- static get prefix () {
99
- return 'tracing:orchestrion:@langchain/core:RunnableSequence_batch'
100
- }
94
+ static id = 'langchain_rs_batch'
95
+ static lcType = 'chain'
96
+ static prefix = 'tracing:orchestrion:@langchain/core:RunnableSequence_batch'
101
97
  }
102
98
 
103
99
  class BaseChatModelGeneratePlugin extends BaseLangChainTracingPlugin {
104
- static get id () { return 'langchain_chat_model_generate' }
105
- static get lcType () { return 'chat_model' }
106
- static get prefix () {
107
- return 'tracing:orchestrion:@langchain/core:BaseChatModel_generate'
108
- }
100
+ static id = 'langchain_chat_model_generate'
101
+ static lcType = 'chat_model'
102
+ static prefix = 'tracing:orchestrion:@langchain/core:BaseChatModel_generate'
109
103
  }
110
104
 
111
105
  class BaseLLMGeneratePlugin extends BaseLangChainTracingPlugin {
112
- static get id () { return 'langchain_llm_generate' }
113
- static get lcType () { return 'llm' }
114
- static get prefix () {
115
- return 'tracing:orchestrion:@langchain/core:BaseLLM_generate'
116
- }
106
+ static id = 'langchain_llm_generate'
107
+ static lcType = 'llm'
108
+ static prefix = 'tracing:orchestrion:@langchain/core:BaseLLM_generate'
117
109
  }
118
110
 
119
111
  class EmbeddingsEmbedQueryPlugin extends BaseLangChainTracingPlugin {
120
- static get id () { return 'langchain_embeddings_embed_query' }
121
- static get lcType () { return 'embedding' }
122
- static get prefix () {
123
- return 'tracing:apm:@langchain/core:Embeddings_embedQuery'
124
- }
112
+ static id = 'langchain_embeddings_embed_query'
113
+ static lcType = 'embedding'
114
+ static prefix = 'tracing:apm:@langchain/core:Embeddings_embedQuery'
125
115
  }
126
116
 
127
117
  class EmbeddingsEmbedDocumentsPlugin extends BaseLangChainTracingPlugin {
128
- static get id () { return 'langchain_embeddings_embed_documents' }
129
- static get lcType () { return 'embedding' }
130
- static get prefix () {
131
- return 'tracing:apm:@langchain/core:Embeddings_embedDocuments'
132
- }
118
+ static id = 'langchain_embeddings_embed_documents'
119
+ static lcType = 'embedding'
120
+ static prefix = 'tracing:apm:@langchain/core:Embeddings_embedDocuments'
133
121
  }
134
122
 
135
123
  class ToolInvokePlugin extends BaseLangChainTracingPlugin {
136
- static get id () { return 'langchain_tool_invoke' }
137
- static get lcType () { return 'tool' }
138
- static get prefix () {
139
- return 'tracing:orchestrion:@langchain/core:Tool_invoke'
140
- }
124
+ static id = 'langchain_tool_invoke'
125
+ static lcType = 'tool'
126
+ static prefix = 'tracing:orchestrion:@langchain/core:Tool_invoke'
141
127
  }
142
128
 
143
129
  class VectorStoreSimilaritySearchPlugin extends BaseLangChainTracingPlugin {
144
- static get id () { return 'langchain_vectorstore_similarity_search' }
145
- static get lcType () { return 'similarity_search' }
146
- static get prefix () {
147
- return 'tracing:orchestrion:@langchain/core:VectorStore_similaritySearch'
148
- }
130
+ static id = 'langchain_vectorstore_similarity_search'
131
+ static lcType = 'similarity_search'
132
+ static prefix = 'tracing:orchestrion:@langchain/core:VectorStore_similaritySearch'
149
133
  }
150
134
 
151
135
  class VectorStoreSimilaritySearchWithScorePlugin extends BaseLangChainTracingPlugin {
152
- static get id () { return 'langchain_vectorstore_similarity_search_with_score' }
153
- static get lcType () { return 'similarity_search' }
154
- static get prefix () {
155
- return 'tracing:orchestrion:@langchain/core:VectorStore_similaritySearchWithScore'
156
- }
136
+ static id = 'langchain_vectorstore_similarity_search_with_score'
137
+ static lcType = 'similarity_search'
138
+ static prefix = 'tracing:orchestrion:@langchain/core:VectorStore_similaritySearchWithScore'
157
139
  }
158
140
 
159
141
  module.exports = [
@@ -4,8 +4,8 @@ const { storage } = require('../../datadog-core')
4
4
  const MySQLPlugin = require('../../datadog-plugin-mysql/src')
5
5
 
6
6
  class MariadbPlugin extends MySQLPlugin {
7
- static get id () { return 'mariadb' }
8
- static get system () { return 'mariadb' }
7
+ static id = 'mariadb'
8
+ static system = 'mariadb'
9
9
 
10
10
  constructor (...args) {
11
11
  super(...args)
@@ -4,7 +4,7 @@ const { CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
4
4
  const CachePlugin = require('../../dd-trace/src/plugins/cache')
5
5
 
6
6
  class MemcachedPlugin extends CachePlugin {
7
- static get id () { return 'memcached' }
7
+ static id = 'memcached'
8
8
 
9
9
  bindStart (ctx) {
10
10
  const { client, server, query } = ctx
@@ -4,9 +4,7 @@ const RouterPlugin = require('../../datadog-plugin-router/src')
4
4
  const web = require('../../dd-trace/src/plugins/util/web')
5
5
 
6
6
  class MicrogatewayCorePlugin extends RouterPlugin {
7
- static get id () {
8
- return 'microgateway-core'
9
- }
7
+ static id = 'microgateway-core'
10
8
 
11
9
  constructor (...args) {
12
10
  super(...args)
@@ -19,7 +17,9 @@ class MicrogatewayCorePlugin extends RouterPlugin {
19
17
  web.setRoute(req, route)
20
18
  })
21
19
 
22
- this.addSub('apm:microgateway-core:request:error', this.addError)
20
+ this.addSub('apm:microgateway-core:request:error', ({ error }) => {
21
+ this.addError(error)
22
+ })
23
23
  }
24
24
  }
25
25
 
@@ -74,9 +74,7 @@ function getTestSuiteLevelVisibilityTags (testSuiteSpan) {
74
74
  }
75
75
 
76
76
  class MochaPlugin extends CiPlugin {
77
- static get id () {
78
- return 'mocha'
79
- }
77
+ static id = 'mocha'
80
78
 
81
79
  constructor (...args) {
82
80
  super(...args)
@@ -4,8 +4,8 @@ const ClientPlugin = require('../../dd-trace/src/plugins/client')
4
4
  const { moleculerTags } = require('./util')
5
5
 
6
6
  class MoleculerClientPlugin extends ClientPlugin {
7
- static get id () { return 'moleculer' }
8
- static get operation () { return 'call' }
7
+ static id = 'moleculer'
8
+ static operation = 'call'
9
9
 
10
10
  bindStart (ctx) {
11
11
  const { actionName, opts } = ctx
@@ -7,7 +7,7 @@ const MoleculerClientPlugin = require('./client')
7
7
  const CompositePlugin = require('../../dd-trace/src/plugins/composite')
8
8
 
9
9
  class MoleculerPlugin extends CompositePlugin {
10
- static get id () { return 'moleculer' }
10
+ static id = 'moleculer'
11
11
  static get plugins () {
12
12
  return {
13
13
  server: MoleculerServerPlugin,
@@ -4,8 +4,8 @@ const ServerPlugin = require('../../dd-trace/src/plugins/server')
4
4
  const { moleculerTags } = require('./util')
5
5
 
6
6
  class MoleculerServerPlugin extends ServerPlugin {
7
- static get id () { return 'moleculer' }
8
- static get operation () { return 'action' }
7
+ static id = 'moleculer'
8
+ static operation = 'action'
9
9
 
10
10
  bindStart (ctx) {
11
11
  const { action, middlewareCtx, broker } = ctx
@@ -6,11 +6,11 @@ const coalesce = require('koalas')
6
6
  const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
7
7
 
8
8
  class MongodbCorePlugin extends DatabasePlugin {
9
- static get id () { return 'mongodb-core' }
10
- static get component () { return 'mongodb' }
9
+ static id = 'mongodb-core'
10
+ static component = 'mongodb'
11
11
  // avoid using db.name for peer.service since it includes the collection name
12
12
  // should be removed if one day this will be fixed
13
- static get peerServicePrecursors () { return [] }
13
+ static peerServicePrecursors = []
14
14
 
15
15
  configure (config) {
16
16
  super.configure(config)
@@ -24,7 +24,9 @@ class MongodbCorePlugin extends DatabasePlugin {
24
24
  )
25
25
  }
26
26
 
27
- start ({ ns, ops, options = {}, name }) {
27
+ bindStart (ctx) {
28
+ const { ns, ops, options = {}, name } = ctx
29
+
28
30
  // heartbeat commands can be disabled if this.config.heartbeatEnabled is false
29
31
  if (!this.config.heartbeatEnabled && isHeartbeat(ops, this.config)) {
30
32
  return
@@ -44,11 +46,13 @@ class MongodbCorePlugin extends DatabasePlugin {
44
46
  'out.host': options.host,
45
47
  'out.port': options.port
46
48
  }
47
- })
49
+ }, ctx)
48
50
  const comment = this.injectDbmComment(span, ops.comment, service)
49
51
  if (comment) {
50
52
  ops.comment = comment
51
53
  }
54
+
55
+ return ctx.currentStore
52
56
  }
53
57
 
54
58
  getPeerService (tags) {
@@ -0,0 +1,20 @@
1
+ 'use strict'
2
+
3
+ const DatabasePlugin = require('../../dd-trace/src/plugins/database')
4
+ const { storage } = require('../../datadog-core')
5
+
6
+ class MongoosePlugin extends DatabasePlugin {
7
+ static id = 'mongoose'
8
+ static operation = 'exec'
9
+
10
+ bindStart (ctx) {
11
+ ctx.parentStore = storage('legacy').getStore()
12
+ return ctx.parentStore
13
+ }
14
+
15
+ bindFinish (ctx) {
16
+ return ctx.parentStore
17
+ }
18
+ }
19
+
20
+ module.exports = MongoosePlugin
@@ -5,8 +5,8 @@ const CLIENT_PORT_KEY = require('../../dd-trace/src/constants')
5
5
  const DatabasePlugin = require('../../dd-trace/src/plugins/database')
6
6
 
7
7
  class MySQLPlugin extends DatabasePlugin {
8
- static get id () { return 'mysql' }
9
- static get system () { return 'mysql' }
8
+ static id = 'mysql'
9
+ static system = 'mysql'
10
10
 
11
11
  constructor () {
12
12
  super(...arguments)
@@ -4,7 +4,7 @@ const { storage } = require('../../datadog-core')
4
4
  const MySQLPlugin = require('../../datadog-plugin-mysql/src')
5
5
 
6
6
  class MySQL2Plugin extends MySQLPlugin {
7
- static get id () { return 'mysql2' }
7
+ static id = 'mysql2'
8
8
 
9
9
  constructor () {
10
10
  super(...arguments)
@@ -5,7 +5,7 @@ const NetIPCPlugin = require('./ipc')
5
5
  const NetTCPPlugin = require('./tcp')
6
6
 
7
7
  class NetPlugin extends Plugin {
8
- static get id () { return 'net' }
8
+ static id = 'net'
9
9
 
10
10
  constructor (...args) {
11
11
  super(...args)
@@ -3,8 +3,8 @@
3
3
  const ClientPlugin = require('../../dd-trace/src/plugins/client')
4
4
 
5
5
  class NetIPCPlugin extends ClientPlugin {
6
- static get id () { return 'net' }
7
- static get operation () { return 'ipc' }
6
+ static id = 'net'
7
+ static operation = 'ipc'
8
8
 
9
9
  bindStart (ctx) {
10
10
  this.startSpan('ipc.connect', {
@@ -4,8 +4,8 @@ const { CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
4
4
  const ClientPlugin = require('../../dd-trace/src/plugins/client')
5
5
 
6
6
  class NetTCPPlugin extends ClientPlugin {
7
- static get id () { return 'net' }
8
- static get operation () { return 'tcp' }
7
+ static id = 'net'
8
+ static operation = 'tcp'
9
9
 
10
10
  constructor (...args) {
11
11
  super(...args)
@@ -9,9 +9,7 @@ const web = require('../../dd-trace/src/plugins/util/web')
9
9
  const errorPages = new Set(['/404', '/500', '/_error', '/_not-found', '/_not-found/page'])
10
10
 
11
11
  class NextPlugin extends ServerPlugin {
12
- static get id () {
13
- return 'next'
14
- }
12
+ static id = 'next'
15
13
 
16
14
  constructor (...args) {
17
15
  super(...args)
@@ -3,9 +3,7 @@
3
3
  const CiPlugin = require('../../dd-trace/src/plugins/ci_plugin')
4
4
 
5
5
  class NycPlugin extends CiPlugin {
6
- static get id () {
7
- return 'nyc'
8
- }
6
+ static id = 'nyc'
9
7
 
10
8
  constructor (...args) {
11
9
  super(...args)
@@ -5,7 +5,7 @@ const OpenAiTracingPlugin = require('./tracing')
5
5
  const OpenAiLLMObsPlugin = require('../../dd-trace/src/llmobs/plugins/openai')
6
6
 
7
7
  class OpenAiPlugin extends CompositePlugin {
8
- static get id () { return 'openai' }
8
+ static id = 'openai'
9
9
  static get plugins () {
10
10
  return {
11
11
  llmobs: OpenAiLLMObsPlugin,