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
@@ -2,19 +2,24 @@
2
2
 
3
3
  const { addHook, channel } = require('./helpers/instrument')
4
4
  const { wrapThen } = require('./helpers/promise')
5
- const { AsyncResource } = require('./helpers/instrument')
6
5
  const shimmer = require('../../datadog-shimmer')
7
6
 
7
+ const startCh = channel('datadog:mongoose:model:filter:start')
8
+ const finishCh = channel('datadog:mongoose:model:filter:finish')
9
+ // this channel is for wrapping the callback of exec methods and handling store context
10
+ const execStartCh = channel('apm:mongoose:exec:start')
11
+ const execFinishCh = channel('apm:mongoose:exec:finish')
12
+
8
13
  function wrapAddQueue (addQueue) {
9
- return function addQueueWithTrace (name) {
10
- if (typeof name === 'function') {
11
- arguments[0] = AsyncResource.bind(name)
12
- } else if (typeof this[name] === 'function') {
13
- arguments[0] = AsyncResource.bind((...args) => this[name](...args))
14
- }
14
+ const ctx = {}
15
15
 
16
- return addQueue.apply(this, arguments)
17
- }
16
+ return execStartCh.runStores(ctx, () => {
17
+ return function addQueueWithTrace (name) {
18
+ return execFinishCh.runStores(ctx, () => {
19
+ return addQueue.apply(this, arguments)
20
+ })
21
+ }
22
+ })
18
23
  }
19
24
 
20
25
  addHook({
@@ -31,9 +36,6 @@ addHook({
31
36
  return mongoose
32
37
  })
33
38
 
34
- const startCh = channel('datadog:mongoose:model:filter:start')
35
- const finishCh = channel('datadog:mongoose:model:filter:finish')
36
-
37
39
  const collectionMethodsWithFilter = [
38
40
  'count',
39
41
  'countDocuments',
@@ -68,27 +70,21 @@ addHook({
68
70
  return method.apply(this, arguments)
69
71
  }
70
72
 
71
- const asyncResource = new AsyncResource('bound-anonymous-fn')
72
-
73
73
  const filters = [arguments[0]]
74
74
  if (useTwoArguments) {
75
75
  filters.push(arguments[1])
76
76
  }
77
77
 
78
- const finish = asyncResource.bind(function () {
79
- finishCh.publish()
80
- })
81
-
82
78
  let callbackWrapped = false
83
79
 
84
- const wrapCallbackIfExist = (args) => {
80
+ const wrapCallbackIfExist = (args, ctx) => {
85
81
  const lastArgumentIndex = args.length - 1
86
82
 
87
83
  if (typeof args[lastArgumentIndex] === 'function') {
88
84
  // is a callback, wrap it to execute finish()
89
85
  shimmer.wrap(args, lastArgumentIndex, originalCb => {
90
86
  return function () {
91
- finish()
87
+ finishCh.publish(ctx)
92
88
 
93
89
  return originalCb.apply(this, arguments)
94
90
  }
@@ -98,13 +94,13 @@ addHook({
98
94
  }
99
95
  }
100
96
 
101
- wrapCallbackIfExist(arguments)
97
+ const ctx = {
98
+ filters,
99
+ methodName
100
+ }
102
101
 
103
- return asyncResource.runInAsyncScope(() => {
104
- startCh.publish({
105
- filters,
106
- methodName
107
- })
102
+ return startCh.runStores(ctx, () => {
103
+ wrapCallbackIfExist(arguments, ctx)
108
104
 
109
105
  const res = method.apply(this, arguments)
110
106
 
@@ -113,7 +109,7 @@ addHook({
113
109
  shimmer.wrap(res, 'exec', originalExec => {
114
110
  return function wrappedExec () {
115
111
  if (!callbackWrapped) {
116
- wrapCallbackIfExist(arguments)
112
+ wrapCallbackIfExist(arguments, ctx)
117
113
  }
118
114
 
119
115
  const execResult = originalExec.apply(this, arguments)
@@ -129,7 +125,7 @@ addHook({
129
125
  const reject = arguments[1]
130
126
 
131
127
  arguments[0] = shimmer.wrapFunction(resolve, resolve => function wrappedResolve () {
132
- finish()
128
+ finishCh.publish(ctx)
133
129
 
134
130
  if (resolve) {
135
131
  return resolve.apply(this, arguments)
@@ -137,7 +133,7 @@ addHook({
137
133
  })
138
134
 
139
135
  arguments[1] = shimmer.wrapFunction(reject, reject => function wrappedReject () {
140
- finish()
136
+ finishCh.publish(ctx)
141
137
 
142
138
  if (reject) {
143
139
  return reject.apply(this, arguments)
@@ -151,7 +151,6 @@ addHook({ name: 'openai', file: 'dist/api.js', versions: ['>=3.0.0 <4'] }, expor
151
151
  methodName,
152
152
  args: arguments,
153
153
  basePath: this.basePath,
154
- apiKey: this.configuration.apiKey
155
154
  }
156
155
 
157
156
  return ch.tracePromise(fn, ctx, this, ...arguments)
@@ -224,7 +223,6 @@ for (const extension of extensions) {
224
223
  methodName: `${baseResource}.${methodName}`,
225
224
  args: arguments,
226
225
  basePath: client.baseURL,
227
- apiKey: client.apiKey
228
226
  }
229
227
 
230
228
  return ch.start.runStores(ctx, () => {
@@ -2,8 +2,7 @@
2
2
 
3
3
  const {
4
4
  channel,
5
- addHook,
6
- AsyncResource
5
+ addHook
7
6
  } = require('./helpers/instrument')
8
7
  const shimmer = require('../../datadog-shimmer')
9
8
 
@@ -14,11 +13,11 @@ const startChannel = channel('apm:oracledb:query:start')
14
13
  const errorChannel = channel('apm:oracledb:query:error')
15
14
  const finishChannel = channel('apm:oracledb:query:finish')
16
15
 
17
- function finish (err) {
18
- if (err) {
19
- errorChannel.publish(err)
16
+ function finish (ctx) {
17
+ if (ctx.error) {
18
+ errorChannel.publish(ctx)
20
19
  }
21
- finishChannel.publish()
20
+ finishChannel.publish(ctx)
22
21
  }
23
22
 
24
23
  addHook({ name: 'oracledb', versions: ['>=5'] }, oracledb => {
@@ -30,49 +29,55 @@ addHook({ name: 'oracledb', versions: ['>=5'] }, oracledb => {
30
29
 
31
30
  if (arguments.length && typeof arguments[arguments.length - 1] === 'function') {
32
31
  const cb = arguments[arguments.length - 1]
33
- const outerAr = new AsyncResource('apm:oracledb:outer-scope')
34
32
  arguments[arguments.length - 1] = shimmer.wrapFunction(cb, cb => function wrappedCb (err, result) {
35
- finish(err)
36
- return outerAr.runInAsyncScope(() => cb.apply(this, arguments))
33
+ if (err) {
34
+ ctx.error = err
35
+ errorChannel.publish(ctx)
36
+ }
37
+ return finishChannel.runStores(ctx, () => {
38
+ return cb.apply(this, arguments)
39
+ })
37
40
  })
38
41
  }
39
42
 
40
- return new AsyncResource('apm:oracledb:inner-scope').runInAsyncScope(() => {
41
- // The connAttrs are used to pass through the argument to the potential
42
- // serviceName method a user might have passed through as well as parsing
43
- // the connection string in v5.
44
- const connAttrs = connectionAttributes.get(this)
43
+ // The connAttrs are used to pass through the argument to the potential
44
+ // serviceName method a user might have passed through as well as parsing
45
+ // the connection string in v5.
46
+ const connAttrs = connectionAttributes.get(this)
45
47
 
46
- const details = typeof this.hostName === 'string' ? this : this._impl
48
+ const details = typeof this.hostName === 'string' ? this : this._impl
47
49
 
48
- let hostname
49
- let port
50
- let dbInstance
50
+ let hostname
51
+ let port
52
+ let dbInstance
51
53
 
52
- if (details) {
53
- dbInstance = details.serviceName
54
- hostname = details.hostName ?? details.nscon?.ntAdapter?.hostName
55
- port = String(details.port ?? details.nscon?.ntAdapter?.port ?? '')
56
- }
54
+ if (details) {
55
+ dbInstance = details.serviceName
56
+ hostname = details.hostName ?? details.nscon?.ntAdapter?.hostName
57
+ port = String(details.port ?? details.nscon?.ntAdapter?.port ?? '')
58
+ }
57
59
 
58
- startChannel.publish({
59
- query: dbQuery,
60
- connAttrs,
61
- dbInstance,
62
- port,
63
- hostname,
64
- })
60
+ const ctx = {
61
+ dbInstance,
62
+ port,
63
+ hostname,
64
+ query: dbQuery,
65
+ connAttrs
66
+ }
67
+
68
+ return startChannel.runStores(ctx, () => {
65
69
  try {
66
70
  let result = execute.apply(this, arguments)
67
71
 
68
72
  if (typeof result?.then === 'function') {
69
73
  result = result.then(
70
74
  x => {
71
- finish()
75
+ finish(ctx)
72
76
  return x
73
77
  },
74
78
  e => {
75
- finish(e)
79
+ ctx.error = e
80
+ finish(ctx)
76
81
  throw e
77
82
  }
78
83
  )
@@ -80,7 +85,8 @@ addHook({ name: 'oracledb', versions: ['>=5'] }, oracledb => {
80
85
 
81
86
  return result
82
87
  } catch (err) {
83
- errorChannel.publish(err)
88
+ ctx.error = err
89
+ finish(ctx)
84
90
  throw err
85
91
  }
86
92
  })
@@ -146,7 +146,7 @@ function createWrapRouterMethod (name) {
146
146
  }
147
147
 
148
148
  if (routeAddedChannel.hasSubscribers) {
149
- routeAddedChannel.publish({ topOfStackFunc: methodWithTrace, layer: this.stack[0] })
149
+ routeAddedChannel.publish({ topOfStackFunc: methodWithTrace, layer: this.stack.at(-1) })
150
150
  }
151
151
 
152
152
  if (this.stack.length > offset) {
@@ -6,16 +6,12 @@ const DatabasePlugin = require('../../dd-trace/src/plugins/database')
6
6
  const AEROSPIKE_PEER_SERVICE = 'aerospike.namespace'
7
7
 
8
8
  class AerospikePlugin extends DatabasePlugin {
9
- static get id () { return 'aerospike' }
10
- static get operation () { return 'command' }
11
- static get system () { return 'aerospike' }
12
- static get prefix () {
13
- return 'tracing:apm:aerospike:command'
14
- }
9
+ static id = 'aerospike'
10
+ static operation = 'command'
11
+ static system = 'aerospike'
12
+ static prefix = 'tracing:apm:aerospike:command'
15
13
 
16
- static get peerServicePrecursors () {
17
- return [AEROSPIKE_PEER_SERVICE]
18
- }
14
+ static peerServicePrecursors = [AEROSPIKE_PEER_SERVICE]
19
15
 
20
16
  bindStart (ctx) {
21
17
  const { commandName, commandArgs } = ctx
@@ -4,8 +4,8 @@ const ConsumerPlugin = require('../../dd-trace/src/plugins/consumer')
4
4
  const { getAddress, getShortName } = require('./util')
5
5
 
6
6
  class Amqp10ConsumerPlugin extends ConsumerPlugin {
7
- static get id () { return 'amqp10' }
8
- static get system () { return 'amqp' }
7
+ static id = 'amqp10'
8
+ static system = 'amqp'
9
9
 
10
10
  bindStart (ctx) {
11
11
  const { link } = ctx
@@ -5,7 +5,7 @@ const ConsumerPlugin = require('./consumer')
5
5
  const CompositePlugin = require('../../dd-trace/src/plugins/composite')
6
6
 
7
7
  class Amqp10Plugin extends CompositePlugin {
8
- static get id () { return 'amqp10' }
8
+ static id = 'amqp10'
9
9
  static get plugins () {
10
10
  return {
11
11
  producer: ProducerPlugin,
@@ -5,9 +5,9 @@ const { CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
5
5
  const { getAddress, getShortName } = require('./util')
6
6
 
7
7
  class Amqp10ProducerPlugin extends ProducerPlugin {
8
- static get id () { return 'amqp10' }
9
- static get operation () { return 'send' }
10
- static get system () { return 'amqp' }
8
+ static id = 'amqp10'
9
+ static operation = 'send'
10
+ static system = 'amqp'
11
11
 
12
12
  bindStart (ctx) {
13
13
  const { link } = ctx
@@ -6,9 +6,9 @@ const ClientPlugin = require('../../dd-trace/src/plugins/client')
6
6
  const { getResourceName } = require('./util')
7
7
 
8
8
  class AmqplibClientPlugin extends ClientPlugin {
9
- static get id () { return 'amqplib' }
10
- static get type () { return 'messaging' }
11
- static get operation () { return 'command' }
9
+ static id = 'amqplib'
10
+ static type = 'messaging'
11
+ static operation = 'command'
12
12
 
13
13
  bindStart (ctx) {
14
14
  const { channel = {}, method, fields } = ctx
@@ -6,8 +6,8 @@ const { getAmqpMessageSize } = require('../../dd-trace/src/datastreams')
6
6
  const { getResourceName } = require('./util')
7
7
 
8
8
  class AmqplibConsumerPlugin extends ConsumerPlugin {
9
- static get id () { return 'amqplib' }
10
- static get operation () { return 'consume' }
9
+ static id = 'amqplib'
10
+ static operation = 'consume'
11
11
 
12
12
  bindStart (ctx) {
13
13
  const { method, fields, message, queue } = ctx
@@ -7,7 +7,7 @@ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
7
7
 
8
8
  // TODO: Consider splitting channels for publish/receive in the instrumentation.
9
9
  class AmqplibPlugin extends CompositePlugin {
10
- static get id () { return 'amqplib' }
10
+ static id = 'amqplib'
11
11
  static get plugins () {
12
12
  return {
13
13
  producer: ProducerPlugin,
@@ -7,8 +7,8 @@ const { DsmPathwayCodec, getAmqpMessageSize } = require('../../dd-trace/src/data
7
7
  const { getResourceName } = require('./util')
8
8
 
9
9
  class AmqplibProducerPlugin extends ProducerPlugin {
10
- static get id () { return 'amqplib' }
11
- static get operation () { return 'publish' }
10
+ static id = 'amqplib'
11
+ static operation = 'publish'
12
12
 
13
13
  bindStart (ctx) {
14
14
  const { channel = {}, method, fields, message } = ctx
@@ -3,10 +3,8 @@
3
3
  const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo')
4
4
 
5
5
  class ApolloGatewayExecutePlugin extends ApolloBasePlugin {
6
- static get operation () { return 'execute' }
7
- static get prefix () {
8
- return 'tracing:apm:apollo:gateway:execute'
9
- }
6
+ static operation = 'execute'
7
+ static prefix = 'tracing:apm:apollo:gateway:execute'
10
8
  }
11
9
 
12
10
  module.exports = ApolloGatewayExecutePlugin
@@ -4,10 +4,8 @@ const { storage } = require('../../../datadog-core')
4
4
  const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo')
5
5
 
6
6
  class ApolloGatewayFetchPlugin extends ApolloBasePlugin {
7
- static get operation () { return 'fetch' }
8
- static get prefix () {
9
- return 'tracing:apm:apollo:gateway:fetch'
10
- }
7
+ static operation = 'fetch'
8
+ static prefix = 'tracing:apm:apollo:gateway:fetch'
11
9
 
12
10
  bindStart (ctx) {
13
11
  const store = storage('legacy').getStore()
@@ -10,7 +10,7 @@ const ApolloGatewayValidatePlugin = require('./validate')
10
10
  const ApolloGatewayFetchPlugin = require('./fetch')
11
11
 
12
12
  class ApolloGatewayPlugin extends CompositePlugin {
13
- static get id () { return 'gateway' }
13
+ static id = 'gateway'
14
14
  static get plugins () {
15
15
  return {
16
16
  execute: ApolloGatewayExecutePlugin,
@@ -3,10 +3,8 @@
3
3
  const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo')
4
4
 
5
5
  class ApolloGatewayPlanPlugin extends ApolloBasePlugin {
6
- static get operation () { return 'plan' }
7
- static get prefix () {
8
- return 'tracing:apm:apollo:gateway:plan'
9
- }
6
+ static operation = 'plan'
7
+ static prefix = 'tracing:apm:apollo:gateway:plan'
10
8
  }
11
9
 
12
10
  module.exports = ApolloGatewayPlanPlugin
@@ -3,10 +3,8 @@
3
3
  const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo')
4
4
 
5
5
  class ApolloGatewayPostProcessingPlugin extends ApolloBasePlugin {
6
- static get operation () { return 'postprocessing' }
7
- static get prefix () {
8
- return 'tracing:apm:apollo:gateway:postprocessing'
9
- }
6
+ static operation = 'postprocessing'
7
+ static prefix = 'tracing:apm:apollo:gateway:postprocessing'
10
8
  }
11
9
 
12
10
  module.exports = ApolloGatewayPostProcessingPlugin
@@ -9,10 +9,8 @@ const OPERATION_DEFINITION = 'OperationDefinition'
9
9
  const FRAGMENT_DEFINITION = 'FragmentDefinition'
10
10
 
11
11
  class ApolloGatewayRequestPlugin extends ApolloBasePlugin {
12
- static get operation () { return 'request' }
13
- static get prefix () {
14
- return 'tracing:apm:apollo:gateway:request'
15
- }
12
+ static operation = 'request'
13
+ static prefix = 'tracing:apm:apollo:gateway:request'
16
14
 
17
15
  bindStart (ctx) {
18
16
  const store = storage('legacy').getStore()
@@ -3,10 +3,8 @@
3
3
  const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo')
4
4
 
5
5
  class ApolloGatewayValidatePlugin extends ApolloBasePlugin {
6
- static get operation () { return 'validate' }
7
- static get prefix () {
8
- return 'tracing:apm:apollo:gateway:validate'
9
- }
6
+ static operation = 'validate'
7
+ static prefix = 'tracing:apm:apollo:gateway:validate'
10
8
 
11
9
  end (ctx) {
12
10
  const result = ctx.result
@@ -4,7 +4,7 @@ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
4
4
  const ApolloGatewayPlugin = require('./gateway')
5
5
 
6
6
  class ApolloPlugin extends CompositePlugin {
7
- static get id () { return 'apollo' }
7
+ static id = 'apollo'
8
8
  static get plugins () {
9
9
  return {
10
10
  gateway: ApolloGatewayPlugin
@@ -4,8 +4,8 @@ const SchemaPlugin = require('../../dd-trace/src/plugins/schema')
4
4
  const SchemaExtractor = require('./schema_iterator')
5
5
 
6
6
  class AvscPlugin extends SchemaPlugin {
7
- static get id () { return 'avsc' }
8
- static get schemaExtractor () { return SchemaExtractor }
7
+ static id = 'avsc'
8
+ static schemaExtractor = SchemaExtractor
9
9
  }
10
10
 
11
11
  module.exports = AvscPlugin