dd-trace 5.81.0 → 5.82.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 (321) hide show
  1. package/index.d.ts +7 -0
  2. package/loader-hook.mjs +7 -2
  3. package/package.json +13 -18
  4. package/packages/datadog-core/src/utils/src/parse-tags.js +1 -1
  5. package/packages/datadog-esbuild/index.js +8 -7
  6. package/packages/datadog-esbuild/src/utils.js +14 -2
  7. package/packages/datadog-instrumentations/src/aerospike.js +3 -2
  8. package/packages/datadog-instrumentations/src/ai.js +2 -2
  9. package/packages/datadog-instrumentations/src/amqp10.js +1 -1
  10. package/packages/datadog-instrumentations/src/amqplib.js +4 -4
  11. package/packages/datadog-instrumentations/src/anthropic.js +2 -2
  12. package/packages/datadog-instrumentations/src/apollo-server-core.js +2 -2
  13. package/packages/datadog-instrumentations/src/apollo-server.js +1 -1
  14. package/packages/datadog-instrumentations/src/apollo.js +3 -2
  15. package/packages/datadog-instrumentations/src/avsc.js +1 -1
  16. package/packages/datadog-instrumentations/src/aws-sdk.js +1 -1
  17. package/packages/datadog-instrumentations/src/azure-event-hubs.js +4 -3
  18. package/packages/datadog-instrumentations/src/azure-functions.js +2 -2
  19. package/packages/datadog-instrumentations/src/azure-service-bus.js +3 -4
  20. package/packages/datadog-instrumentations/src/bluebird.js +1 -1
  21. package/packages/datadog-instrumentations/src/bullmq.js +11 -0
  22. package/packages/datadog-instrumentations/src/bunyan.js +1 -1
  23. package/packages/datadog-instrumentations/src/cassandra-driver.js +1 -1
  24. package/packages/datadog-instrumentations/src/child_process.js +2 -2
  25. package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +3 -3
  26. package/packages/datadog-instrumentations/src/couchbase.js +1 -1
  27. package/packages/datadog-instrumentations/src/crypto.js +1 -1
  28. package/packages/datadog-instrumentations/src/cucumber.js +12 -13
  29. package/packages/datadog-instrumentations/src/cypress.js +1 -1
  30. package/packages/datadog-instrumentations/src/dns.js +1 -1
  31. package/packages/datadog-instrumentations/src/elasticsearch.js +1 -1
  32. package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +1 -1
  33. package/packages/datadog-instrumentations/src/express.js +1 -1
  34. package/packages/datadog-instrumentations/src/fs.js +1 -1
  35. package/packages/datadog-instrumentations/src/generic-pool.js +1 -1
  36. package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +137 -15
  37. package/packages/datadog-instrumentations/src/google-cloud-vertexai.js +2 -3
  38. package/packages/datadog-instrumentations/src/google-genai.js +3 -3
  39. package/packages/datadog-instrumentations/src/graphql.js +1 -1
  40. package/packages/datadog-instrumentations/src/grpc/client.js +1 -1
  41. package/packages/datadog-instrumentations/src/grpc/server.js +1 -1
  42. package/packages/datadog-instrumentations/src/helpers/bundler-register.js +1 -1
  43. package/packages/datadog-instrumentations/src/helpers/hook.js +1 -1
  44. package/packages/datadog-instrumentations/src/helpers/hooks.js +4 -1
  45. package/packages/datadog-instrumentations/src/helpers/instrument.js +1 -1
  46. package/packages/datadog-instrumentations/src/helpers/register.js +6 -4
  47. package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +2 -2
  48. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/bullmq.json +106 -0
  49. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +2 -1
  50. package/packages/datadog-instrumentations/src/helpers/router-helper.js +1 -1
  51. package/packages/datadog-instrumentations/src/helpers/shared-utils.js +9 -0
  52. package/packages/datadog-instrumentations/src/hono.js +55 -10
  53. package/packages/datadog-instrumentations/src/ioredis.js +1 -1
  54. package/packages/datadog-instrumentations/src/iovalkey.js +1 -1
  55. package/packages/datadog-instrumentations/src/jest.js +2 -2
  56. package/packages/datadog-instrumentations/src/kafkajs.js +3 -3
  57. package/packages/datadog-instrumentations/src/knex.js +1 -1
  58. package/packages/datadog-instrumentations/src/ldapjs.js +1 -1
  59. package/packages/datadog-instrumentations/src/light-my-request.js +93 -0
  60. package/packages/datadog-instrumentations/src/limitd-client.js +1 -1
  61. package/packages/datadog-instrumentations/src/lodash.js +1 -2
  62. package/packages/datadog-instrumentations/src/mariadb.js +1 -2
  63. package/packages/datadog-instrumentations/src/memcached.js +1 -1
  64. package/packages/datadog-instrumentations/src/mongodb-core.js +1 -1
  65. package/packages/datadog-instrumentations/src/mongodb.js +1 -1
  66. package/packages/datadog-instrumentations/src/mongoose.js +1 -1
  67. package/packages/datadog-instrumentations/src/mquery.js +1 -1
  68. package/packages/datadog-instrumentations/src/mysql.js +1 -1
  69. package/packages/datadog-instrumentations/src/mysql2.js +1 -1
  70. package/packages/datadog-instrumentations/src/net.js +1 -1
  71. package/packages/datadog-instrumentations/src/next.js +1 -1
  72. package/packages/datadog-instrumentations/src/nyc.js +1 -1
  73. package/packages/datadog-instrumentations/src/openai.js +2 -2
  74. package/packages/datadog-instrumentations/src/opensearch.js +1 -1
  75. package/packages/datadog-instrumentations/src/oracledb.js +1 -1
  76. package/packages/datadog-instrumentations/src/otel-sdk-trace.js +1 -1
  77. package/packages/datadog-instrumentations/src/pg.js +3 -3
  78. package/packages/datadog-instrumentations/src/pino.js +1 -1
  79. package/packages/datadog-instrumentations/src/playwright.js +1 -1
  80. package/packages/datadog-instrumentations/src/prisma.js +52 -37
  81. package/packages/datadog-instrumentations/src/process.js +1 -1
  82. package/packages/datadog-instrumentations/src/promise-js.js +1 -1
  83. package/packages/datadog-instrumentations/src/promise.js +1 -1
  84. package/packages/datadog-instrumentations/src/protobufjs.js +1 -1
  85. package/packages/datadog-instrumentations/src/q.js +1 -1
  86. package/packages/datadog-instrumentations/src/redis.js +1 -1
  87. package/packages/datadog-instrumentations/src/rhea.js +1 -1
  88. package/packages/datadog-instrumentations/src/selenium.js +1 -1
  89. package/packages/datadog-instrumentations/src/sequelize.js +1 -2
  90. package/packages/datadog-instrumentations/src/sharedb.js +1 -1
  91. package/packages/datadog-instrumentations/src/tedious.js +1 -1
  92. package/packages/datadog-instrumentations/src/undici.js +4 -4
  93. package/packages/datadog-instrumentations/src/url.js +1 -1
  94. package/packages/datadog-instrumentations/src/vitest.js +1 -1
  95. package/packages/datadog-instrumentations/src/vm.js +1 -1
  96. package/packages/datadog-instrumentations/src/when.js +1 -1
  97. package/packages/datadog-instrumentations/src/winston.js +1 -1
  98. package/packages/datadog-instrumentations/src/ws.js +3 -2
  99. package/packages/datadog-plugin-amqp10/src/index.js +1 -1
  100. package/packages/datadog-plugin-amqplib/src/index.js +1 -1
  101. package/packages/datadog-plugin-anthropic/src/index.js +1 -1
  102. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +1 -1
  103. package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +4 -4
  104. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -2
  105. package/packages/datadog-plugin-aws-sdk/src/util.js +3 -3
  106. package/packages/datadog-plugin-azure-event-hubs/src/index.js +1 -1
  107. package/packages/datadog-plugin-azure-event-hubs/src/producer.js +19 -5
  108. package/packages/datadog-plugin-azure-service-bus/src/index.js +1 -1
  109. package/packages/datadog-plugin-azure-service-bus/src/producer.js +4 -0
  110. package/packages/datadog-plugin-bullmq/src/consumer.js +60 -0
  111. package/packages/datadog-plugin-bullmq/src/index.js +18 -0
  112. package/packages/datadog-plugin-bullmq/src/producer.js +178 -0
  113. package/packages/datadog-plugin-confluentinc-kafka-javascript/src/index.js +1 -1
  114. package/packages/datadog-plugin-cypress/src/plugin.js +1 -1
  115. package/packages/datadog-plugin-express/src/index.js +1 -1
  116. package/packages/datadog-plugin-fastify/src/index.js +1 -1
  117. package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +13 -3
  118. package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +171 -12
  119. package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +1 -2
  120. package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +160 -13
  121. package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +217 -0
  122. package/packages/datadog-plugin-google-cloud-vertexai/src/index.js +1 -1
  123. package/packages/datadog-plugin-google-genai/src/index.js +1 -1
  124. package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
  125. package/packages/datadog-plugin-grpc/src/index.js +1 -1
  126. package/packages/datadog-plugin-http/src/client.js +2 -1
  127. package/packages/datadog-plugin-http/src/index.js +25 -5
  128. package/packages/datadog-plugin-http2/src/client.js +2 -2
  129. package/packages/datadog-plugin-http2/src/index.js +1 -1
  130. package/packages/datadog-plugin-kafkajs/src/index.js +1 -1
  131. package/packages/datadog-plugin-langchain/src/index.js +1 -1
  132. package/packages/datadog-plugin-moleculer/src/index.js +1 -1
  133. package/packages/datadog-plugin-mongodb-core/src/index.js +6 -2
  134. package/packages/datadog-plugin-openai/src/index.js +1 -1
  135. package/packages/datadog-plugin-openai/src/stream-helpers.js +30 -10
  136. package/packages/datadog-plugin-openai/src/tracing.js +2 -2
  137. package/packages/datadog-plugin-rhea/src/index.js +1 -1
  138. package/packages/datadog-plugin-ws/src/close.js +56 -3
  139. package/packages/datadog-plugin-ws/src/index.js +4 -0
  140. package/packages/datadog-plugin-ws/src/producer.js +39 -4
  141. package/packages/datadog-plugin-ws/src/receiver.js +39 -3
  142. package/packages/datadog-plugin-ws/src/server.js +13 -1
  143. package/packages/datadog-plugin-ws/src/util.js +107 -0
  144. package/packages/datadog-shimmer/src/shimmer.js +2 -2
  145. package/packages/dd-trace/src/aiguard/sdk.js +3 -3
  146. package/packages/dd-trace/src/appsec/graphql.js +2 -2
  147. package/packages/dd-trace/src/appsec/iast/analyzers/code-injection-analyzer.js +1 -1
  148. package/packages/dd-trace/src/appsec/iast/analyzers/command-injection-analyzer.js +1 -1
  149. package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +1 -1
  150. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-base-analyzer.js +1 -1
  151. package/packages/dd-trace/src/appsec/iast/analyzers/injection-analyzer.js +1 -1
  152. package/packages/dd-trace/src/appsec/iast/analyzers/ldap-injection-analyzer.js +1 -1
  153. package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +3 -3
  154. package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +1 -1
  155. package/packages/dd-trace/src/appsec/iast/analyzers/ssrf-analyzer.js +1 -1
  156. package/packages/dd-trace/src/appsec/iast/analyzers/untrusted-deserialization-analyzer.js +1 -1
  157. package/packages/dd-trace/src/appsec/iast/analyzers/unvalidated-redirect-analyzer.js +1 -1
  158. package/packages/dd-trace/src/appsec/iast/analyzers/weak-cipher-analyzer.js +1 -1
  159. package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +3 -2
  160. package/packages/dd-trace/src/appsec/iast/analyzers/weak-randomness-analyzer.js +1 -1
  161. package/packages/dd-trace/src/appsec/iast/iast-plugin.js +3 -3
  162. package/packages/dd-trace/src/appsec/iast/index.js +5 -5
  163. package/packages/dd-trace/src/appsec/iast/security-controls/index.js +1 -1
  164. package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +1 -2
  165. package/packages/dd-trace/src/appsec/iast/taint-tracking/operations-taint-object.js +1 -1
  166. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -1
  167. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +10 -14
  168. package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +1 -1
  169. package/packages/dd-trace/src/appsec/iast/telemetry/namespaces.js +1 -1
  170. package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +3 -3
  171. package/packages/dd-trace/src/appsec/index.js +8 -8
  172. package/packages/dd-trace/src/appsec/rasp/command_injection.js +1 -1
  173. package/packages/dd-trace/src/appsec/rasp/index.js +1 -1
  174. package/packages/dd-trace/src/appsec/rasp/lfi.js +1 -1
  175. package/packages/dd-trace/src/appsec/rc-products.js +10 -0
  176. package/packages/dd-trace/src/appsec/recommended.json +230 -3
  177. package/packages/dd-trace/src/appsec/remote_config.js +177 -0
  178. package/packages/dd-trace/src/appsec/reporter.js +3 -3
  179. package/packages/dd-trace/src/appsec/rule_manager.js +37 -20
  180. package/packages/dd-trace/src/appsec/sdk/index.js +1 -1
  181. package/packages/dd-trace/src/appsec/sdk/set_user.js +1 -1
  182. package/packages/dd-trace/src/appsec/sdk/track_event.js +2 -2
  183. package/packages/dd-trace/src/appsec/sdk/user_blocking.js +2 -2
  184. package/packages/dd-trace/src/appsec/user_tracking.js +2 -2
  185. package/packages/dd-trace/src/appsec/waf/index.js +17 -3
  186. package/packages/dd-trace/src/appsec/waf/waf_manager.js +11 -0
  187. package/packages/dd-trace/src/azure_metadata.js +8 -2
  188. package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +6 -0
  189. package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +2 -2
  190. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +1 -1
  191. package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +1 -1
  192. package/packages/dd-trace/src/config/remote_config.js +34 -0
  193. package/packages/dd-trace/src/config.js +29 -28
  194. package/packages/dd-trace/src/config_defaults.js +2 -1
  195. package/packages/dd-trace/src/constants.js +5 -0
  196. package/packages/dd-trace/src/crashtracking/crashtracker.js +10 -1
  197. package/packages/dd-trace/src/datastreams/checkpointer.js +2 -2
  198. package/packages/dd-trace/src/datastreams/index.js +1 -1
  199. package/packages/dd-trace/src/datastreams/pathway.js +7 -7
  200. package/packages/dd-trace/src/datastreams/processor.js +2 -2
  201. package/packages/dd-trace/src/datastreams/writer.js +2 -2
  202. package/packages/dd-trace/src/debugger/config.js +1 -0
  203. package/packages/dd-trace/src/debugger/devtools_client/config.js +1 -1
  204. package/packages/dd-trace/src/debugger/devtools_client/index.js +7 -2
  205. package/packages/dd-trace/src/debugger/devtools_client/send.js +3 -3
  206. package/packages/dd-trace/src/debugger/devtools_client/session.js +1 -1
  207. package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +5 -5
  208. package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +2 -2
  209. package/packages/dd-trace/src/debugger/devtools_client/state.js +1 -1
  210. package/packages/dd-trace/src/debugger/devtools_client/status.js +2 -2
  211. package/packages/dd-trace/src/debugger/index.js +1 -1
  212. package/packages/dd-trace/src/dogstatsd.js +3 -2
  213. package/packages/dd-trace/src/encode/0.4.js +1 -1
  214. package/packages/dd-trace/src/encode/agentless-ci-visibility.js +2 -2
  215. package/packages/dd-trace/src/encode/coverage-ci-visibility.js +1 -1
  216. package/packages/dd-trace/src/encode/span-stats.js +6 -1
  217. package/packages/dd-trace/src/exporter.js +2 -2
  218. package/packages/dd-trace/src/exporters/agent/index.js +1 -1
  219. package/packages/dd-trace/src/exporters/common/agent-info-exporter.js +1 -1
  220. package/packages/dd-trace/src/exporters/common/request.js +2 -2
  221. package/packages/dd-trace/src/exporters/common/writer.js +1 -1
  222. package/packages/dd-trace/src/exporters/span-stats/index.js +1 -1
  223. package/packages/dd-trace/src/external-logger/src/index.js +1 -2
  224. package/packages/dd-trace/src/flare/index.js +1 -1
  225. package/packages/dd-trace/src/guardrails/index.js +6 -3
  226. package/packages/dd-trace/src/id.js +1 -1
  227. package/packages/dd-trace/src/index.js +1 -1
  228. package/packages/dd-trace/src/lambda/handler.js +4 -4
  229. package/packages/dd-trace/src/lambda/index.js +1 -1
  230. package/packages/dd-trace/src/lambda/runtime/patch.js +4 -4
  231. package/packages/dd-trace/src/lambda/runtime/ritm.js +1 -1
  232. package/packages/dd-trace/src/llmobs/constants/tags.js +7 -1
  233. package/packages/dd-trace/src/llmobs/index.js +8 -9
  234. package/packages/dd-trace/src/llmobs/plugins/ai/index.js +38 -7
  235. package/packages/dd-trace/src/llmobs/plugins/ai/util.js +30 -9
  236. package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +3 -3
  237. package/packages/dd-trace/src/llmobs/plugins/genai/util.js +2 -2
  238. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +1 -1
  239. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +1 -1
  240. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/embedding.js +1 -1
  241. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/llm.js +1 -1
  242. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +1 -1
  243. package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +16 -0
  244. package/packages/dd-trace/src/llmobs/plugins/openai/index.js +16 -1
  245. package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +22 -10
  246. package/packages/dd-trace/src/llmobs/plugins/vertexai.js +1 -1
  247. package/packages/dd-trace/src/llmobs/sdk.js +15 -22
  248. package/packages/dd-trace/src/llmobs/span_processor.js +9 -13
  249. package/packages/dd-trace/src/llmobs/telemetry.js +3 -4
  250. package/packages/dd-trace/src/llmobs/writers/base.js +2 -2
  251. package/packages/dd-trace/src/llmobs/writers/spans.js +1 -2
  252. package/packages/dd-trace/src/log/index.js +1 -1
  253. package/packages/dd-trace/src/noop/proxy.js +2 -2
  254. package/packages/dd-trace/src/noop/span.js +1 -1
  255. package/packages/dd-trace/src/openfeature/index.js +2 -2
  256. package/packages/dd-trace/src/openfeature/noop.js +14 -14
  257. package/packages/dd-trace/src/openfeature/remote_config.js +31 -0
  258. package/packages/dd-trace/src/openfeature/writers/base.js +5 -5
  259. package/packages/dd-trace/src/openfeature/writers/exposures.js +9 -9
  260. package/packages/dd-trace/src/opentelemetry/context_manager.js +2 -2
  261. package/packages/dd-trace/src/opentelemetry/logs/logger.js +1 -1
  262. package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +4 -4
  263. package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +9 -8
  264. package/packages/dd-trace/src/opentelemetry/metrics/instruments.js +3 -3
  265. package/packages/dd-trace/src/opentelemetry/metrics/meter.js +2 -2
  266. package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +4 -4
  267. package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +36 -11
  268. package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +11 -10
  269. package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +1 -1
  270. package/packages/dd-trace/src/opentelemetry/span.js +2 -2
  271. package/packages/dd-trace/src/opentelemetry/tracer.js +3 -3
  272. package/packages/dd-trace/src/opentracing/propagation/text_map.js +24 -8
  273. package/packages/dd-trace/src/opentracing/span.js +3 -3
  274. package/packages/dd-trace/src/opentracing/tracer.js +5 -5
  275. package/packages/dd-trace/src/payload-tagging/index.js +6 -2
  276. package/packages/dd-trace/src/plugin_manager.js +1 -1
  277. package/packages/dd-trace/src/plugins/apollo.js +1 -1
  278. package/packages/dd-trace/src/plugins/ci_plugin.js +27 -27
  279. package/packages/dd-trace/src/plugins/database.js +1 -1
  280. package/packages/dd-trace/src/plugins/index.js +5 -1
  281. package/packages/dd-trace/src/plugins/log_plugin.js +1 -1
  282. package/packages/dd-trace/src/plugins/outbound.js +1 -1
  283. package/packages/dd-trace/src/plugins/tracing.js +1 -1
  284. package/packages/dd-trace/src/plugins/util/ci.js +1 -1
  285. package/packages/dd-trace/src/plugins/util/git.js +8 -8
  286. package/packages/dd-trace/src/plugins/util/stacktrace.js +1 -1
  287. package/packages/dd-trace/src/plugins/util/test.js +24 -24
  288. package/packages/dd-trace/src/plugins/util/user-provided-git.js +1 -1
  289. package/packages/dd-trace/src/plugins/util/web.js +8 -5
  290. package/packages/dd-trace/src/priority_sampler.js +15 -16
  291. package/packages/dd-trace/src/process-tags/index.js +31 -29
  292. package/packages/dd-trace/src/profiling/config.js +32 -21
  293. package/packages/dd-trace/src/profiling/exporter_cli.js +4 -4
  294. package/packages/dd-trace/src/profiling/exporters/agent.js +5 -5
  295. package/packages/dd-trace/src/profiling/index.js +1 -1
  296. package/packages/dd-trace/src/profiling/libuv-size.js +1 -1
  297. package/packages/dd-trace/src/profiling/profiler.js +4 -5
  298. package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +1 -1
  299. package/packages/dd-trace/src/profiling/profilers/events.js +2 -2
  300. package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
  301. package/packages/dd-trace/src/proxy.js +12 -18
  302. package/packages/dd-trace/src/remote_config/index.js +541 -137
  303. package/packages/dd-trace/src/require-package-json.js +1 -1
  304. package/packages/dd-trace/src/ritm.js +50 -27
  305. package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +1 -1
  306. package/packages/dd-trace/src/serverless.js +16 -0
  307. package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +8 -0
  308. package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +8 -0
  309. package/packages/dd-trace/src/span_format.js +1 -1
  310. package/packages/dd-trace/src/span_processor.js +2 -2
  311. package/packages/dd-trace/src/span_stats.js +6 -4
  312. package/packages/dd-trace/src/standalone/index.js +1 -1
  313. package/packages/dd-trace/src/startup-log.js +3 -3
  314. package/packages/dd-trace/src/supported-configurations.json +3 -0
  315. package/packages/dd-trace/src/telemetry/dependencies.js +3 -3
  316. package/packages/dd-trace/src/telemetry/endpoints.js +8 -8
  317. package/packages/dd-trace/src/telemetry/logs/index.js +1 -1
  318. package/packages/dd-trace/src/telemetry/telemetry.js +11 -6
  319. package/packages/dd-trace/src/tracer.js +3 -3
  320. package/packages/dd-trace/src/tracer_metadata.js +19 -15
  321. package/packages/dd-trace/src/remote_config/manager.js +0 -368
@@ -1,10 +1,10 @@
1
1
  'use strict'
2
2
 
3
+ const shimmer = require('../../datadog-shimmer')
3
4
  const {
4
5
  channel,
5
6
  addHook
6
7
  } = require('./helpers/instrument')
7
- const shimmer = require('../../datadog-shimmer')
8
8
 
9
9
  addHook({ name: 'tedious', versions: ['>=1.0.0'] }, tedious => {
10
10
  const startCh = channel('apm:tedious:request:start')
@@ -1,15 +1,15 @@
1
1
  'use strict'
2
2
 
3
+ const tracingChannel = require('dc-polyfill').tracingChannel
4
+
5
+ const shimmer = require('../../datadog-shimmer')
3
6
  const {
4
7
  addHook
5
8
  } = require('./helpers/instrument')
6
- const shimmer = require('../../datadog-shimmer')
9
+ const { createWrapFetch } = require('./helpers/fetch')
7
10
 
8
- const tracingChannel = require('dc-polyfill').tracingChannel
9
11
  const ch = tracingChannel('apm:undici:fetch')
10
12
 
11
- const { createWrapFetch } = require('./helpers/fetch')
12
-
13
13
  addHook({
14
14
  name: 'undici',
15
15
  versions: ['^4.4.1', '5', '>=6.0.0']
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- const { addHook, channel } = require('./helpers/instrument')
4
3
  const shimmer = require('../../datadog-shimmer')
4
+ const { addHook, channel } = require('./helpers/instrument')
5
5
  const names = ['url', 'node:url']
6
6
 
7
7
  const parseFinishedChannel = channel('datadog:url:parse:finish')
@@ -1,12 +1,12 @@
1
1
  'use strict'
2
2
 
3
- const { addHook, channel } = require('./helpers/instrument')
4
3
  const shimmer = require('../../datadog-shimmer')
5
4
  const log = require('../../dd-trace/src/log')
6
5
  const {
7
6
  VITEST_WORKER_TRACE_PAYLOAD_CODE,
8
7
  VITEST_WORKER_LOGS_PAYLOAD_CODE
9
8
  } = require('../../dd-trace/src/plugins/util/test')
9
+ const { addHook, channel } = require('./helpers/instrument')
10
10
 
11
11
  // test hooks
12
12
  const testStartCh = channel('ci:vitest:test:start')
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- const { channel, addHook } = require('./helpers/instrument')
4
3
  const shimmer = require('../../datadog-shimmer')
4
+ const { channel, addHook } = require('./helpers/instrument')
5
5
  const names = ['vm', 'node:vm']
6
6
 
7
7
  const runScriptStartChannel = channel('datadog:vm:run-script:start')
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
+ const shimmer = require('../../datadog-shimmer')
3
4
  const { addHook } = require('./helpers/instrument')
4
5
  const { wrapThen } = require('./helpers/promise')
5
- const shimmer = require('../../datadog-shimmer')
6
6
 
7
7
  addHook({
8
8
  name: 'when',
@@ -1,10 +1,10 @@
1
1
  'use strict'
2
2
 
3
+ const shimmer = require('../../datadog-shimmer')
3
4
  const {
4
5
  channel,
5
6
  addHook
6
7
  } = require('./helpers/instrument')
7
- const shimmer = require('../../datadog-shimmer')
8
8
 
9
9
  const patched = new WeakSet()
10
10
 
@@ -1,12 +1,13 @@
1
1
  'use strict'
2
2
 
3
+ const tracingChannel = require('dc-polyfill').tracingChannel
4
+
5
+ const shimmer = require('../../datadog-shimmer')
3
6
  const {
4
7
  addHook,
5
8
  channel
6
9
  } = require('./helpers/instrument')
7
- const shimmer = require('../../datadog-shimmer')
8
10
 
9
- const tracingChannel = require('dc-polyfill').tracingChannel
10
11
  const serverCh = tracingChannel('ws:server:connect')
11
12
  const producerCh = tracingChannel('ws:send')
12
13
  const receiverCh = tracingChannel('ws:receive')
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
+ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
3
4
  const ProducerPlugin = require('./producer')
4
5
  const ConsumerPlugin = require('./consumer')
5
- const CompositePlugin = require('../../dd-trace/src/plugins/composite')
6
6
 
7
7
  class Amqp10Plugin extends CompositePlugin {
8
8
  static id = 'amqp10'
@@ -1,9 +1,9 @@
1
1
  'use strict'
2
2
 
3
+ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
3
4
  const ProducerPlugin = require('./producer')
4
5
  const ConsumerPlugin = require('./consumer')
5
6
  const ClientPlugin = require('./client')
6
- 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 {
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
3
  const CompositePlugin = require('../../dd-trace/src/plugins/composite')
4
- const AnthropicTracingPlugin = require('./tracing')
5
4
  const AnthropicLLMObsPlugin = require('../../dd-trace/src/llmobs/plugins/anthropic')
5
+ const AnthropicTracingPlugin = require('./tracing')
6
6
 
7
7
  class AnthropicPlugin extends CompositePlugin {
8
8
  static id = 'anthropic'
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
3
  const CompositePlugin = require('../../../../dd-trace/src/plugins/composite')
4
- const BedrockRuntimeTracing = require('./tracing')
5
4
  const BedrockRuntimeLLMObsPlugin = require('../../../../dd-trace/src/llmobs/plugins/bedrockruntime')
5
+ const BedrockRuntimeTracing = require('./tracing')
6
6
  class BedrockRuntimePlugin extends CompositePlugin {
7
7
  static id = 'bedrockruntime'
8
8
 
@@ -109,7 +109,7 @@ class DynamoDb extends BaseAwsSdkPlugin {
109
109
  /**
110
110
  * Parses primary key config from the `DD_TRACE_DYNAMODB_TABLE_PRIMARY_KEYS` env var.
111
111
  * Only runs when needed, and warns when missing or invalid config.
112
- * @returns {Object|undefined} Parsed config from env var or undefined if empty/missing/invalid config.
112
+ * @returns {object | undefined} Parsed config from env var or undefined if empty/missing/invalid config.
113
113
  */
114
114
  getPrimaryKeyConfig () {
115
115
  if (this.dynamoPrimaryKeyConfig) {
@@ -151,8 +151,8 @@ class DynamoDb extends BaseAwsSdkPlugin {
151
151
  /**
152
152
  * Calculates a hash for DynamoDB PutItem operations using table's configured primary keys.
153
153
  * @param {string} tableName - Name of the DynamoDB table.
154
- * @param {Object} item - Complete PutItem item parameter to be put.
155
- * @param {Object.<string, Array<string>>} primaryKeyConfig - Mapping of table names to an Array of primary key names
154
+ * @param {object} item - Complete PutItem item parameter to be put.
155
+ * @param {Record<string, Array<string>>} primaryKeyConfig - Mapping of table names to an Array of primary key names
156
156
  * loaded from DD_TRACE_DYNAMODB_TABLE_PRIMARY_KEYS.
157
157
  * @returns {string|undefined} Hash combining table name and primary key/value pairs, or undefined if unable.
158
158
  */
@@ -174,7 +174,7 @@ class DynamoDb extends BaseAwsSdkPlugin {
174
174
  /**
175
175
  * Calculates a hash for DynamoDB operations that have keys provided (UpdateItem, DeleteItem).
176
176
  * @param {string} tableName - Name of the DynamoDB table.
177
- * @param {Object} keysObject - Object containing primary key/value attributes in DynamoDB format.
177
+ * @param {object} keysObject - Object containing primary key/value attributes in DynamoDB format.
178
178
  * (e.g., { userId: { S: "123" }, sortKey: { N: "456" } })
179
179
  * @returns {string|undefined} Hash value combining table name and primary key/value pairs, or undefined if unable.
180
180
  *
@@ -18,8 +18,8 @@ class EventBridge extends BaseAwsSdkPlugin {
18
18
 
19
19
  /**
20
20
  * requestInject
21
- * @param {*} span
22
- * @param {*} request
21
+ * @param {import('../../../..').Span} span
22
+ * @param {object} request
23
23
  *
24
24
  * Docs: https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutEventsRequestEntry.html
25
25
  * We cannot use the traceHeader field as that's reserved for X-Ray.
@@ -18,7 +18,7 @@ function generatePointerHash (components) {
18
18
 
19
19
  /**
20
20
  * Encodes a DynamoDB attribute value to Buffer for span pointer hashing.
21
- * @param {Object} valueObject - DynamoDB value in AWS format ({ S: string } or { N: string } or { B: Buffer })
21
+ * @param {object} valueObject - DynamoDB value in AWS format ({ S: string } or { N: string } or { B: Buffer })
22
22
  * @returns {Buffer|undefined} Encoded value as Buffer, or undefined if invalid input.
23
23
  *
24
24
  * @example
@@ -55,7 +55,7 @@ function encodeValue (valueObject) {
55
55
  * Handles tables with single-key and two-key scenarios.
56
56
  *
57
57
  * @param {Array<string>} keyNames - Set of primary key names.
58
- * @param {Object} keyValuePairs - Object containing key/value pairs.
58
+ * @param {object} keyValuePairs - Object containing key/value pairs.
59
59
  * @returns {Array|undefined} [key1Name, key1Value, key2Name, key2Value], or undefined if invalid input.
60
60
  * key2 entries are empty strings in the single-key case.
61
61
  * @example
@@ -90,7 +90,7 @@ const extractPrimaryKeys = (keyNames, keyValuePairs) => {
90
90
  * Automatically detects AWS partitions (standard, China, GovCloud) from region.
91
91
  *
92
92
  * @param {string} queueURL - SQS queue URL in any supported format
93
- * @returns {Object|null} Object with queueName and arn, or null if URL format is invalid
93
+ * @returns {object | null} Object with queueName and arn, or null if URL format is invalid
94
94
  *
95
95
  * @example
96
96
  * // Modern AWS SQS URLs
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- const ProducerPlugin = require('./producer')
4
3
  const CompositePlugin = require('../../dd-trace/src/plugins/composite')
4
+ const ProducerPlugin = require('./producer')
5
5
 
6
6
  class AzureEventHubsPlugin extends CompositePlugin {
7
7
  static get id () { return 'azure-event-hubs' }
@@ -3,6 +3,8 @@
3
3
  const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
4
4
  const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
5
5
 
6
+ const spanContexts = new WeakMap()
7
+
6
8
  class AzureEventHubsProducerPlugin extends ProducerPlugin {
7
9
  static get id () { return 'azure-event-hubs' }
8
10
  static get operation () { return 'send' }
@@ -36,7 +38,12 @@ class AzureEventHubsProducerPlugin extends ProducerPlugin {
36
38
  }
37
39
 
38
40
  if (batchLinksAreEnabled()) {
39
- ctx.batch._spanContexts.push(span.context())
41
+ const spanContext = spanContexts.get(ctx.batch)
42
+ if (spanContext) {
43
+ spanContext.push(span.context())
44
+ } else {
45
+ spanContexts.set(ctx.batch, [span.context()])
46
+ }
40
47
  injectTraceContext(this.tracer, span, ctx.eventData)
41
48
  }
42
49
  }
@@ -53,9 +60,12 @@ class AzureEventHubsProducerPlugin extends ProducerPlugin {
53
60
  })
54
61
  } else {
55
62
  if (batchLinksAreEnabled()) {
56
- eventData._spanContexts.forEach(spanContext => {
57
- span.addLink(spanContext)
58
- })
63
+ const contexts = spanContexts.get(eventData)
64
+ if (contexts) {
65
+ for (const spanContext of contexts) {
66
+ span.addLink(spanContext)
67
+ }
68
+ }
59
69
  }
60
70
  }
61
71
  }
@@ -63,7 +73,11 @@ class AzureEventHubsProducerPlugin extends ProducerPlugin {
63
73
  }
64
74
 
65
75
  asyncEnd (ctx) {
66
- super.finish()
76
+ super.finish(ctx)
77
+ }
78
+
79
+ end (ctx) {
80
+ super.finish(ctx)
67
81
  }
68
82
  }
69
83
 
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- const ProducerPlugin = require('./producer')
4
3
  const CompositePlugin = require('../../dd-trace/src/plugins/composite')
4
+ const ProducerPlugin = require('./producer')
5
5
 
6
6
  class AzureServiceBusPlugin extends CompositePlugin {
7
7
  static get id () { return 'azure-service-bus' }
@@ -75,6 +75,10 @@ class AzureServiceBusProducerPlugin extends ProducerPlugin {
75
75
  asyncEnd (ctx) {
76
76
  super.finish(ctx)
77
77
  }
78
+
79
+ end (ctx) {
80
+ super.finish(ctx)
81
+ }
78
82
  }
79
83
 
80
84
  function injectTraceContext (tracer, span, msg) {
@@ -0,0 +1,60 @@
1
+ 'use strict'
2
+
3
+ const ConsumerPlugin = require('../../dd-trace/src/plugins/consumer')
4
+ const { getMessageSize } = require('../../dd-trace/src/datastreams')
5
+
6
+ class BullmqConsumerPlugin extends ConsumerPlugin {
7
+ static id = 'bullmq'
8
+ static prefix = 'tracing:orchestrion:bullmq:Worker_callProcessJob'
9
+
10
+ asyncEnd (ctx) {
11
+ ctx.currentStore?.span?.finish()
12
+ }
13
+
14
+ bindStart (ctx) {
15
+ const job = ctx.arguments?.[0]
16
+ const queueName = job?.queueName || job?.queue?.name || 'bullmq'
17
+
18
+ let childOf
19
+ const datadogContext = job?.data?._datadog
20
+ if (datadogContext) {
21
+ childOf = this.tracer.extract('text_map', datadogContext)
22
+ }
23
+
24
+ const span = this.startSpan({
25
+ childOf,
26
+ resource: queueName,
27
+ meta: {
28
+ component: 'bullmq',
29
+ 'span.kind': 'consumer',
30
+ 'messaging.system': 'bullmq',
31
+ 'messaging.destination.name': queueName,
32
+ 'messaging.operation': 'process'
33
+ }
34
+ }, ctx)
35
+
36
+ if (this.config.dsmEnabled) {
37
+ this.setConsumerCheckpoint(span, ctx)
38
+ }
39
+
40
+ return ctx.currentStore
41
+ }
42
+
43
+ setConsumerCheckpoint (span, ctx) {
44
+ const job = ctx.arguments?.[0]
45
+ if (!job) return
46
+
47
+ const queueName = job.queueName || job.queue?.name || 'bullmq'
48
+ const payloadSize = job.data ? getMessageSize(job.data) : 0
49
+
50
+ const datadogContext = job.data?._datadog
51
+ if (datadogContext) {
52
+ this.tracer.decodeDataStreamsContext(datadogContext)
53
+ }
54
+
55
+ const edgeTags = ['direction:in', `topic:${queueName}`, 'type:bullmq']
56
+ this.tracer.setCheckpoint(edgeTags, span, payloadSize)
57
+ }
58
+ }
59
+
60
+ module.exports = BullmqConsumerPlugin
@@ -0,0 +1,18 @@
1
+ 'use strict'
2
+
3
+ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
4
+ const BullmqProducerPlugins = require('./producer')
5
+ const BullmqConsumerPlugin = require('./consumer')
6
+
7
+ class BullmqPlugin extends CompositePlugin {
8
+ static id = 'bullmq'
9
+
10
+ static plugins = {
11
+ queueAdd: BullmqProducerPlugins[0],
12
+ queueAddBulk: BullmqProducerPlugins[1],
13
+ flowProducerAdd: BullmqProducerPlugins[2],
14
+ consumer: BullmqConsumerPlugin
15
+ }
16
+ }
17
+
18
+ module.exports = BullmqPlugin
@@ -0,0 +1,178 @@
1
+ 'use strict'
2
+
3
+ const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
4
+ const { DsmPathwayCodec, getMessageSize } = require('../../dd-trace/src/datastreams')
5
+
6
+ class BaseBullmqProducerPlugin extends ProducerPlugin {
7
+ static id = 'bullmq'
8
+
9
+ asyncEnd (ctx) {
10
+ ctx.currentStore?.span?.finish()
11
+ }
12
+
13
+ bindStart (ctx) {
14
+ const { resource, meta } = this.getSpanData(ctx)
15
+ const span = this.startSpan({
16
+ resource,
17
+ meta: {
18
+ component: 'bullmq',
19
+ 'span.kind': 'producer',
20
+ 'messaging.system': 'bullmq',
21
+ 'messaging.operation': 'publish',
22
+ ...meta
23
+ }
24
+ }, ctx)
25
+
26
+ this.injectTraceContext(span, ctx)
27
+
28
+ if (this.config.dsmEnabled) {
29
+ this.setProducerCheckpoint(span, ctx)
30
+ }
31
+
32
+ return ctx.currentStore
33
+ }
34
+
35
+ getSpanData (ctx) {
36
+ throw new Error('getSpanData must be implemented by subclass')
37
+ }
38
+
39
+ injectTraceContext (span, ctx) {
40
+ throw new Error('injectTraceContext must be implemented by subclass')
41
+ }
42
+
43
+ setProducerCheckpoint (span, ctx) {
44
+ const { queueName, payloadSize, injectTarget } = this.getDsmData(ctx)
45
+ const edgeTags = ['direction:out', `topic:${queueName}`, 'type:bullmq']
46
+ const dataStreamsContext = this.tracer.setCheckpoint(edgeTags, span, payloadSize)
47
+ if (injectTarget && typeof injectTarget === 'object') {
48
+ injectTarget._datadog = injectTarget._datadog || {}
49
+ DsmPathwayCodec.encode(dataStreamsContext, injectTarget._datadog)
50
+ }
51
+ }
52
+
53
+ getDsmData (ctx) {
54
+ throw new Error('getDsmData must be implemented by subclass')
55
+ }
56
+ }
57
+
58
+ class QueueAddPlugin extends BaseBullmqProducerPlugin {
59
+ static prefix = 'tracing:orchestrion:bullmq:Queue_add'
60
+
61
+ getSpanData (ctx) {
62
+ const queueName = ctx.self?.name || 'bullmq'
63
+ return {
64
+ resource: queueName,
65
+ meta: {
66
+ 'messaging.destination.name': ctx.self?.name
67
+ }
68
+ }
69
+ }
70
+
71
+ injectTraceContext (span, ctx) {
72
+ const data = ctx.arguments?.[1]
73
+ if (data?.constructor?.name === 'Object') {
74
+ data._datadog = data._datadog || {}
75
+ this.tracer.inject(span, 'text_map', data._datadog)
76
+ }
77
+ }
78
+
79
+ getDsmData (ctx) {
80
+ const data = ctx.arguments?.[1]
81
+ return {
82
+ queueName: ctx.self?.name || 'bullmq',
83
+ payloadSize: data ? getMessageSize(data) : 0,
84
+ injectTarget: data
85
+ }
86
+ }
87
+ }
88
+
89
+ class QueueAddBulkPlugin extends BaseBullmqProducerPlugin {
90
+ static prefix = 'tracing:orchestrion:bullmq:Queue_addBulk'
91
+
92
+ operationName () {
93
+ return 'bullmq.addBulk'
94
+ }
95
+
96
+ getSpanData (ctx) {
97
+ const queueName = ctx.self?.name || 'bullmq'
98
+ const jobs = ctx.arguments?.[0]
99
+ return {
100
+ resource: queueName,
101
+ meta: {
102
+ 'messaging.destination.name': ctx.self?.name,
103
+ 'messaging.batch.message_count': Array.isArray(jobs) ? jobs.length : undefined
104
+ }
105
+ }
106
+ }
107
+
108
+ injectTraceContext (span, ctx) {
109
+ const jobs = ctx.arguments?.[0]
110
+ if (!Array.isArray(jobs)) return
111
+ for (const job of jobs) {
112
+ if (job?.data?.constructor?.name !== 'Object') continue
113
+ job.data._datadog = job.data._datadog || {}
114
+ this.tracer.inject(span, 'text_map', job.data._datadog)
115
+ }
116
+ }
117
+
118
+ getDsmData (ctx) {
119
+ const jobs = ctx.arguments?.[0] || []
120
+ const payloadSize = jobs.reduce((total, job) => {
121
+ return total + (job?.data ? getMessageSize(job.data) : 0)
122
+ }, 0)
123
+ return {
124
+ queueName: ctx.self?.name || 'bullmq',
125
+ payloadSize,
126
+ injectTarget: jobs[0]?.data
127
+ }
128
+ }
129
+
130
+ setProducerCheckpoint (span, ctx) {
131
+ const jobs = ctx.arguments?.[0] || []
132
+ const queueName = ctx.self?.name || 'bullmq'
133
+ const edgeTags = ['direction:out', `topic:${queueName}`, 'type:bullmq']
134
+
135
+ for (const job of jobs) {
136
+ if (job?.data && job.data !== null && job.data.constructor.name === 'Object') {
137
+ const payloadSize = getMessageSize(job.data)
138
+ const dataStreamsContext = this.tracer.setCheckpoint(edgeTags, span, payloadSize)
139
+ job.data._datadog = job.data._datadog || {}
140
+ DsmPathwayCodec.encode(dataStreamsContext, job.data._datadog)
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ class FlowProducerAddPlugin extends BaseBullmqProducerPlugin {
147
+ static prefix = 'tracing:orchestrion:bullmq:FlowProducer_add'
148
+
149
+ getSpanData (ctx) {
150
+ const flow = ctx.arguments?.[0]
151
+ const queueName = flow?.queueName || 'bullmq'
152
+ return {
153
+ resource: queueName,
154
+ meta: {
155
+ 'messaging.destination.name': flow?.queueName
156
+ }
157
+ }
158
+ }
159
+
160
+ injectTraceContext (span, ctx) {
161
+ const flow = ctx.arguments?.[0]
162
+ if (flow?.data?.constructor?.name === 'Object') {
163
+ flow.data._datadog = flow.data._datadog || {}
164
+ this.tracer.inject(span, 'text_map', flow.data._datadog)
165
+ }
166
+ }
167
+
168
+ getDsmData (ctx) {
169
+ const flow = ctx.arguments?.[0]
170
+ return {
171
+ queueName: flow?.queueName || 'bullmq',
172
+ payloadSize: flow?.data ? getMessageSize(flow.data) : 0,
173
+ injectTarget: flow?.data
174
+ }
175
+ }
176
+ }
177
+
178
+ module.exports = [QueueAddPlugin, QueueAddBulkPlugin, FlowProducerAddPlugin]
@@ -1,9 +1,9 @@
1
1
  'use strict'
2
2
 
3
+ const KafkajsPlugin = require('../../datadog-plugin-kafkajs/src/index')
3
4
  const ProducerPlugin = require('./producer')
4
5
  const ConsumerPlugin = require('./consumer')
5
6
  const BatchConsumerPlugin = require('./batch-consumer')
6
- const KafkajsPlugin = require('../../datadog-plugin-kafkajs/src/index')
7
7
 
8
8
  class ConfluentKafkaJsPlugin extends KafkajsPlugin {
9
9
  /**
@@ -1,9 +1,9 @@
1
1
  'use strict'
2
2
 
3
3
  const NoopTracer = require('../../dd-trace/src/noop/tracer')
4
- const cypressPlugin = require('./cypress-plugin')
5
4
  const satisfies = require('../../../vendor/dist/semifies')
6
5
  const { DD_MAJOR } = require('../../../version')
6
+ const cypressPlugin = require('./cypress-plugin')
7
7
 
8
8
  const noopTask = {
9
9
  'dd:testSuiteStart': () => {
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
+ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
3
4
  const ExpressTracingPlugin = require('./tracing')
4
5
  const ExpressCodeOriginForSpansPlugin = require('./code_origin')
5
- const CompositePlugin = require('../../dd-trace/src/plugins/composite')
6
6
 
7
7
  class ExpressPlugin extends CompositePlugin {
8
8
  static id = 'express'
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
+ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
3
4
  const FastifyTracingPlugin = require('./tracing')
4
5
  const FastifyCodeOriginForSpansPlugin = require('./code_origin')
5
- const CompositePlugin = require('../../dd-trace/src/plugins/composite')
6
6
 
7
7
  class FastifyPlugin extends CompositePlugin {
8
8
  static id = 'fastify'
@@ -8,11 +8,11 @@ class GoogleCloudPubsubClientPlugin extends ClientPlugin {
8
8
  static operation = 'request'
9
9
 
10
10
  start (ctx) {
11
- const { request, api, projectId } = ctx
11
+ const { request, api, projectId, storedContext } = ctx
12
12
 
13
13
  if (api === 'publish') return
14
14
 
15
- this.startSpan(this.operationName(), {
15
+ const spanOptions = {
16
16
  service: this.config.service || this.serviceName(),
17
17
  resource: [api, request.name].filter(Boolean).join(' '),
18
18
  kind: this.constructor.kind,
@@ -20,7 +20,17 @@ class GoogleCloudPubsubClientPlugin extends ClientPlugin {
20
20
  'pubsub.method': api,
21
21
  'gcloud.project_id': projectId
22
22
  }
23
- }, ctx)
23
+ }
24
+
25
+ /**
26
+ * Use stored context from consumer plugin to link acknowledge span to message processing span.
27
+ * Without this, the acknowledge span would be orphaned (no async context available).
28
+ */
29
+ if (storedContext?.span) {
30
+ spanOptions.childOf = storedContext.span.context()
31
+ }
32
+
33
+ this.startSpan(this.operationName(), spanOptions, ctx)
24
34
 
25
35
  return ctx.currentStore
26
36
  }