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
@@ -9,8 +9,8 @@ const { tagsFromRequest, tagsFromResponse } = require('../../dd-trace/src/payloa
9
9
  const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
10
10
 
11
11
  class BaseAwsSdkPlugin extends ClientPlugin {
12
- static get id () { return 'aws' }
13
- static get isPayloadReporter () { return false }
12
+ static id = 'aws'
13
+ static isPayloadReporter = false
14
14
 
15
15
  get serviceIdentifier () {
16
16
  const id = this.constructor.id.toLowerCase()
@@ -34,17 +34,26 @@ class BaseAwsSdkPlugin extends ClientPlugin {
34
34
  constructor (...args) {
35
35
  super(...args)
36
36
 
37
- this.addSub(`apm:aws:request:start:${this.serviceIdentifier}`, ({
38
- request,
39
- operation,
40
- awsRegion,
41
- awsService
42
- }) => {
37
+ this._parentMap = new WeakMap()
38
+
39
+ this.addBind(`apm:aws:request:start:${this.serviceIdentifier}`, (ctx) => {
40
+ const {
41
+ request,
42
+ operation,
43
+ awsRegion,
44
+ awsService
45
+ } = ctx
46
+
47
+ const parentStore = ctx.parentStore = storage('legacy').getStore()
48
+ const childOf = parentStore?.span
49
+
50
+ this._parentMap.set(request, parentStore)
51
+
43
52
  if (!this.isEnabled(request)) {
44
- return
53
+ return parentStore
45
54
  }
46
- const childOf = this.tracer.scope().active()
47
- const tags = {
55
+
56
+ const meta = {
48
57
  'span.kind': 'client',
49
58
  'service.name': this.serviceName(),
50
59
  'aws.operation': operation,
@@ -54,18 +63,19 @@ class BaseAwsSdkPlugin extends ClientPlugin {
54
63
  'aws.service': awsService,
55
64
  component: 'aws-sdk'
56
65
  }
57
- if (this.requestTags) this.requestTags.set(request, tags)
66
+ if (this.requestTags) this.requestTags.set(request, meta)
58
67
 
59
- const span = this.tracer.startSpan(this.operationFromRequest(request),
60
- {
61
- childOf,
62
- tags,
63
- integrationName: 'aws-sdk'
64
- })
68
+ const span = this.startSpan(this.operationFromRequest(request), {
69
+ childOf,
70
+ meta,
71
+ integrationName: 'aws-sdk'
72
+ }, ctx)
65
73
 
66
74
  analyticsSampler.sample(span, this.config.measured)
67
75
 
68
- this.requestInject(span, request)
76
+ storage('legacy').run(ctx.currentStore, () => {
77
+ this.requestInject(span, request)
78
+ })
69
79
 
70
80
  if (this.constructor.isPayloadReporter && this.cloudTaggingConfig.requestsEnabled) {
71
81
  const maxDepth = this.cloudTaggingConfig.maxDepth
@@ -73,12 +83,15 @@ class BaseAwsSdkPlugin extends ClientPlugin {
73
83
  span.addTags(requestTags)
74
84
  }
75
85
 
76
- this.enter(span)
77
- const store = storage('legacy').getStore()
86
+ return ctx.currentStore
87
+ })
78
88
 
79
- const peerServerlessStorage = storage('peerServerless')
89
+ this.addSub(`apm:aws:request:start:${this.serviceIdentifier}`, (ctx) => {
80
90
  if (!this._tracerConfig?._isInServerlessEnvironment()) return
81
91
 
92
+ const { awsRegion, awsService, currentStore, request } = ctx
93
+ const peerServerlessStorage = storage('peerServerless')
94
+
82
95
  // Try to resolve the hostname immediately; if not possible, keep enough
83
96
  // information so the region callback can resolve it later.
84
97
  const hostname = getHostname({ awsParams: request.params, awsService }, awsRegion)
@@ -86,15 +99,15 @@ class BaseAwsSdkPlugin extends ClientPlugin {
86
99
  peerServerlessStorage.enterWith(peerServerlessStore)
87
100
 
88
101
  if (hostname) {
89
- span.setTag('peer.service', hostname)
102
+ currentStore.span.setTag('peer.service', hostname)
90
103
  peerServerlessStore.peerHostname = hostname
91
104
  } else {
92
- store.awsParams = request.params
93
- store.awsService = awsService
105
+ currentStore.awsParams = request.params
106
+ currentStore.awsService = awsService
94
107
  }
95
108
  })
96
109
 
97
- this.addSub(`apm:aws:request:region:${this.serviceIdentifier}`, region => {
110
+ this.addSub(`apm:aws:request:region:${this.serviceIdentifier}`, ({ region }) => {
98
111
  const store = storage('legacy').getStore()
99
112
  if (!store) return
100
113
  const { span } = store
@@ -114,24 +127,31 @@ class BaseAwsSdkPlugin extends ClientPlugin {
114
127
  }
115
128
  })
116
129
 
117
- this.addSub(`apm:aws:request:complete:${this.serviceIdentifier}`, ({ response, cbExists = false }) => {
118
- const store = storage('legacy').getStore()
119
- if (!store) return
120
- const { span } = store
130
+ this.addSub(`apm:aws:request:complete:${this.serviceIdentifier}`, ctx => {
131
+ const { response, cbExists = false, currentStore } = ctx
132
+ if (!currentStore) return
133
+ const { span } = currentStore
121
134
  if (!span) return
122
- // try to extract DSM context from response if no callback exists as extraction normally happens in CB
123
- if (!cbExists && this.serviceIdentifier === 'sqs') {
124
- const params = response.request.params
125
- const operation = response.request.operation
126
- this.responseExtractDSMContext(operation, params, response.data ?? response, span)
127
- }
128
- this.addResponseTags(span, response)
129
135
 
130
- if (this._tracerConfig?.trace?.aws?.addSpanPointers) {
131
- this.addSpanPointers(span, response)
132
- }
136
+ storage('legacy').run(currentStore, () => {
137
+ // try to extract DSM context from response if no callback exists as extraction normally happens in CB
138
+ if (!cbExists && this.serviceIdentifier === 'sqs') {
139
+ const params = response.request.params
140
+ const operation = response.request.operation
141
+ this.responseExtractDSMContext(operation, params, response.data ?? response, span)
142
+ }
143
+ this.addResponseTags(span, response)
144
+
145
+ if (this._tracerConfig?.trace?.aws?.addSpanPointers) {
146
+ this.addSpanPointers(span, response)
147
+ }
148
+ })
133
149
 
134
- this.finish(span, response, response.error)
150
+ this.finish(ctx)
151
+ })
152
+
153
+ this.addBind(`apm:aws:response:start:${this.serviceIdentifier}`, ctx => {
154
+ return this._parentMap.get(ctx.request)
135
155
  })
136
156
  }
137
157
 
@@ -205,11 +225,15 @@ class BaseAwsSdkPlugin extends ClientPlugin {
205
225
  // implemented by subclasses, or not
206
226
  }
207
227
 
208
- finish (span, response, err) {
209
- if (err) {
210
- span.setTag('error', err)
228
+ finish (ctx) {
229
+ const { currentStore, response } = ctx
230
+ const { span } = currentStore
231
+ const error = response?.error || ctx.error
232
+
233
+ if (error) {
234
+ span.setTag('error', error)
211
235
 
212
- const requestId = err.RequestId || err.requestId
236
+ const requestId = error.RequestId || error.requestId
213
237
  if (requestId) {
214
238
  span.addTags({ 'aws.response.request_id': requestId })
215
239
  }
@@ -219,7 +243,7 @@ class BaseAwsSdkPlugin extends ClientPlugin {
219
243
  this.config.hooks.request(span, response)
220
244
  }
221
245
 
222
- super.finish()
246
+ super.finish(ctx)
223
247
  }
224
248
 
225
249
  configure (config) {
@@ -5,9 +5,7 @@ const Plugin = require('../../dd-trace/src/plugins/plugin')
5
5
  const services = require('./services')
6
6
 
7
7
  class AwsSdkPlugin extends Plugin {
8
- static get id () {
9
- return 'aws-sdk'
10
- }
8
+ static id = 'aws-sdk'
11
9
 
12
10
  constructor (...args) {
13
11
  super(...args)
@@ -4,9 +4,7 @@ const CompositePlugin = require('../../../../dd-trace/src/plugins/composite')
4
4
  const BedrockRuntimeTracing = require('./tracing')
5
5
  const BedrockRuntimeLLMObsPlugin = require('../../../../dd-trace/src/llmobs/plugins/bedrockruntime')
6
6
  class BedrockRuntimePlugin extends CompositePlugin {
7
- static get id () {
8
- return 'bedrockruntime'
9
- }
7
+ static id = 'bedrockruntime'
10
8
 
11
9
  static get plugins () {
12
10
  return {
@@ -6,7 +6,7 @@ const { parseModelId } = require('./utils')
6
6
  const enabledOperations = new Set(['invokeModel'])
7
7
 
8
8
  class BedrockRuntime extends BaseAwsSdkPlugin {
9
- static get id () { return 'bedrockruntime' }
9
+ static id = 'bedrockruntime'
10
10
 
11
11
  isEnabled (request) {
12
12
  const operation = request.operation
@@ -3,7 +3,7 @@
3
3
  const BaseAwsSdkPlugin = require('../base')
4
4
 
5
5
  class CloudwatchLogs extends BaseAwsSdkPlugin {
6
- static get id () { return 'cloudwatchlogs' }
6
+ static id = 'cloudwatchlogs'
7
7
 
8
8
  generateTags (params, operation) {
9
9
  if (!params?.logGroupName) return {}
@@ -6,9 +6,9 @@ const { DYNAMODB_PTR_KIND, SPAN_POINTER_DIRECTION } = require('../../../dd-trace
6
6
  const { extractPrimaryKeys, generatePointerHash } = require('../util')
7
7
 
8
8
  class DynamoDb extends BaseAwsSdkPlugin {
9
- static get id () { return 'dynamodb' }
10
- static get peerServicePrecursors () { return ['tablename'] }
11
- static get isPayloadReporter () { return true }
9
+ static id = 'dynamodb'
10
+ static peerServicePrecursors = ['tablename']
11
+ static isPayloadReporter = true
12
12
 
13
13
  generateTags (params, operation, response) {
14
14
  const tags = {}
@@ -3,8 +3,8 @@ const log = require('../../../dd-trace/src/log')
3
3
  const BaseAwsSdkPlugin = require('../base')
4
4
 
5
5
  class EventBridge extends BaseAwsSdkPlugin {
6
- static get id () { return 'eventbridge' }
7
- static get isPayloadReporter () { return true }
6
+ static id = 'eventbridge'
7
+ static isPayloadReporter = true
8
8
 
9
9
  generateTags (params, operation, response) {
10
10
  if (!params?.source) return {}
@@ -2,12 +2,11 @@
2
2
  const { DsmPathwayCodec, getSizeOrZero } = require('../../../dd-trace/src/datastreams')
3
3
  const log = require('../../../dd-trace/src/log')
4
4
  const BaseAwsSdkPlugin = require('../base')
5
- const { storage } = require('../../../datadog-core')
6
5
 
7
6
  class Kinesis extends BaseAwsSdkPlugin {
8
- static get id () { return 'kinesis' }
9
- static get peerServicePrecursors () { return ['streamname'] }
10
- static get isPayloadReporter () { return true }
7
+ static id = 'kinesis'
8
+ static peerServicePrecursors = ['streamname']
9
+ static isPayloadReporter = true
11
10
 
12
11
  constructor (...args) {
13
12
  super(...args)
@@ -16,48 +15,50 @@ class Kinesis extends BaseAwsSdkPlugin {
16
15
  // in the base class
17
16
  this.requestTags = new WeakMap()
18
17
 
19
- this.addSub('apm:aws:response:start:kinesis', obj => {
20
- const { request, response } = obj
21
- const store = storage('legacy').getStore()
18
+ this.addBind('apm:aws:response:start:kinesis', ctx => {
19
+ const { request, response } = ctx
22
20
  const plugin = this
23
21
 
22
+ let store = this._parentMap.get(request)
23
+
24
24
  // if we have either of these operations, we want to store the streamName param
25
25
  // since it is not typically available during get/put records requests
26
26
  if (request.operation === 'getShardIterator' || request.operation === 'listShards') {
27
- this.storeStreamName(request.params, request.operation, store)
28
- return
27
+ return this.storeStreamName(request.params, request.operation, store)
29
28
  }
30
29
 
31
30
  if (request.operation === 'getRecords') {
32
31
  let span
33
32
  const responseExtraction = this.responseExtract(request.params, request.operation, response)
34
33
  if (responseExtraction && responseExtraction.maybeChildOf) {
35
- obj.needsFinish = true
34
+ ctx.needsFinish = true
36
35
  const options = {
37
36
  childOf: responseExtraction.maybeChildOf,
38
- tags: {
37
+ meta: {
39
38
  ...this.requestTags.get(request),
40
39
  'span.kind': 'server'
41
40
  },
42
41
  integrationName: 'aws-sdk'
43
42
  }
44
- span = plugin.tracer.startSpan('aws.response', options)
45
- this.enter(span, store)
43
+ span = plugin.startSpan('aws.response', options, ctx)
44
+ store = ctx.currentStore
46
45
  }
47
46
 
48
47
  // get the stream name that should have been stored previously
49
- const { streamName } = storage('legacy').getStore()
48
+ const { streamName } = store
50
49
 
51
50
  // extract DSM context after as we might not have a parent-child but may have a DSM context
52
51
  this.responseExtractDSMContext(
53
52
  request.operation, request.params, response, span || null, { streamName }
54
53
  )
55
54
  }
55
+
56
+ return store
56
57
  })
57
58
 
58
- this.addSub('apm:aws:response:finish:kinesis', err => {
59
- const { span } = storage('legacy').getStore()
60
- this.finish(span, null, err)
59
+ this.addSub('apm:aws:response:finish:kinesis', ctx => {
60
+ if (!ctx.needsFinish) return
61
+ this.finish(ctx)
61
62
  })
62
63
  }
63
64
 
@@ -72,11 +73,12 @@ class Kinesis extends BaseAwsSdkPlugin {
72
73
  }
73
74
 
74
75
  storeStreamName (params, operation, store) {
75
- if (!operation || (operation !== 'getShardIterator' && operation !== 'listShards')) return
76
- if (!params || !params.StreamName) return
76
+ if (!operation) return store
77
+ if (operation !== 'getShardIterator' && operation !== 'listShards') return store
78
+ if (!params || !params.StreamName) return store
77
79
 
78
80
  const streamName = params.StreamName
79
- storage('legacy').enterWith({ ...store, streamName })
81
+ return { ...store, streamName }
80
82
  }
81
83
 
82
84
  responseExtract (params, operation, response) {
@@ -4,7 +4,7 @@ const log = require('../../../dd-trace/src/log')
4
4
  const BaseAwsSdkPlugin = require('../base')
5
5
 
6
6
  class Lambda extends BaseAwsSdkPlugin {
7
- static get id () { return 'lambda' }
7
+ static id = 'lambda'
8
8
 
9
9
  generateTags (params, operation, response) {
10
10
  if (!params?.FunctionName) return {}
@@ -3,7 +3,7 @@
3
3
  const BaseAwsSdkPlugin = require('../base')
4
4
 
5
5
  class Redshift extends BaseAwsSdkPlugin {
6
- static get id () { return 'redshift' }
6
+ static id = 'redshift'
7
7
 
8
8
  generateTags (params, operation, response) {
9
9
  if (!params?.ClusterIdentifier) return {}
@@ -6,9 +6,9 @@ const { generatePointerHash } = require('../util')
6
6
  const { S3_PTR_KIND, SPAN_POINTER_DIRECTION } = require('../../../dd-trace/src/constants')
7
7
 
8
8
  class S3 extends BaseAwsSdkPlugin {
9
- static get id () { return 's3' }
10
- static get peerServicePrecursors () { return ['bucketname'] }
11
- static get isPayloadReporter () { return true }
9
+ static id = 's3'
10
+ static peerServicePrecursors = ['bucketname']
11
+ static isPayloadReporter = true
12
12
 
13
13
  generateTags (params, operation, response) {
14
14
  if (!params?.Bucket) return {}
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
  const Stepfunctions = require('./stepfunctions')
3
3
  class Sfn extends Stepfunctions {
4
- static get id () { return 'sfn' }
4
+ static id = 'sfn'
5
5
  }
6
6
 
7
7
  module.exports = Sfn
@@ -4,9 +4,9 @@ const log = require('../../../dd-trace/src/log')
4
4
  const BaseAwsSdkPlugin = require('../base')
5
5
 
6
6
  class Sns extends BaseAwsSdkPlugin {
7
- static get id () { return 'sns' }
8
- static get peerServicePrecursors () { return ['topicname'] }
9
- static get isPayloadReporter () { return true }
7
+ static id = 'sns'
8
+ static peerServicePrecursors = ['topicname']
9
+ static isPayloadReporter = true
10
10
 
11
11
  generateTags (params, operation, response) {
12
12
  if (!params) return {}
@@ -2,13 +2,12 @@
2
2
 
3
3
  const log = require('../../../dd-trace/src/log')
4
4
  const BaseAwsSdkPlugin = require('../base')
5
- const { storage } = require('../../../datadog-core')
6
5
  const { DsmPathwayCodec, getHeadersSize } = require('../../../dd-trace/src/datastreams')
7
6
 
8
7
  class Sqs extends BaseAwsSdkPlugin {
9
- static get id () { return 'sqs' }
10
- static get peerServicePrecursors () { return ['queuename'] }
11
- static get isPayloadReporter () { return true }
8
+ static id = 'sqs'
9
+ static peerServicePrecursors = ['queuename']
10
+ static isPayloadReporter = true
12
11
 
13
12
  constructor (...args) {
14
13
  super(...args)
@@ -17,36 +16,39 @@ class Sqs extends BaseAwsSdkPlugin {
17
16
  // in the base class
18
17
  this.requestTags = new WeakMap()
19
18
 
20
- this.addSub('apm:aws:response:start:sqs', obj => {
21
- const { request, response } = obj
22
- const store = storage('legacy').getStore()
19
+ this.addBind('apm:aws:response:start:sqs', ctx => {
20
+ const { request, response } = ctx
23
21
  const contextExtraction = this.responseExtract(request.params, request.operation, response)
22
+
23
+ let store = this._parentMap.get(request)
24
24
  let span
25
25
  let parsedMessageAttributes = null
26
26
  if (contextExtraction && contextExtraction.datadogContext) {
27
- obj.needsFinish = true
27
+ ctx.needsFinish = true
28
28
  const options = {
29
29
  childOf: contextExtraction.datadogContext,
30
- tags: {
30
+ meta: {
31
31
  ...this.requestTags.get(request),
32
32
  'span.kind': 'server'
33
33
  },
34
34
  integrationName: 'aws-sdk'
35
35
  }
36
36
  parsedMessageAttributes = contextExtraction.parsedAttributes
37
- span = this.tracer.startSpan('aws.response', options)
38
- this.enter(span, store)
37
+ span = this.startSpan('aws.response', options, ctx)
38
+ store = ctx.currentStore
39
39
  }
40
- // extract DSM context after as we might not have a parent-child but may have a DSM context
41
40
 
41
+ // extract DSM context after as we might not have a parent-child but may have a DSM context
42
42
  this.responseExtractDSMContext(
43
43
  request.operation, request.params, response, span || null, { parsedAttributes: parsedMessageAttributes }
44
44
  )
45
+
46
+ return store
45
47
  })
46
48
 
47
- this.addSub('apm:aws:response:finish:sqs', err => {
48
- const { span } = storage('legacy').getStore()
49
- this.finish(span, null, err)
49
+ this.addSub('apm:aws:response:finish:sqs', ctx => {
50
+ if (!ctx.needsFinish) return
51
+ this.finish(ctx)
50
52
  })
51
53
  }
52
54
 
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
  const Stepfunctions = require('./stepfunctions')
3
3
  class States extends Stepfunctions {
4
- static get id () { return 'states' }
4
+ static id = 'states'
5
5
  }
6
6
 
7
7
  module.exports = States
@@ -3,7 +3,7 @@ const log = require('../../../dd-trace/src/log')
3
3
  const BaseAwsSdkPlugin = require('../base')
4
4
 
5
5
  class Stepfunctions extends BaseAwsSdkPlugin {
6
- static get id () { return 'stepfunctions' }
6
+ static id = 'stepfunctions'
7
7
 
8
8
  // This is the shape of StartExecutionInput, as defined in
9
9
  // https://github.com/aws/aws-sdk-js/blob/master/apis/states-2016-11-23.normal.json
@@ -16,11 +16,11 @@ const triggerMap = {
16
16
  }
17
17
 
18
18
  class AzureFunctionsPlugin extends TracingPlugin {
19
- static get id () { return 'azure-functions' }
20
- static get operation () { return 'invoke' }
21
- static get kind () { return 'server' }
22
- static get type () { return 'serverless' }
23
- static get prefix () { return 'tracing:datadog:azure:functions:invoke' }
19
+ static id = 'azure-functions'
20
+ static operation = 'invoke'
21
+ static kind = 'server'
22
+ static type = 'serverless'
23
+ static prefix = 'tracing:datadog:azure:functions:invoke'
24
24
 
25
25
  bindStart (ctx) {
26
26
  const childOf = extractTraceContext(this._tracer, ctx)
@@ -4,7 +4,7 @@ const ProducerPlugin = require('./producer')
4
4
  const CompositePlugin = require('../../dd-trace/src/plugins/composite')
5
5
 
6
6
  class AzureServiceBusPlugin extends CompositePlugin {
7
- static get id () { return 'azure-service-bus' }
7
+ static id = 'azure-service-bus'
8
8
  static get plugins () {
9
9
  return {
10
10
  producer: ProducerPlugin
@@ -3,8 +3,8 @@
3
3
  const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
4
4
 
5
5
  class AzureServiceBusProducerPlugin extends ProducerPlugin {
6
- static get id () { return 'azure-service-bus' }
7
- static get operation () { return 'send' }
6
+ static id = 'azure-service-bus'
7
+ static operation = 'send'
8
8
 
9
9
  bindStart (ctx) {
10
10
  const { sender, msg } = ctx
@@ -1,10 +1,8 @@
1
1
  'use strict'
2
2
 
3
- const StructuredLogPlugin = require('../../dd-trace/src/plugins/structured_log_plugin')
3
+ const LogPlugin = require('../../dd-trace/src/plugins/log_plugin')
4
4
 
5
- class BunyanPlugin extends StructuredLogPlugin {
6
- static get id () {
7
- return 'bunyan'
8
- }
5
+ class BunyanPlugin extends LogPlugin {
6
+ static id = 'bunyan'
9
7
  }
10
8
  module.exports = BunyanPlugin
@@ -4,9 +4,9 @@ const DatabasePlugin = require('../../dd-trace/src/plugins/database')
4
4
  const CASSANDRA_CONTACT_POINTS_KEY = 'db.cassandra.contact.points'
5
5
 
6
6
  class CassandraDriverPlugin extends DatabasePlugin {
7
- static get id () { return 'cassandra-driver' }
8
- static get system () { return 'cassandra' }
9
- static get peerServicePrecursors () { return [CASSANDRA_CONTACT_POINTS_KEY] }
7
+ static id = 'cassandra-driver'
8
+ static system = 'cassandra'
9
+ static peerServicePrecursors = [CASSANDRA_CONTACT_POINTS_KEY]
10
10
 
11
11
  bindStart (ctx) {
12
12
  let { keyspace, query, contactPoints = {} } = ctx
@@ -28,8 +28,8 @@ function truncateCommand (cmdFields) {
28
28
  }
29
29
 
30
30
  class ChildProcessPlugin extends TracingPlugin {
31
- static get id () { return 'child_process' }
32
- static get prefix () { return 'tracing:datadog:child_process:execution' }
31
+ static id = 'child_process'
32
+ static prefix = 'tracing:datadog:child_process:execution'
33
33
 
34
34
  get tracer () {
35
35
  return this._tracer
@@ -3,9 +3,7 @@
3
3
  const KafkajsBatchConsumerPlugin = require('../../datadog-plugin-kafkajs/src/batch-consumer')
4
4
 
5
5
  class ConfluentKafkaJsBatchConsumerPlugin extends KafkajsBatchConsumerPlugin {
6
- static get id () {
7
- return 'confluentinc-kafka-javascript'
8
- }
6
+ static id = 'confluentinc-kafka-javascript'
9
7
  }
10
8
 
11
9
  module.exports = ConfluentKafkaJsBatchConsumerPlugin
@@ -3,9 +3,7 @@
3
3
  const KafkajsConsumerPlugin = require('../../datadog-plugin-kafkajs/src/consumer')
4
4
 
5
5
  class ConfluentKafkaJsConsumerPlugin extends KafkajsConsumerPlugin {
6
- static get id () {
7
- return 'confluentinc-kafka-javascript'
8
- }
6
+ static id = 'confluentinc-kafka-javascript'
9
7
  }
10
8
 
11
9
  module.exports = ConfluentKafkaJsConsumerPlugin
@@ -6,7 +6,7 @@ const BatchConsumerPlugin = require('./batch-consumer')
6
6
  const KafkajsPlugin = require('../../datadog-plugin-kafkajs/src/index')
7
7
 
8
8
  class ConfluentKafkaJsPlugin extends KafkajsPlugin {
9
- static get id () { return 'confluentinc-kafka-javascript' }
9
+ static id = 'confluentinc-kafka-javascript'
10
10
  static get plugins () {
11
11
  return {
12
12
  producer: ProducerPlugin,
@@ -3,9 +3,7 @@
3
3
  const KafkajsProducerPlugin = require('../../datadog-plugin-kafkajs/src/producer')
4
4
 
5
5
  class ConfluentKafkaJsProducerPlugin extends KafkajsProducerPlugin {
6
- static get id () {
7
- return 'confluentinc-kafka-javascript'
8
- }
6
+ static id = 'confluentinc-kafka-javascript'
9
7
  }
10
8
 
11
9
  module.exports = ConfluentKafkaJsProducerPlugin
@@ -3,9 +3,7 @@
3
3
  const RouterPlugin = require('../../datadog-plugin-router/src')
4
4
 
5
5
  class ConnectPlugin extends RouterPlugin {
6
- static get id () {
7
- return 'connect'
8
- }
6
+ static id = 'connect'
9
7
 
10
8
  constructor (...args) {
11
9
  super(...args)