@depup/dd-trace 5.97.0-depup.0 → 6.4.0-depup.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 (633) hide show
  1. package/LICENSE-3rdparty.csv +89 -104
  2. package/README.md +9 -3
  3. package/changes.json +8 -3
  4. package/ci/init.js +25 -5
  5. package/ci/vitest-no-worker-init-setup.mjs +430 -0
  6. package/ext/exporters.js +1 -0
  7. package/ext/tags.js +3 -0
  8. package/index.d.ts +315 -244
  9. package/index.electron.js +3 -0
  10. package/initialize.mjs +9 -8
  11. package/loader-hook.mjs +154 -47
  12. package/package.json +118 -78
  13. package/packages/datadog-core/src/storage.js +47 -48
  14. package/packages/datadog-esbuild/index.js +32 -1
  15. package/packages/datadog-esbuild/src/utils.js +46 -3
  16. package/packages/datadog-instrumentations/src/aerospike.js +3 -3
  17. package/packages/datadog-instrumentations/src/ai.js +131 -76
  18. package/packages/datadog-instrumentations/src/amqplib.js +6 -7
  19. package/packages/datadog-instrumentations/src/anthropic.js +10 -10
  20. package/packages/datadog-instrumentations/src/apollo-server-core.js +3 -3
  21. package/packages/datadog-instrumentations/src/apollo-server.js +10 -18
  22. package/packages/datadog-instrumentations/src/avsc.js +6 -6
  23. package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js-context-methods.js +18 -0
  24. package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +111 -0
  25. package/packages/datadog-instrumentations/src/aws-sdk.js +172 -72
  26. package/packages/datadog-instrumentations/src/azure-cosmos.js +7 -0
  27. package/packages/datadog-instrumentations/src/azure-durable-functions.js +8 -8
  28. package/packages/datadog-instrumentations/src/azure-functions.js +3 -0
  29. package/packages/datadog-instrumentations/src/bluebird.js +2 -2
  30. package/packages/datadog-instrumentations/src/body-parser.js +5 -2
  31. package/packages/datadog-instrumentations/src/cassandra-driver.js +12 -9
  32. package/packages/datadog-instrumentations/src/child_process.js +15 -15
  33. package/packages/datadog-instrumentations/src/claude-agent-sdk.js +587 -0
  34. package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +41 -24
  35. package/packages/datadog-instrumentations/src/connect.js +14 -12
  36. package/packages/datadog-instrumentations/src/cookie-parser.js +5 -4
  37. package/packages/datadog-instrumentations/src/cookie.js +9 -3
  38. package/packages/datadog-instrumentations/src/couchbase.js +73 -238
  39. package/packages/datadog-instrumentations/src/crypto.js +49 -4
  40. package/packages/datadog-instrumentations/src/cucumber-worker-threads.js +19 -0
  41. package/packages/datadog-instrumentations/src/cucumber.js +747 -187
  42. package/packages/datadog-instrumentations/src/cypress-config.js +164 -56
  43. package/packages/datadog-instrumentations/src/cypress.js +5 -3
  44. package/packages/datadog-instrumentations/src/dns.js +60 -59
  45. package/packages/datadog-instrumentations/src/elasticsearch.js +9 -12
  46. package/packages/datadog-instrumentations/src/electron/preload.js +42 -0
  47. package/packages/datadog-instrumentations/src/electron.js +240 -0
  48. package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +11 -9
  49. package/packages/datadog-instrumentations/src/express-session.js +14 -13
  50. package/packages/datadog-instrumentations/src/express.js +52 -30
  51. package/packages/datadog-instrumentations/src/fastify.js +169 -86
  52. package/packages/datadog-instrumentations/src/fetch.js +5 -5
  53. package/packages/datadog-instrumentations/src/fs.js +22 -20
  54. package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +5 -7
  55. package/packages/datadog-instrumentations/src/google-genai.js +4 -4
  56. package/packages/datadog-instrumentations/src/graphql.js +26 -362
  57. package/packages/datadog-instrumentations/src/grpc/client.js +48 -32
  58. package/packages/datadog-instrumentations/src/grpc/server.js +20 -2
  59. package/packages/datadog-instrumentations/src/hapi.js +2 -2
  60. package/packages/datadog-instrumentations/src/helpers/callback-instrumentor.js +74 -0
  61. package/packages/datadog-instrumentations/src/helpers/check-require-cache.js +85 -9
  62. package/packages/datadog-instrumentations/src/helpers/hook.js +4 -1
  63. package/packages/datadog-instrumentations/src/helpers/hooks.js +12 -0
  64. package/packages/datadog-instrumentations/src/helpers/instrument.js +36 -3
  65. package/packages/datadog-instrumentations/src/helpers/kafka.js +58 -0
  66. package/packages/datadog-instrumentations/src/helpers/optional-peer-bundler.js +65 -0
  67. package/packages/datadog-instrumentations/src/helpers/promise-instrumentor.js +42 -0
  68. package/packages/datadog-instrumentations/src/helpers/promise.js +2 -2
  69. package/packages/datadog-instrumentations/src/helpers/register.js +7 -5
  70. package/packages/datadog-instrumentations/src/helpers/require-optional-peer.js +17 -0
  71. package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +13 -5
  72. package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +24 -7
  73. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/ai.js +6 -6
  74. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/aws-durable-execution-sdk-js.js +31 -0
  75. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/azure-cosmos.js +50 -0
  76. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/claude-agent-sdk.js +17 -0
  77. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +201 -0
  78. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +7 -0
  79. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langgraph.js +4 -2
  80. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/mercurius.js +31 -0
  81. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-sdk.js +35 -0
  82. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +85 -0
  83. package/packages/datadog-instrumentations/src/helpers/rewriter/loader.mjs +18 -2
  84. package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +49 -224
  85. package/packages/datadog-instrumentations/src/helpers/router-helper.js +8 -8
  86. package/packages/datadog-instrumentations/src/hono.js +71 -9
  87. package/packages/datadog-instrumentations/src/http/client.js +48 -24
  88. package/packages/datadog-instrumentations/src/http/server.js +75 -29
  89. package/packages/datadog-instrumentations/src/http2/client.js +15 -12
  90. package/packages/datadog-instrumentations/src/http2/server.js +156 -23
  91. package/packages/datadog-instrumentations/src/ioredis.js +17 -14
  92. package/packages/datadog-instrumentations/src/iovalkey.js +1 -2
  93. package/packages/datadog-instrumentations/src/jest/bail-reporter.js +42 -0
  94. package/packages/datadog-instrumentations/src/jest/coverage-backfill.js +163 -0
  95. package/packages/datadog-instrumentations/src/jest.js +1783 -401
  96. package/packages/datadog-instrumentations/src/kafkajs.js +284 -170
  97. package/packages/datadog-instrumentations/src/knex.js +17 -17
  98. package/packages/datadog-instrumentations/src/koa.js +15 -14
  99. package/packages/datadog-instrumentations/src/ldapjs.js +5 -5
  100. package/packages/datadog-instrumentations/src/light-my-request.js +2 -2
  101. package/packages/datadog-instrumentations/src/limitd-client.js +4 -4
  102. package/packages/datadog-instrumentations/src/lodash.js +4 -4
  103. package/packages/datadog-instrumentations/src/mariadb.js +18 -16
  104. package/packages/datadog-instrumentations/src/memcached.js +4 -3
  105. package/packages/datadog-instrumentations/src/mercurius.js +11 -0
  106. package/packages/datadog-instrumentations/src/microgateway-core.js +2 -2
  107. package/packages/datadog-instrumentations/src/mocha/common.js +7 -4
  108. package/packages/datadog-instrumentations/src/mocha/main.js +557 -118
  109. package/packages/datadog-instrumentations/src/mocha/utils.js +531 -131
  110. package/packages/datadog-instrumentations/src/mocha/worker.js +27 -9
  111. package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +254 -0
  112. package/packages/datadog-instrumentations/src/mongodb-core.js +43 -31
  113. package/packages/datadog-instrumentations/src/mongodb.js +79 -5
  114. package/packages/datadog-instrumentations/src/mongoose.js +43 -34
  115. package/packages/datadog-instrumentations/src/mquery.js +5 -5
  116. package/packages/datadog-instrumentations/src/multer.js +5 -4
  117. package/packages/datadog-instrumentations/src/mysql.js +17 -17
  118. package/packages/datadog-instrumentations/src/mysql2.js +39 -5
  119. package/packages/datadog-instrumentations/src/nats.js +182 -0
  120. package/packages/datadog-instrumentations/src/net.js +19 -11
  121. package/packages/datadog-instrumentations/src/next.js +44 -10
  122. package/packages/datadog-instrumentations/src/nyc.js +43 -6
  123. package/packages/datadog-instrumentations/src/openai.js +124 -38
  124. package/packages/datadog-instrumentations/src/oracledb.js +12 -7
  125. package/packages/datadog-instrumentations/src/otel-sdk-trace.js +27 -6
  126. package/packages/datadog-instrumentations/src/passport-utils.js +5 -5
  127. package/packages/datadog-instrumentations/src/path-to-regexp.js +44 -0
  128. package/packages/datadog-instrumentations/src/pg.js +58 -25
  129. package/packages/datadog-instrumentations/src/pino.js +25 -41
  130. package/packages/datadog-instrumentations/src/playwright-browser-scripts.js +27 -0
  131. package/packages/datadog-instrumentations/src/playwright.js +1086 -350
  132. package/packages/datadog-instrumentations/src/protobufjs.js +16 -16
  133. package/packages/datadog-instrumentations/src/redis.js +28 -15
  134. package/packages/datadog-instrumentations/src/restify.js +6 -5
  135. package/packages/datadog-instrumentations/src/router.js +243 -87
  136. package/packages/datadog-instrumentations/src/selenium.js +1 -2
  137. package/packages/datadog-instrumentations/src/stripe.js +47 -33
  138. package/packages/datadog-instrumentations/src/tedious.js +28 -0
  139. package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +1297 -0
  140. package/packages/datadog-instrumentations/src/vitest-main.js +1592 -0
  141. package/packages/datadog-instrumentations/src/vitest-util.js +251 -0
  142. package/packages/datadog-instrumentations/src/vitest-worker.js +822 -0
  143. package/packages/datadog-instrumentations/src/vitest.js +11 -1262
  144. package/packages/datadog-instrumentations/src/winston.js +4 -4
  145. package/packages/datadog-instrumentations/src/ws.js +7 -7
  146. package/packages/datadog-instrumentations/src/zlib.js +29 -0
  147. package/packages/datadog-plugin-ai/src/index.js +1 -1
  148. package/packages/datadog-plugin-ai/src/tracing.js +66 -3
  149. package/packages/datadog-plugin-ai/src/utils.js +17 -4
  150. package/packages/datadog-plugin-apollo/src/gateway/request.js +1 -21
  151. package/packages/datadog-plugin-avsc/src/schema_iterator.js +3 -3
  152. package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/checkpoint.js +31 -0
  153. package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/client.js +55 -0
  154. package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/context.js +123 -0
  155. package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/handler.js +129 -0
  156. package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/index.js +19 -0
  157. package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +224 -0
  158. package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +79 -0
  159. package/packages/datadog-plugin-aws-sdk/src/base.js +86 -50
  160. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/tracing.js +1 -1
  161. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +218 -4
  162. package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
  163. package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +2 -1
  164. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +59 -14
  165. package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +174 -75
  166. package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +34 -23
  167. package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +2 -1
  168. package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
  169. package/packages/datadog-plugin-aws-sdk/src/services/sns.js +26 -26
  170. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +187 -101
  171. package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +20 -18
  172. package/packages/datadog-plugin-azure-cosmos/src/index.js +144 -0
  173. package/packages/datadog-plugin-azure-event-hubs/src/producer.js +8 -15
  174. package/packages/datadog-plugin-azure-functions/src/index.js +7 -3
  175. package/packages/datadog-plugin-azure-service-bus/src/producer.js +5 -10
  176. package/packages/datadog-plugin-bullmq/src/consumer.js +5 -4
  177. package/packages/datadog-plugin-bullmq/src/filter.js +35 -0
  178. package/packages/datadog-plugin-bullmq/src/producer.js +121 -33
  179. package/packages/datadog-plugin-bunyan/src/index.js +28 -0
  180. package/packages/datadog-plugin-child_process/src/index.js +13 -2
  181. package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +6 -6
  182. package/packages/datadog-plugin-claude-agent-sdk/src/index.js +31 -0
  183. package/packages/datadog-plugin-claude-agent-sdk/src/tracing.js +107 -0
  184. package/packages/datadog-plugin-claude-agent-sdk/src/util.js +15 -0
  185. package/packages/datadog-plugin-couchbase/src/index.js +58 -52
  186. package/packages/datadog-plugin-cucumber/src/index.js +46 -28
  187. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +961 -92
  188. package/packages/datadog-plugin-cypress/src/index.js +104 -2
  189. package/packages/datadog-plugin-cypress/src/plugin.js +6 -14
  190. package/packages/datadog-plugin-cypress/src/source-map-utils.js +48 -1
  191. package/packages/datadog-plugin-cypress/src/support.js +180 -25
  192. package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -1
  193. package/packages/datadog-plugin-dns/src/lookup.js +8 -6
  194. package/packages/datadog-plugin-elasticsearch/src/index.js +28 -8
  195. package/packages/datadog-plugin-electron/src/index.js +17 -0
  196. package/packages/datadog-plugin-electron/src/ipc.js +143 -0
  197. package/packages/datadog-plugin-electron/src/net.js +82 -0
  198. package/packages/datadog-plugin-express/src/code_origin.js +1 -1
  199. package/packages/datadog-plugin-fastify/src/code_origin.js +1 -1
  200. package/packages/datadog-plugin-fs/src/index.js +2 -1
  201. package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -5
  202. package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +27 -18
  203. package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +5 -8
  204. package/packages/datadog-plugin-graphql/src/execute.js +706 -34
  205. package/packages/datadog-plugin-graphql/src/index.js +43 -9
  206. package/packages/datadog-plugin-graphql/src/parse.js +45 -4
  207. package/packages/datadog-plugin-graphql/src/request.js +135 -0
  208. package/packages/datadog-plugin-graphql/src/tools/signature.js +32 -7
  209. package/packages/datadog-plugin-graphql/src/tools/transforms.js +118 -100
  210. package/packages/datadog-plugin-graphql/src/utils.js +261 -3
  211. package/packages/datadog-plugin-graphql/src/validate.js +53 -7
  212. package/packages/datadog-plugin-grpc/src/client.js +7 -8
  213. package/packages/datadog-plugin-grpc/src/server.js +1 -1
  214. package/packages/datadog-plugin-grpc/src/util.js +57 -22
  215. package/packages/datadog-plugin-http/src/client.js +12 -14
  216. package/packages/datadog-plugin-http/src/index.js +6 -8
  217. package/packages/datadog-plugin-http/src/server.js +63 -20
  218. package/packages/datadog-plugin-http2/src/client.js +6 -3
  219. package/packages/datadog-plugin-http2/src/server.js +48 -8
  220. package/packages/datadog-plugin-jest/src/index.js +133 -67
  221. package/packages/datadog-plugin-jest/src/util.js +37 -16
  222. package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +1 -1
  223. package/packages/datadog-plugin-kafkajs/src/consumer.js +2 -9
  224. package/packages/datadog-plugin-kafkajs/src/producer.js +37 -8
  225. package/packages/datadog-plugin-langgraph/src/stream.js +1 -1
  226. package/packages/datadog-plugin-memcached/src/index.js +1 -1
  227. package/packages/datadog-plugin-mocha/src/index.js +66 -20
  228. package/packages/datadog-plugin-modelcontextprotocol-sdk/src/index.js +24 -0
  229. package/packages/datadog-plugin-modelcontextprotocol-sdk/src/tracing.js +173 -0
  230. package/packages/datadog-plugin-modelcontextprotocol-sdk/src/utils.js +30 -0
  231. package/packages/datadog-plugin-mongodb-core/src/bulk-write.js +43 -0
  232. package/packages/datadog-plugin-mongodb-core/src/index.js +8 -206
  233. package/packages/datadog-plugin-mongodb-core/src/query.js +452 -0
  234. package/packages/datadog-plugin-mysql/src/index.js +9 -4
  235. package/packages/datadog-plugin-nats/src/consumer.js +43 -0
  236. package/packages/datadog-plugin-nats/src/index.js +20 -0
  237. package/packages/datadog-plugin-nats/src/producer.js +62 -0
  238. package/packages/datadog-plugin-nats/src/util.js +33 -0
  239. package/packages/datadog-plugin-next/src/index.js +12 -4
  240. package/packages/datadog-plugin-openai/src/services.js +4 -3
  241. package/packages/datadog-plugin-openai/src/tracing.js +27 -25
  242. package/packages/datadog-plugin-oracledb/src/index.js +13 -2
  243. package/packages/datadog-plugin-pg/src/index.js +13 -3
  244. package/packages/datadog-plugin-pino/src/index.js +42 -0
  245. package/packages/datadog-plugin-playwright/src/index.js +21 -11
  246. package/packages/datadog-plugin-protobufjs/src/schema_iterator.js +3 -3
  247. package/packages/datadog-plugin-redis/src/index.js +54 -25
  248. package/packages/datadog-plugin-rhea/src/producer.js +1 -1
  249. package/packages/datadog-plugin-router/src/index.js +46 -44
  250. package/packages/datadog-plugin-selenium/src/index.js +1 -1
  251. package/packages/datadog-plugin-tedious/src/index.js +1 -1
  252. package/packages/datadog-plugin-undici/src/index.js +24 -2
  253. package/packages/datadog-plugin-vitest/src/index.js +160 -90
  254. package/packages/datadog-plugin-winston/src/index.js +30 -0
  255. package/packages/datadog-plugin-ws/src/close.js +3 -1
  256. package/packages/datadog-plugin-ws/src/producer.js +2 -0
  257. package/packages/datadog-plugin-ws/src/receiver.js +2 -1
  258. package/packages/datadog-shimmer/src/shimmer.js +101 -39
  259. package/packages/datadog-webpack/index.js +17 -1
  260. package/packages/datadog-webpack/src/optional-peer-loader.js +17 -0
  261. package/packages/dd-trace/index.electron.js +3 -0
  262. package/packages/dd-trace/index.js +2 -36
  263. package/packages/dd-trace/src/aiguard/channels.js +7 -0
  264. package/packages/dd-trace/src/aiguard/index.js +16 -34
  265. package/packages/dd-trace/src/aiguard/integrations/evaluate.js +46 -0
  266. package/packages/dd-trace/src/aiguard/integrations/index.js +34 -0
  267. package/packages/dd-trace/src/aiguard/integrations/openai.js +80 -0
  268. package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +92 -0
  269. package/packages/dd-trace/src/aiguard/messages/openai.js +382 -0
  270. package/packages/{datadog-instrumentations/src/helpers/ai-messages.js → dd-trace/src/aiguard/messages/vercel-ai.js} +30 -27
  271. package/packages/dd-trace/src/aiguard/sdk.js +147 -54
  272. package/packages/dd-trace/src/aiguard/tags.js +26 -10
  273. package/packages/dd-trace/src/appsec/api_security/index.js +55 -0
  274. package/packages/dd-trace/src/appsec/api_security/sampler.js +147 -0
  275. package/packages/dd-trace/src/appsec/blocked_templates.js +4 -3
  276. package/packages/dd-trace/src/appsec/blocking.js +82 -42
  277. package/packages/dd-trace/src/appsec/channels.js +5 -1
  278. package/packages/dd-trace/src/appsec/downstream_requests.js +116 -62
  279. package/packages/dd-trace/src/appsec/graphql.js +20 -17
  280. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-password-rules.js +1 -1
  281. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secret-rules.js +81 -81
  282. package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +23 -23
  283. package/packages/dd-trace/src/appsec/iast/index.js +3 -2
  284. package/packages/dd-trace/src/appsec/iast/security-controls/index.js +4 -4
  285. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugins/kafka.js +2 -2
  286. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +4 -4
  287. package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +2 -2
  288. package/packages/dd-trace/src/appsec/iast/telemetry/index.js +2 -1
  289. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/ldap-sensitive-analyzer.js +54 -12
  290. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +5 -1
  291. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +31 -4
  292. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +1 -3
  293. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +83 -48
  294. package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +1 -1
  295. package/packages/dd-trace/src/appsec/index.js +65 -47
  296. package/packages/dd-trace/src/appsec/lambda.js +135 -0
  297. package/packages/dd-trace/src/appsec/rasp/command_injection.js +4 -5
  298. package/packages/dd-trace/src/appsec/rasp/lfi.js +8 -4
  299. package/packages/dd-trace/src/appsec/rasp/sql_injection.js +5 -10
  300. package/packages/dd-trace/src/appsec/rasp/ssrf.js +26 -18
  301. package/packages/dd-trace/src/appsec/recommended.json +2438 -13
  302. package/packages/dd-trace/src/appsec/reporter.js +87 -28
  303. package/packages/dd-trace/src/appsec/rule_manager.js +4 -2
  304. package/packages/dd-trace/src/appsec/sdk/set_user.js +1 -1
  305. package/packages/dd-trace/src/appsec/sdk/track_event.js +5 -5
  306. package/packages/dd-trace/src/appsec/sdk/user_blocking.js +7 -11
  307. package/packages/dd-trace/src/appsec/sdk/utils.js +5 -3
  308. package/packages/dd-trace/src/appsec/store.js +50 -0
  309. package/packages/dd-trace/src/appsec/telemetry/api_security.js +34 -0
  310. package/packages/dd-trace/src/appsec/telemetry/index.js +27 -1
  311. package/packages/dd-trace/src/appsec/user_tracking.js +5 -4
  312. package/packages/dd-trace/src/appsec/waf/index.js +19 -9
  313. package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +35 -20
  314. package/packages/dd-trace/src/appsec/waf/waf_manager.js +1 -1
  315. package/packages/dd-trace/src/azure_metadata.js +17 -6
  316. package/packages/dd-trace/src/baggage.js +32 -13
  317. package/packages/dd-trace/src/bootstrap.js +39 -0
  318. package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +30 -5
  319. package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +122 -24
  320. package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +22 -7
  321. package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +5 -2
  322. package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +2 -2
  323. package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +2 -2
  324. package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +6 -2
  325. package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +2 -2
  326. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +148 -25
  327. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +3 -4
  328. package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +28 -10
  329. package/packages/dd-trace/src/ci-visibility/exporters/test-worker/writer.js +22 -0
  330. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +105 -22
  331. package/packages/dd-trace/src/ci-visibility/lage.js +2 -1
  332. package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +4 -5
  333. package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +4 -5
  334. package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +73 -55
  335. package/packages/dd-trace/src/ci-visibility/requests/request.js +14 -50
  336. package/packages/dd-trace/src/ci-visibility/requests/upload-coverage-report.js +4 -4
  337. package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +156 -0
  338. package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +5 -3
  339. package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +24 -6
  340. package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +70 -6
  341. package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +128 -0
  342. package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +291 -0
  343. package/packages/dd-trace/src/config/config-types.d.ts +8 -6
  344. package/packages/dd-trace/src/config/defaults.js +71 -44
  345. package/packages/dd-trace/src/config/generated-config-types.d.ts +676 -131
  346. package/packages/dd-trace/src/config/git_properties.js +2 -2
  347. package/packages/dd-trace/src/config/helper.js +139 -33
  348. package/packages/dd-trace/src/config/index.js +117 -131
  349. package/packages/dd-trace/src/config/major-overrides.js +100 -0
  350. package/packages/dd-trace/src/config/normalize-service.js +31 -0
  351. package/packages/dd-trace/src/config/parsers.js +138 -10
  352. package/packages/dd-trace/src/config/remote_config.js +1 -1
  353. package/packages/dd-trace/src/config/supported-configurations.json +394 -203
  354. package/packages/dd-trace/src/constants.js +15 -0
  355. package/packages/dd-trace/src/crashtracking/crashtracker.js +18 -6
  356. package/packages/dd-trace/src/datastreams/checkpointer.js +6 -12
  357. package/packages/dd-trace/src/datastreams/context.js +4 -2
  358. package/packages/dd-trace/src/datastreams/encoding.js +39 -28
  359. package/packages/dd-trace/src/datastreams/index.js +2 -1
  360. package/packages/dd-trace/src/datastreams/manager.js +1 -1
  361. package/packages/dd-trace/src/datastreams/pathway.js +35 -30
  362. package/packages/dd-trace/src/datastreams/processor.js +31 -22
  363. package/packages/dd-trace/src/datastreams/size.js +6 -2
  364. package/packages/dd-trace/src/datastreams/writer.js +15 -6
  365. package/packages/dd-trace/src/debugger/config.js +9 -4
  366. package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +49 -35
  367. package/packages/dd-trace/src/debugger/devtools_client/condition.js +5 -8
  368. package/packages/dd-trace/src/debugger/devtools_client/config.js +3 -2
  369. package/packages/dd-trace/src/debugger/devtools_client/index.js +33 -71
  370. package/packages/dd-trace/src/debugger/devtools_client/probe_sampler.js +83 -0
  371. package/packages/dd-trace/src/debugger/devtools_client/send.js +27 -6
  372. package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +2 -2
  373. package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +5 -2
  374. package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +1 -0
  375. package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +1 -1
  376. package/packages/dd-trace/src/debugger/devtools_client/state.js +3 -1
  377. package/packages/dd-trace/src/debugger/index.js +13 -9
  378. package/packages/dd-trace/src/debugger/probe_sampler.js +112 -0
  379. package/packages/dd-trace/src/debugger/probe_sampler_constants.js +19 -0
  380. package/packages/dd-trace/src/dogstatsd.js +34 -28
  381. package/packages/dd-trace/src/encode/0.4.js +829 -268
  382. package/packages/dd-trace/src/encode/0.5.js +158 -22
  383. package/packages/dd-trace/src/encode/agentless-ci-visibility.js +141 -65
  384. package/packages/dd-trace/src/encode/agentless-json.js +12 -6
  385. package/packages/dd-trace/src/encode/coverage-ci-visibility.js +52 -15
  386. package/packages/dd-trace/src/encode/span-stats.js +19 -16
  387. package/packages/dd-trace/src/encode/tags-processors.js +30 -25
  388. package/packages/dd-trace/src/exporter.js +3 -1
  389. package/packages/dd-trace/src/exporters/agent/index.js +4 -5
  390. package/packages/dd-trace/src/exporters/agent/writer.js +1 -2
  391. package/packages/dd-trace/src/exporters/agentless/index.js +12 -13
  392. package/packages/dd-trace/src/exporters/agentless/intake.js +43 -0
  393. package/packages/dd-trace/src/exporters/agentless/writer.js +12 -11
  394. package/packages/dd-trace/src/exporters/common/agents.js +3 -1
  395. package/packages/dd-trace/src/exporters/common/buffering-exporter.js +3 -3
  396. package/packages/dd-trace/src/exporters/common/request.js +48 -28
  397. package/packages/dd-trace/src/exporters/common/retry.js +104 -0
  398. package/packages/dd-trace/src/exporters/common/url.js +34 -0
  399. package/packages/dd-trace/src/exporters/common/util.js +2 -2
  400. package/packages/dd-trace/src/exporters/common/writer.js +17 -1
  401. package/packages/dd-trace/src/exporters/electron/index.js +49 -0
  402. package/packages/dd-trace/src/exporters/span-stats/index.js +1 -2
  403. package/packages/dd-trace/src/exporters/span-stats/writer.js +1 -3
  404. package/packages/dd-trace/src/external-logger/src/index.js +2 -1
  405. package/packages/dd-trace/src/feature-registry.js +22 -0
  406. package/packages/dd-trace/src/git_metadata.js +68 -0
  407. package/packages/dd-trace/src/git_metadata_tagger.js +13 -5
  408. package/packages/dd-trace/src/guardrails/index.js +11 -6
  409. package/packages/dd-trace/src/guardrails/telemetry.js +40 -3
  410. package/packages/dd-trace/src/heap_snapshots.js +4 -4
  411. package/packages/dd-trace/src/id.js +46 -27
  412. package/packages/dd-trace/src/index.js +7 -8
  413. package/packages/dd-trace/src/lambda/handler-paths.js +52 -0
  414. package/packages/dd-trace/src/lambda/handler.js +2 -6
  415. package/packages/dd-trace/src/lambda/index.js +62 -14
  416. package/packages/dd-trace/src/lambda/runtime/patch.js +21 -46
  417. package/packages/dd-trace/src/llmobs/constants/tags.js +13 -0
  418. package/packages/dd-trace/src/llmobs/index.js +37 -7
  419. package/packages/dd-trace/src/llmobs/plugins/ai/ddTelemetry.js +403 -0
  420. package/packages/dd-trace/src/llmobs/plugins/ai/index.js +8 -395
  421. package/packages/dd-trace/src/llmobs/plugins/ai/util.js +119 -7
  422. package/packages/dd-trace/src/llmobs/plugins/ai/vercelTelemetry.js +363 -0
  423. package/packages/dd-trace/src/llmobs/plugins/{anthropic.js → anthropic/index.js} +32 -79
  424. package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +109 -0
  425. package/packages/dd-trace/src/llmobs/plugins/base.js +4 -4
  426. package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +89 -37
  427. package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/index.js +270 -0
  428. package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/utils.js +10 -0
  429. package/packages/dd-trace/src/llmobs/plugins/genai/index.js +5 -1
  430. package/packages/dd-trace/src/llmobs/plugins/genai/util.js +81 -16
  431. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +3 -2
  432. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +3 -2
  433. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/embedding.js +2 -1
  434. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/index.js +1 -50
  435. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +2 -1
  436. package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +14 -8
  437. package/packages/dd-trace/src/llmobs/plugins/langchain/messages.js +76 -0
  438. package/packages/dd-trace/src/llmobs/plugins/langgraph/index.js +3 -28
  439. package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/index.js +68 -0
  440. package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +57 -0
  441. package/packages/dd-trace/src/llmobs/plugins/openai/index.js +21 -51
  442. package/packages/dd-trace/src/llmobs/sdk.js +56 -35
  443. package/packages/dd-trace/src/llmobs/span_processor.js +90 -11
  444. package/packages/dd-trace/src/llmobs/tagger.js +129 -4
  445. package/packages/dd-trace/src/llmobs/telemetry.js +31 -1
  446. package/packages/dd-trace/src/llmobs/util.js +202 -9
  447. package/packages/dd-trace/src/llmobs/writers/base.js +11 -5
  448. package/packages/dd-trace/src/llmobs/writers/spans.js +1 -1
  449. package/packages/dd-trace/src/llmobs/writers/util.js +1 -2
  450. package/packages/dd-trace/src/log/index.js +19 -31
  451. package/packages/dd-trace/src/log/writer.js +3 -1
  452. package/packages/dd-trace/src/msgpack/chunk.js +430 -11
  453. package/packages/dd-trace/src/msgpack/index.js +101 -2
  454. package/packages/dd-trace/src/noop/proxy.js +5 -4
  455. package/packages/dd-trace/src/noop/span.js +3 -1
  456. package/packages/dd-trace/src/openfeature/encoding.js +70 -0
  457. package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +103 -0
  458. package/packages/dd-trace/src/openfeature/flagging_provider.js +26 -1
  459. package/packages/dd-trace/src/openfeature/noop.js +40 -36
  460. package/packages/dd-trace/src/openfeature/register.js +46 -0
  461. package/packages/dd-trace/src/openfeature/remote_config.js +6 -1
  462. package/packages/dd-trace/src/openfeature/span-enrichment-hook.js +143 -0
  463. package/packages/dd-trace/src/openfeature/span-enrichment.js +149 -0
  464. package/packages/dd-trace/src/openfeature/writers/base.js +3 -11
  465. package/packages/dd-trace/src/openfeature/writers/exposures.js +82 -70
  466. package/packages/dd-trace/src/openfeature/writers/util.js +1 -2
  467. package/packages/dd-trace/src/opentelemetry/active-span-proxy.js +42 -0
  468. package/packages/dd-trace/src/opentelemetry/bridge-span-base.js +107 -0
  469. package/packages/dd-trace/src/opentelemetry/context_manager.js +27 -13
  470. package/packages/dd-trace/src/opentelemetry/logs/index.js +6 -6
  471. package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +3 -2
  472. package/packages/dd-trace/src/opentelemetry/metrics/index.js +61 -12
  473. package/packages/dd-trace/src/opentelemetry/metrics/instruments.js +28 -14
  474. package/packages/dd-trace/src/opentelemetry/metrics/meter.js +7 -10
  475. package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +3 -2
  476. package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +40 -0
  477. package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js +169 -0
  478. package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +99 -5
  479. package/packages/dd-trace/src/opentelemetry/metrics/time.js +19 -0
  480. package/packages/dd-trace/src/opentelemetry/otlp/common.proto +2 -2
  481. package/packages/dd-trace/src/opentelemetry/otlp/logs.proto +1 -1
  482. package/packages/dd-trace/src/opentelemetry/otlp/logs_service.proto +1 -1
  483. package/packages/dd-trace/src/opentelemetry/otlp/metrics.proto +1 -1
  484. package/packages/dd-trace/src/opentelemetry/otlp/metrics_service.proto +1 -1
  485. package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +56 -82
  486. package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +1 -2
  487. package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +14 -2
  488. package/packages/dd-trace/src/opentelemetry/otlp/trace.proto +358 -0
  489. package/packages/dd-trace/src/opentelemetry/otlp/trace_service.proto +78 -0
  490. package/packages/dd-trace/src/opentelemetry/span-helpers.js +325 -0
  491. package/packages/dd-trace/src/opentelemetry/span.js +59 -109
  492. package/packages/dd-trace/src/opentelemetry/span_context.js +1 -0
  493. package/packages/dd-trace/src/opentelemetry/span_processor.js +7 -5
  494. package/packages/dd-trace/src/opentelemetry/trace/index.js +75 -0
  495. package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +75 -0
  496. package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +375 -0
  497. package/packages/dd-trace/src/opentelemetry/tracer.js +20 -69
  498. package/packages/dd-trace/src/opentelemetry/tracer_provider.js +33 -17
  499. package/packages/dd-trace/src/opentracing/propagation/log.js +28 -8
  500. package/packages/dd-trace/src/opentracing/propagation/text_map.js +278 -148
  501. package/packages/dd-trace/src/opentracing/propagation/text_map_dsm.js +11 -11
  502. package/packages/dd-trace/src/opentracing/propagation/tracestate.js +98 -32
  503. package/packages/dd-trace/src/opentracing/span.js +127 -73
  504. package/packages/dd-trace/src/opentracing/span_context.js +68 -3
  505. package/packages/dd-trace/src/opentracing/tracer.js +46 -19
  506. package/packages/dd-trace/src/payload-tagging/config/index.js +2 -2
  507. package/packages/dd-trace/src/plugin_manager.js +36 -14
  508. package/packages/dd-trace/src/plugins/apollo.js +3 -1
  509. package/packages/dd-trace/src/plugins/ci_plugin.js +387 -85
  510. package/packages/dd-trace/src/plugins/database.js +61 -18
  511. package/packages/dd-trace/src/plugins/index.js +14 -0
  512. package/packages/dd-trace/src/plugins/log_injection.js +56 -0
  513. package/packages/dd-trace/src/plugins/log_plugin.js +4 -44
  514. package/packages/dd-trace/src/plugins/outbound.js +1 -1
  515. package/packages/dd-trace/src/plugins/plugin.js +19 -28
  516. package/packages/dd-trace/src/plugins/storage.js +2 -2
  517. package/packages/dd-trace/src/plugins/tracing.js +70 -13
  518. package/packages/dd-trace/src/plugins/util/ci.js +127 -40
  519. package/packages/dd-trace/src/plugins/util/git-cache.js +23 -23
  520. package/packages/dd-trace/src/plugins/util/git.js +3 -1
  521. package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +276 -0
  522. package/packages/dd-trace/src/plugins/util/llm.js +6 -1
  523. package/packages/dd-trace/src/plugins/util/stacktrace.js +2 -2
  524. package/packages/dd-trace/src/plugins/util/test.js +894 -65
  525. package/packages/dd-trace/src/plugins/util/url.js +71 -5
  526. package/packages/dd-trace/src/plugins/util/user-provided-git.js +18 -16
  527. package/packages/dd-trace/src/plugins/util/web.js +116 -180
  528. package/packages/dd-trace/src/priority_sampler.js +12 -21
  529. package/packages/dd-trace/src/profiling/config.js +132 -212
  530. package/packages/dd-trace/src/profiling/constants.js +4 -7
  531. package/packages/dd-trace/src/profiling/exporter_cli.js +10 -10
  532. package/packages/dd-trace/src/profiling/exporters/agent.js +61 -28
  533. package/packages/dd-trace/src/profiling/exporters/event_serializer.js +45 -14
  534. package/packages/dd-trace/src/profiling/exporters/file.js +16 -5
  535. package/packages/dd-trace/src/profiling/oom.js +71 -0
  536. package/packages/dd-trace/src/profiling/profiler.js +84 -105
  537. package/packages/dd-trace/src/profiling/profilers/event_plugins/crypto.js +32 -0
  538. package/packages/dd-trace/src/profiling/profilers/event_plugins/zlib.js +19 -0
  539. package/packages/dd-trace/src/profiling/profilers/events.js +57 -13
  540. package/packages/dd-trace/src/profiling/profilers/space.js +27 -16
  541. package/packages/dd-trace/src/profiling/profilers/wall.js +49 -35
  542. package/packages/dd-trace/src/profiling/ssi-heuristics.js +3 -3
  543. package/packages/dd-trace/src/propagation-hash/index.js +1 -1
  544. package/packages/dd-trace/src/proxy.js +50 -36
  545. package/packages/dd-trace/src/rate_limiter.js +1 -1
  546. package/packages/dd-trace/src/remote_config/index.js +6 -5
  547. package/packages/dd-trace/src/remote_config/scheduler.js +1 -1
  548. package/packages/dd-trace/src/ritm.js +6 -3
  549. package/packages/dd-trace/src/runtime_metrics/client.js +30 -0
  550. package/packages/dd-trace/src/runtime_metrics/index.js +14 -4
  551. package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +284 -0
  552. package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +42 -41
  553. package/packages/dd-trace/src/sampling_rule.js +7 -7
  554. package/packages/dd-trace/src/scope.js +10 -15
  555. package/packages/dd-trace/src/serverless.js +6 -7
  556. package/packages/dd-trace/src/service-naming/extra-services.js +14 -0
  557. package/packages/dd-trace/src/service-naming/index.js +1 -1
  558. package/packages/dd-trace/src/service-naming/schemas/definition.js +4 -1
  559. package/packages/dd-trace/src/service-naming/schemas/util.js +48 -3
  560. package/packages/dd-trace/src/service-naming/schemas/v0/graphql.js +6 -0
  561. package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +61 -2
  562. package/packages/dd-trace/src/service-naming/schemas/v0/serverless.js +12 -0
  563. package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +60 -0
  564. package/packages/dd-trace/src/service-naming/schemas/v0/web.js +25 -1
  565. package/packages/dd-trace/src/service-naming/schemas/v0/websocket.js +5 -0
  566. package/packages/dd-trace/src/service-naming/schemas/v1/graphql.js +8 -0
  567. package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +32 -0
  568. package/packages/dd-trace/src/service-naming/schemas/v1/serverless.js +12 -0
  569. package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +17 -0
  570. package/packages/dd-trace/src/service-naming/schemas/v1/web.js +23 -3
  571. package/packages/dd-trace/src/service-naming/schemas/v1/websocket.js +6 -0
  572. package/packages/dd-trace/src/service-naming/source-resolver.js +50 -0
  573. package/packages/dd-trace/src/span_format.js +269 -81
  574. package/packages/dd-trace/src/span_processor.js +13 -13
  575. package/packages/dd-trace/src/span_stats.js +101 -79
  576. package/packages/dd-trace/src/spanleak.js +1 -2
  577. package/packages/dd-trace/src/standalone/index.js +3 -25
  578. package/packages/dd-trace/src/startup-log.js +3 -3
  579. package/packages/dd-trace/src/tagger.js +2 -4
  580. package/packages/dd-trace/src/telemetry/dependencies.js +2 -2
  581. package/packages/dd-trace/src/telemetry/endpoints.js +7 -5
  582. package/packages/dd-trace/src/telemetry/index.js +2 -2
  583. package/packages/dd-trace/src/telemetry/logs/index.js +1 -1
  584. package/packages/dd-trace/src/telemetry/send-data.js +20 -20
  585. package/packages/dd-trace/src/telemetry/session-propagation.js +1 -1
  586. package/packages/dd-trace/src/telemetry/telemetry.js +16 -14
  587. package/packages/dd-trace/src/tracer.js +23 -9
  588. package/packages/dd-trace/src/tracer_metadata.js +1 -1
  589. package/packages/dd-trace/src/util.js +31 -0
  590. package/register.js +58 -1
  591. package/vendor/dist/@apm-js-collab/code-transformer/index.js +94 -42
  592. package/vendor/dist/@datadog/sketches-js/LICENSE +10 -36
  593. package/vendor/dist/@datadog/sketches-js/index.js +1 -1
  594. package/vendor/dist/pprof-format/index.js +1 -1
  595. package/vendor/dist/protobufjs/index.js +1 -1
  596. package/vendor/dist/protobufjs/minimal/index.js +1 -1
  597. package/vendor/dist/shell-quote/index.js +1 -1
  598. package/packages/datadog-plugin-graphql/src/resolve.js +0 -178
  599. package/packages/dd-trace/src/agent/url.js +0 -28
  600. package/packages/dd-trace/src/appsec/api_security_sampler.js +0 -117
  601. package/packages/dd-trace/src/lambda/runtime/ritm.js +0 -133
  602. package/packages/dd-trace/src/log/utils.js +0 -16
  603. package/packages/dd-trace/src/msgpack/encoder.js +0 -308
  604. package/packages/dd-trace/src/plugins/structured_log_plugin.js +0 -9
  605. package/scripts/preinstall.js +0 -34
  606. package/vendor/dist/ignore/LICENSE +0 -21
  607. package/vendor/dist/ignore/index.js +0 -1
  608. package/vendor/dist/opentracing/LICENSE +0 -201
  609. package/vendor/dist/opentracing/binary_carrier.d.ts +0 -11
  610. package/vendor/dist/opentracing/constants.d.ts +0 -61
  611. package/vendor/dist/opentracing/examples/demo/demo.d.ts +0 -2
  612. package/vendor/dist/opentracing/ext/tags.d.ts +0 -90
  613. package/vendor/dist/opentracing/functions.d.ts +0 -20
  614. package/vendor/dist/opentracing/global_tracer.d.ts +0 -14
  615. package/vendor/dist/opentracing/index.d.ts +0 -12
  616. package/vendor/dist/opentracing/index.js +0 -1
  617. package/vendor/dist/opentracing/mock_tracer/index.d.ts +0 -5
  618. package/vendor/dist/opentracing/mock_tracer/mock_context.d.ts +0 -13
  619. package/vendor/dist/opentracing/mock_tracer/mock_report.d.ts +0 -16
  620. package/vendor/dist/opentracing/mock_tracer/mock_span.d.ts +0 -50
  621. package/vendor/dist/opentracing/mock_tracer/mock_tracer.d.ts +0 -26
  622. package/vendor/dist/opentracing/noop.d.ts +0 -8
  623. package/vendor/dist/opentracing/reference.d.ts +0 -33
  624. package/vendor/dist/opentracing/span.d.ts +0 -147
  625. package/vendor/dist/opentracing/span_context.d.ts +0 -26
  626. package/vendor/dist/opentracing/test/api_compatibility.d.ts +0 -16
  627. package/vendor/dist/opentracing/test/mocktracer_implemenation.d.ts +0 -3
  628. package/vendor/dist/opentracing/test/noop_implementation.d.ts +0 -4
  629. package/vendor/dist/opentracing/test/opentracing_api.d.ts +0 -3
  630. package/vendor/dist/opentracing/test/unittest.d.ts +0 -2
  631. package/vendor/dist/opentracing/tracer.d.ts +0 -127
  632. package/vendor/dist/path-to-regexp/LICENSE +0 -21
  633. package/vendor/dist/path-to-regexp/index.js +0 -1
@@ -68,7 +68,7 @@ message KeyValue {
68
68
  }
69
69
 
70
70
  // InstrumentationScope is a message representing the instrumentation scope information
71
- // such as the fully qualified name and version.
71
+ // such as the fully qualified name and version.
72
72
  message InstrumentationScope {
73
73
  // An empty instrumentation scope name means the name is unknown.
74
74
  string name = 1;
@@ -113,4 +113,4 @@ message EntityRef {
113
113
  // These attribute keys are not part of entity's identity.
114
114
  // These keys MUST exist in the containing {message}.attributes.
115
115
  repeated string description_keys = 4;
116
- }
116
+ }
@@ -223,4 +223,4 @@ message LogRecord {
223
223
  //
224
224
  // [Optional].
225
225
  string event_name = 12;
226
- }
226
+ }
@@ -75,4 +75,4 @@ message ExportLogsPartialSuccess {
75
75
  // error_message is an optional field. An error_message with an empty value
76
76
  // is equivalent to it not being set.
77
77
  string error_message = 2;
78
- }
78
+ }
@@ -717,4 +717,4 @@ message Exemplar {
717
717
  // trace_id may be missing if the measurement is not recorded inside a trace
718
718
  // or if the trace is not sampled.
719
719
  bytes trace_id = 5;
720
- }
720
+ }
@@ -75,4 +75,4 @@ message ExportMetricsPartialSuccess {
75
75
  // error_message is an optional field. An error_message with an empty value
76
76
  // is equivalent to it not being set.
77
77
  string error_message = 2;
78
- }
78
+ }
@@ -1,11 +1,14 @@
1
1
  'use strict'
2
2
 
3
- const http = require('http')
4
- const { URL } = require('url')
3
+ const http = require('node:http')
4
+ const https = require('node:https')
5
+ const { URL } = require('node:url')
6
+ const { storage } = require('../../../../datadog-core')
5
7
  const log = require('../../log')
6
8
  const telemetryMetrics = require('../../telemetry/metrics')
7
9
 
8
10
  const tracerMetrics = telemetryMetrics.manager.namespace('tracers')
11
+ const legacyStorage = storage('legacy')
9
12
 
10
13
  /**
11
14
  * Base class for OTLP HTTP exporters.
@@ -16,39 +19,40 @@ const tracerMetrics = telemetryMetrics.manager.namespace('tracers')
16
19
  * @class OtlpHttpExporterBase
17
20
  */
18
21
  class OtlpHttpExporterBase {
22
+ #transport = https
23
+
19
24
  /**
20
25
  * Creates a new OtlpHttpExporterBase instance.
21
26
  *
22
- * @param {string} url - OTLP endpoint URL
23
- * @param {string|undefined} headers - Additional HTTP headers as comma-separated key=value string
27
+ * @param {string} url - OTLP endpoint URL (callers are expected to supply the full signal URL)
28
+ * @param {Record<string, string>|undefined} headers - Additional HTTP headers parsed from the
29
+ * corresponding `OTEL_EXPORTER_OTLP_*_HEADERS` env by the MAP parser.
24
30
  * @param {number} timeout - Request timeout in milliseconds
25
31
  * @param {string} protocol - OTLP protocol (http/protobuf or http/json)
26
- * @param {string} defaultPath - Default path to use if URL has no path
27
32
  * @param {string} signalType - Signal type for error messages (e.g., 'logs', 'metrics')
28
33
  */
29
- constructor (url, headers, timeout, protocol, defaultPath, signalType) {
30
- const parsedUrl = new URL(url)
31
-
34
+ constructor (url, headers, timeout, protocol, signalType) {
32
35
  this.protocol = protocol
33
36
  this.signalType = signalType
34
37
 
35
- // If no path is provided, use default path
36
- const path = parsedUrl.pathname === '/' ? defaultPath : parsedUrl.pathname
37
38
  const isJson = protocol === 'http/json'
38
39
 
40
+ const parsedUrl = new URL(url)
41
+ this.#transport = parsedUrl.protocol === 'http:' ? http : https
39
42
  this.options = {
40
- hostname: parsedUrl.hostname,
41
- port: parsedUrl.port,
42
- path: path + parsedUrl.search,
43
43
  method: 'POST',
44
44
  timeout,
45
+ hostname: parsedUrl.hostname,
46
+ port: parsedUrl.port,
47
+ path: parsedUrl.pathname + parsedUrl.search,
45
48
  headers: {
46
49
  'Content-Type': isJson ? 'application/json' : 'application/x-protobuf',
47
- ...this.#parseAdditionalHeaders(headers),
50
+ ...headers,
48
51
  },
49
52
  }
53
+
50
54
  this.telemetryTags = [
51
- 'protocol:http',
55
+ `protocol:${this.#transport === https ? 'https' : 'http'}`,
52
56
  `encoding:${isJson ? 'json' : 'protobuf'}`,
53
57
  ]
54
58
  }
@@ -61,6 +65,7 @@ class OtlpHttpExporterBase {
61
65
  * @protected
62
66
  */
63
67
  recordTelemetry (metricName, count, additionalTags) {
68
+ // @ts-expect-error - additionalTags is optional and can be undefined
64
69
  if (additionalTags?.length > 0) {
65
70
  tracerMetrics.count(metricName, [...this.telemetryTags, ...additionalTags || []]).inc(count)
66
71
  } else {
@@ -83,85 +88,54 @@ class OtlpHttpExporterBase {
83
88
  },
84
89
  }
85
90
 
86
- const req = http.request(options, (res) => {
87
- let data = ''
88
-
89
- res.on('data', (chunk) => {
90
- data += chunk
91
+ legacyStorage.run({ noop: true }, () => {
92
+ const req = this.#transport.request(options, (res) => {
93
+ let data = ''
94
+
95
+ res.on('data', (chunk) => {
96
+ data += chunk
97
+ })
98
+
99
+ res.once('end', () => {
100
+ // @ts-expect-error - res.statusCode can be undefined
101
+ if (res.statusCode >= 200 && res.statusCode < 300) {
102
+ resultCallback({ code: 0 })
103
+ } else {
104
+ const error = new Error(`HTTP ${res.statusCode}: ${data}`)
105
+ resultCallback({ code: 1, error })
106
+ }
107
+ })
91
108
  })
92
109
 
93
- res.once('end', () => {
94
- if (res.statusCode >= 200 && res.statusCode < 300) {
95
- resultCallback({ code: 0 })
96
- } else {
97
- const error = new Error(`HTTP ${res.statusCode}: ${data}`)
98
- resultCallback({ code: 1, error })
99
- }
110
+ req.on('error', (error) => {
111
+ log.error('Error sending OTLP %s:', this.signalType, error)
112
+ resultCallback({ code: 1, error })
100
113
  })
101
- })
102
114
 
103
- req.on('error', (error) => {
104
- log.error('Error sending OTLP %s:', this.signalType, error)
105
- resultCallback({ code: 1, error })
106
- })
115
+ req.once('timeout', () => {
116
+ req.destroy()
117
+ const error = new Error('Request timeout')
118
+ resultCallback({ code: 1, error })
119
+ })
107
120
 
108
- req.once('timeout', () => {
109
- req.destroy()
110
- const error = new Error('Request timeout')
111
- resultCallback({ code: 1, error })
121
+ req.write(payload)
122
+ req.end()
112
123
  })
113
-
114
- req.write(payload)
115
- req.end()
116
124
  }
117
125
 
118
126
  /**
119
- * Parses additional HTTP headers from a comma-separated string.
120
- * @param {string} [headersString=''] - Comma-separated key=value pairs
121
- * @returns {Record<string, string>} Parsed headers object
127
+ * Re-targets the exporter to a different URL, updating transport, hostname, port, and path.
128
+ * @param {string} url
122
129
  */
123
- #parseAdditionalHeaders (headersString = '') {
124
- const headers = {}
125
- let key = ''
126
- let value = ''
127
- let readingKey = true
128
-
129
- for (const char of headersString) {
130
- if (readingKey) {
131
- if (char === '=') {
132
- readingKey = false
133
- key = key.trim()
134
- } else {
135
- key += char
136
- }
137
- } else if (char === ',') {
138
- value = value.trim()
139
- if (key && value) {
140
- headers[key] = value
141
- }
142
- key = ''
143
- value = ''
144
- readingKey = true
145
- } else {
146
- value += char
147
- }
148
- }
149
-
150
- // Add the last pair if present
151
- if (!readingKey) {
152
- value = value.trim()
153
- if (value) {
154
- headers[key] = value
155
- }
156
- }
157
-
158
- return headers
130
+ setUrl (url) {
131
+ const parsedUrl = new URL(url)
132
+ this.#transport = parsedUrl.protocol === 'http:' ? http : https
133
+ this.options.hostname = parsedUrl.hostname
134
+ this.options.port = parsedUrl.port
135
+ this.options.path = parsedUrl.pathname + parsedUrl.search
136
+ this.telemetryTags[0] = `protocol:${this.#transport === https ? 'https' : 'http'}`
159
137
  }
160
138
 
161
- /**
162
- * Shuts down the exporter.
163
- * Subclasses can override to add cleanup logic.
164
- */
165
139
  shutdown () {}
166
140
  }
167
141
 
@@ -141,8 +141,7 @@ class OtlpTransformerBase {
141
141
  */
142
142
  serializeToProtobuf (protoType, data) {
143
143
  const message = protoType.create(data)
144
- const buffer = protoType.encode(message).finish()
145
- return buffer
144
+ return protoType.encode(message).finish()
146
145
  }
147
146
 
148
147
  /**
@@ -1,9 +1,9 @@
1
1
  'use strict'
2
2
 
3
3
  /**
4
- * Protobuf Loader for OpenTelemetry Logs and Metrics
4
+ * Protobuf Loader for OpenTelemetry Logs, Traces, and Metrics
5
5
  *
6
- * This module loads protobuf definitions for OpenTelemetry logs and metrics.
6
+ * This module loads protobuf definitions for OpenTelemetry logs, traces, and metrics.
7
7
  *
8
8
  * VERSION SUPPORT:
9
9
  * - OTLP Protocol: v1.7.0
@@ -20,6 +20,8 @@ const protobuf = require('../../../../../vendor/dist/protobufjs')
20
20
  let _root = null
21
21
  let protoLogsService = null
22
22
  let protoSeverityNumber = null
23
+ let protoTraceService = null
24
+ let protoSpanKind = null
23
25
  let protoMetricsService = null
24
26
  let protoAggregationTemporality = null
25
27
 
@@ -28,6 +30,8 @@ function getProtobufTypes () {
28
30
  return {
29
31
  protoLogsService,
30
32
  protoSeverityNumber,
33
+ protoTraceService,
34
+ protoSpanKind,
31
35
  protoMetricsService,
32
36
  protoAggregationTemporality,
33
37
  }
@@ -39,6 +43,8 @@ function getProtobufTypes () {
39
43
  'resource.proto',
40
44
  'logs.proto',
41
45
  'logs_service.proto',
46
+ 'trace.proto',
47
+ 'trace_service.proto',
42
48
  'metrics.proto',
43
49
  'metrics_service.proto',
44
50
  ].map(file => path.join(protoDir, file))
@@ -49,6 +55,10 @@ function getProtobufTypes () {
49
55
  protoLogsService = _root.lookupType('opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest')
50
56
  protoSeverityNumber = _root.lookupEnum('opentelemetry.proto.logs.v1.SeverityNumber')
51
57
 
58
+ // Get the message types for traces
59
+ protoTraceService = _root.lookupType('opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest')
60
+ protoSpanKind = _root.lookupEnum('opentelemetry.proto.trace.v1.SpanKind')
61
+
52
62
  // Get the message types for metrics
53
63
  protoMetricsService = _root.lookupType('opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest')
54
64
  protoAggregationTemporality = _root.lookupEnum('opentelemetry.proto.metrics.v1.AggregationTemporality')
@@ -56,6 +66,8 @@ function getProtobufTypes () {
56
66
  return {
57
67
  protoLogsService,
58
68
  protoSeverityNumber,
69
+ protoTraceService,
70
+ protoSpanKind,
59
71
  protoMetricsService,
60
72
  protoAggregationTemporality,
61
73
  }
@@ -0,0 +1,358 @@
1
+ // Vendored from: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.7.0/opentelemetry/proto/trace/v1/trace.proto
2
+ // Copyright 2019, OpenTelemetry Authors
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+
16
+ syntax = "proto3";
17
+
18
+ package opentelemetry.proto.trace.v1;
19
+
20
+ import "common.proto";
21
+ import "resource.proto";
22
+
23
+ option csharp_namespace = "OpenTelemetry.Proto.Trace.V1";
24
+ option java_multiple_files = true;
25
+ option java_package = "io.opentelemetry.proto.trace.v1";
26
+ option java_outer_classname = "TraceProto";
27
+ option go_package = "go.opentelemetry.io/proto/otlp/trace/v1";
28
+
29
+ // TracesData represents the traces data that can be stored in a persistent storage,
30
+ // OR can be embedded by other protocols that transfer OTLP traces data but do
31
+ // not implement the OTLP protocol.
32
+ //
33
+ // The main difference between this message and collector protocol is that
34
+ // in this message there will not be any "control" or "metadata" specific to
35
+ // OTLP protocol.
36
+ //
37
+ // When new fields are added into this message, the OTLP request MUST be updated
38
+ // as well.
39
+ message TracesData {
40
+ // An array of ResourceSpans.
41
+ // For data coming from a single resource this array will typically contain
42
+ // one element. Intermediary nodes that receive data from multiple origins
43
+ // typically batch the data before forwarding further and in that case this
44
+ // array will contain multiple elements.
45
+ repeated ResourceSpans resource_spans = 1;
46
+ }
47
+
48
+ // A collection of ScopeSpans from a Resource.
49
+ message ResourceSpans {
50
+ reserved 1000;
51
+
52
+ // The resource for the spans in this message.
53
+ // If this field is not set then no resource info is known.
54
+ opentelemetry.proto.resource.v1.Resource resource = 1;
55
+
56
+ // A list of ScopeSpans that originate from a resource.
57
+ repeated ScopeSpans scope_spans = 2;
58
+
59
+ // The Schema URL, if known. This is the identifier of the Schema that the resource data
60
+ // is recorded in. Notably, the last part of the URL path is the version number of the
61
+ // schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see
62
+ // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
63
+ // This schema_url applies to the data in the "resource" field. It does not apply
64
+ // to the data in the "scope_spans" field which have their own schema_url field.
65
+ string schema_url = 3;
66
+ }
67
+
68
+ // A collection of Spans produced by an InstrumentationScope.
69
+ message ScopeSpans {
70
+ // The instrumentation scope information for the spans in this message.
71
+ // Semantically when InstrumentationScope isn't set, it is equivalent with
72
+ // an empty instrumentation scope name (unknown).
73
+ opentelemetry.proto.common.v1.InstrumentationScope scope = 1;
74
+
75
+ // A list of Spans that originate from an instrumentation scope.
76
+ repeated Span spans = 2;
77
+
78
+ // The Schema URL, if known. This is the identifier of the Schema that the span data
79
+ // is recorded in. Notably, the last part of the URL path is the version number of the
80
+ // schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see
81
+ // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
82
+ // This schema_url applies to all spans and span events in the "spans" field.
83
+ string schema_url = 3;
84
+ }
85
+
86
+ // A Span represents a single operation performed by a single component of the system.
87
+ //
88
+ // The next available field id is 17.
89
+ message Span {
90
+ // A unique identifier for a trace. All spans from the same trace share
91
+ // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR
92
+ // of length other than 16 bytes is considered invalid (empty string in OTLP/JSON
93
+ // is zero-length and thus is also invalid).
94
+ //
95
+ // This field is required.
96
+ bytes trace_id = 1;
97
+
98
+ // A unique identifier for a span within a trace, assigned when the span
99
+ // is created. The ID is an 8-byte array. An ID with all zeroes OR of length
100
+ // other than 8 bytes is considered invalid (empty string in OTLP/JSON
101
+ // is zero-length and thus is also invalid).
102
+ //
103
+ // This field is required.
104
+ bytes span_id = 2;
105
+
106
+ // trace_state conveys information about request position in multiple distributed tracing graphs.
107
+ // It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header
108
+ // See also https://github.com/w3c/distributed-tracing for more details about this field.
109
+ string trace_state = 3;
110
+
111
+ // The `span_id` of this span's parent span. If this is a root span, then this
112
+ // field must be empty. The ID is an 8-byte array.
113
+ bytes parent_span_id = 4;
114
+
115
+ // Flags, a bit field.
116
+ //
117
+ // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
118
+ // Context specification. To read the 8-bit W3C trace flag, use
119
+ // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
120
+ //
121
+ // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
122
+ //
123
+ // Bits 8 and 9 represent the 3 states of whether a span's parent
124
+ // is remote. The states are (unknown, is not remote, is remote).
125
+ // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
126
+ // To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
127
+ //
128
+ // When creating span messages, if the message is logically forwarded from another source
129
+ // with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD
130
+ // be copied as-is. If creating from a source that does not have an equivalent flags field
131
+ // (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST
132
+ // be set to zero.
133
+ // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
134
+ //
135
+ // [Optional].
136
+ fixed32 flags = 16;
137
+
138
+ // A description of the span's operation.
139
+ //
140
+ // For example, the name can be a qualified method name or a file name
141
+ // and a line number where the operation is called. A best practice is to use
142
+ // the same display name at the same call point in an application.
143
+ // This makes it easier to correlate spans in different traces.
144
+ //
145
+ // This field is semantically required to be set to non-empty string.
146
+ // Empty value is equivalent to an unknown span name.
147
+ //
148
+ // This field is required.
149
+ string name = 5;
150
+
151
+ // SpanKind is the type of span. Can be used to specify additional relationships between spans
152
+ // in addition to a parent/child relationship.
153
+ enum SpanKind {
154
+ // Unspecified. Do NOT use as default.
155
+ // Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED.
156
+ SPAN_KIND_UNSPECIFIED = 0;
157
+
158
+ // Indicates that the span represents an internal operation within an application,
159
+ // as opposed to an operation happening at the boundaries. Default value.
160
+ SPAN_KIND_INTERNAL = 1;
161
+
162
+ // Indicates that the span covers server-side handling of an RPC or other
163
+ // remote network request.
164
+ SPAN_KIND_SERVER = 2;
165
+
166
+ // Indicates that the span describes a request to some remote service.
167
+ SPAN_KIND_CLIENT = 3;
168
+
169
+ // Indicates that the span describes a producer sending a message to a broker.
170
+ // Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
171
+ // between producer and consumer spans. A PRODUCER span ends when the message was accepted
172
+ // by the broker while the logical processing of the message might span a much longer time.
173
+ SPAN_KIND_PRODUCER = 4;
174
+
175
+ // Indicates that the span describes consumer receiving a message from a broker.
176
+ // Like the PRODUCER kind, there is often no direct critical path latency relationship
177
+ // between producer and consumer spans.
178
+ SPAN_KIND_CONSUMER = 5;
179
+ }
180
+
181
+ // Distinguishes between spans generated in a particular context. For example,
182
+ // two spans with the same name may be distinguished using `CLIENT` (caller)
183
+ // and `SERVER` (callee) to identify queueing latency associated with the span.
184
+ SpanKind kind = 6;
185
+
186
+ // start_time_unix_nano is the start time of the span. On the client side, this is the time
187
+ // kept by the local machine where the span execution starts. On the server side, this
188
+ // is the time when the server's application handler starts running.
189
+ // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
190
+ //
191
+ // This field is semantically required and it is expected that end_time >= start_time.
192
+ fixed64 start_time_unix_nano = 7;
193
+
194
+ // end_time_unix_nano is the end time of the span. On the client side, this is the time
195
+ // kept by the local machine where the span execution ends. On the server side, this
196
+ // is the time when the server application handler stops running.
197
+ // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
198
+ //
199
+ // This field is semantically required and it is expected that end_time >= start_time.
200
+ fixed64 end_time_unix_nano = 8;
201
+
202
+ // attributes is a collection of key/value pairs. Note, global attributes
203
+ // like server name can be set using the resource API. Examples of attributes:
204
+ //
205
+ // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
206
+ // "/http/server_latency": 300
207
+ // "example.com/myattribute": true
208
+ // "example.com/score": 10.239
209
+ //
210
+ // The OpenTelemetry API specification further restricts the allowed value types:
211
+ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute
212
+ // Attribute keys MUST be unique (it is not allowed to have more than one
213
+ // attribute with the same key).
214
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;
215
+
216
+ // dropped_attributes_count is the number of attributes that were discarded. Attributes
217
+ // can be discarded because their keys are too long or because there are too many
218
+ // attributes. If this value is 0, then no attributes were dropped.
219
+ uint32 dropped_attributes_count = 10;
220
+
221
+ // Event is a time-stamped annotation of the span, consisting of user-supplied
222
+ // text description and key-value pairs.
223
+ message Event {
224
+ // time_unix_nano is the time the event occurred.
225
+ fixed64 time_unix_nano = 1;
226
+
227
+ // name of the event.
228
+ // This field is semantically required to be set to non-empty string.
229
+ string name = 2;
230
+
231
+ // attributes is a collection of attribute key/value pairs on the event.
232
+ // Attribute keys MUST be unique (it is not allowed to have more than one
233
+ // attribute with the same key).
234
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 3;
235
+
236
+ // dropped_attributes_count is the number of dropped attributes. If the value is 0,
237
+ // then no attributes were dropped.
238
+ uint32 dropped_attributes_count = 4;
239
+ }
240
+
241
+ // events is a collection of Event items.
242
+ repeated Event events = 11;
243
+
244
+ // dropped_events_count is the number of dropped events. If the value is 0, then no
245
+ // events were dropped.
246
+ uint32 dropped_events_count = 12;
247
+
248
+ // A pointer from the current span to another span in the same trace or in a
249
+ // different trace. For example, this can be used in batching operations,
250
+ // where a single batch handler processes multiple requests from different
251
+ // traces or when the handler receives a request from a different project.
252
+ message Link {
253
+ // A unique identifier of a trace that this linked span is part of. The ID is a
254
+ // 16-byte array.
255
+ bytes trace_id = 1;
256
+
257
+ // A unique identifier for the linked span. The ID is an 8-byte array.
258
+ bytes span_id = 2;
259
+
260
+ // The trace_state associated with the link.
261
+ string trace_state = 3;
262
+
263
+ // attributes is a collection of attribute key/value pairs on the link.
264
+ // Attribute keys MUST be unique (it is not allowed to have more than one
265
+ // attribute with the same key).
266
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 4;
267
+
268
+ // dropped_attributes_count is the number of dropped attributes. If the value is 0,
269
+ // then no attributes were dropped.
270
+ uint32 dropped_attributes_count = 5;
271
+
272
+ // Flags, a bit field.
273
+ //
274
+ // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
275
+ // Context specification. To read the 8-bit W3C trace flag, use
276
+ // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
277
+ //
278
+ // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
279
+ //
280
+ // Bits 8 and 9 represent the 3 states of whether the link is remote.
281
+ // The states are (unknown, is not remote, is remote).
282
+ // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
283
+ // To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
284
+ //
285
+ // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
286
+ // When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero.
287
+ //
288
+ // [Optional].
289
+ fixed32 flags = 6;
290
+ }
291
+
292
+ // links is a collection of Links, which are references from this span to a span
293
+ // in the same or different trace.
294
+ repeated Link links = 13;
295
+
296
+ // dropped_links_count is the number of dropped links after the maximum size was
297
+ // enforced. If this value is 0, then no links were dropped.
298
+ uint32 dropped_links_count = 14;
299
+
300
+ // An optional final status for this span. Semantically when Status isn't set, it means
301
+ // span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0).
302
+ Status status = 15;
303
+ }
304
+
305
+ // The Status type defines a logical error model that is suitable for different
306
+ // programming environments, including REST APIs and RPC APIs.
307
+ message Status {
308
+ reserved 1;
309
+
310
+ // A developer-facing human readable error message.
311
+ string message = 2;
312
+
313
+ // For the semantics of status codes see
314
+ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
315
+ enum StatusCode {
316
+ // The default status.
317
+ STATUS_CODE_UNSET = 0;
318
+ // The Span has been validated by an Application developer or Operator to
319
+ // have completed successfully.
320
+ STATUS_CODE_OK = 1;
321
+ // The Span contains an error.
322
+ STATUS_CODE_ERROR = 2;
323
+ };
324
+
325
+ // The status code.
326
+ StatusCode code = 3;
327
+ }
328
+
329
+ // SpanFlags represents constants used to interpret the
330
+ // Span.flags field, which is protobuf 'fixed32' type and is to
331
+ // be used as bit-fields. Each non-zero value defined in this enum is
332
+ // a bit-mask. To extract the bit-field, for example, use an
333
+ // expression like:
334
+ //
335
+ // (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK)
336
+ //
337
+ // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
338
+ //
339
+ // Note that Span flags were introduced in version 1.1 of the
340
+ // OpenTelemetry protocol. Older Span producers do not set this
341
+ // field, consequently consumers should not rely on the absence of a
342
+ // particular flag bit to indicate the presence of a particular feature.
343
+ enum SpanFlags {
344
+ // The zero value for the enum. Should not be used for comparisons.
345
+ // Instead use bitwise "and" with the appropriate mask as shown above.
346
+ SPAN_FLAGS_DO_NOT_USE = 0;
347
+
348
+ // Bits 0-7 are used for trace flags.
349
+ SPAN_FLAGS_TRACE_FLAGS_MASK = 0x000000FF;
350
+
351
+ // Bits 8 and 9 are used to indicate that the parent span or link span is remote.
352
+ // Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
353
+ // Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.
354
+ SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 0x00000100;
355
+ SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 0x00000200;
356
+
357
+ // Bits 10-31 are reserved for future use.
358
+ }