@sentry/node 10.58.0 → 10.60.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 (561) hide show
  1. package/build/cjs/index.js +3 -0
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/fs/index.js +3 -84
  4. package/build/cjs/integrations/fs/index.js.map +1 -1
  5. package/build/cjs/integrations/fs/vendored/constants.js.map +1 -1
  6. package/build/cjs/integrations/fs/vendored/instrumentation.js +145 -175
  7. package/build/cjs/integrations/fs/vendored/instrumentation.js.map +1 -1
  8. package/build/cjs/integrations/fs/vendored/utils.js.map +1 -1
  9. package/build/cjs/integrations/node-fetch/index.js +7 -8
  10. package/build/cjs/integrations/node-fetch/index.js.map +1 -1
  11. package/build/cjs/integrations/node-fetch/vendored/semconv.js +28 -0
  12. package/build/cjs/integrations/node-fetch/vendored/semconv.js.map +1 -0
  13. package/build/cjs/integrations/node-fetch/vendored/undici.js +91 -127
  14. package/build/cjs/integrations/node-fetch/vendored/undici.js.map +1 -1
  15. package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
  16. package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +1 -1
  17. package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
  18. package/build/cjs/integrations/tracing/amqplib/vendored/types.js.map +1 -1
  19. package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
  20. package/build/cjs/integrations/tracing/connect/index.js +0 -21
  21. package/build/cjs/integrations/tracing/connect/index.js.map +1 -1
  22. package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js +0 -6
  23. package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -1
  24. package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js +33 -42
  25. package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
  26. package/build/cjs/integrations/tracing/connect/vendored/internal-types.js.map +1 -1
  27. package/build/cjs/integrations/tracing/connect/vendored/utils.js +3 -2
  28. package/build/cjs/integrations/tracing/connect/vendored/utils.js.map +1 -1
  29. package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
  30. package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +1 -1
  31. package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
  32. package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js.map +1 -1
  33. package/build/cjs/integrations/tracing/genericPool/index.js +1 -15
  34. package/build/cjs/integrations/tracing/genericPool/index.js.map +1 -1
  35. package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js +30 -18
  36. package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -1
  37. package/build/cjs/integrations/tracing/graphql/index.js +1 -51
  38. package/build/cjs/integrations/tracing/graphql/index.js.map +1 -1
  39. package/build/cjs/integrations/tracing/graphql/vendored/enum.js.map +1 -1
  40. package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js +0 -2
  41. package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -1
  42. package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js +67 -57
  43. package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
  44. package/build/cjs/integrations/tracing/graphql/vendored/internal-types.js.map +1 -1
  45. package/build/cjs/integrations/tracing/graphql/vendored/symbols.js.map +1 -1
  46. package/build/cjs/integrations/tracing/graphql/vendored/utils.js +28 -62
  47. package/build/cjs/integrations/tracing/graphql/vendored/utils.js.map +1 -1
  48. package/build/cjs/integrations/tracing/hapi/index.js +0 -17
  49. package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
  50. package/build/cjs/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -1
  51. package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js +28 -45
  52. package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
  53. package/build/cjs/integrations/tracing/hapi/vendored/internal-types.js.map +1 -1
  54. package/build/cjs/integrations/tracing/hapi/vendored/semconv.js.map +1 -1
  55. package/build/cjs/integrations/tracing/hapi/vendored/utils.js +4 -9
  56. package/build/cjs/integrations/tracing/hapi/vendored/utils.js.map +1 -1
  57. package/build/cjs/integrations/tracing/index.js +1 -0
  58. package/build/cjs/integrations/tracing/index.js.map +1 -1
  59. package/build/cjs/integrations/tracing/kafka/index.js +1 -11
  60. package/build/cjs/integrations/tracing/kafka/index.js.map +1 -1
  61. package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js +45 -247
  62. package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
  63. package/build/cjs/integrations/tracing/kafka/vendored/semconv.js +4 -8
  64. package/build/cjs/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
  65. package/build/cjs/integrations/tracing/kafka/vendored/utils.js +113 -0
  66. package/build/cjs/integrations/tracing/kafka/vendored/utils.js.map +1 -0
  67. package/build/cjs/integrations/tracing/knex/index.js +2 -17
  68. package/build/cjs/integrations/tracing/knex/index.js.map +1 -1
  69. package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +65 -93
  70. package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
  71. package/build/cjs/integrations/tracing/knex/vendored/semconv.js +2 -0
  72. package/build/cjs/integrations/tracing/knex/vendored/semconv.js.map +1 -1
  73. package/build/cjs/integrations/tracing/knex/vendored/utils.js +2 -15
  74. package/build/cjs/integrations/tracing/knex/vendored/utils.js.map +1 -1
  75. package/build/cjs/integrations/tracing/koa/index.js +1 -24
  76. package/build/cjs/integrations/tracing/koa/index.js.map +1 -1
  77. package/build/cjs/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -1
  78. package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js +29 -41
  79. package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
  80. package/build/cjs/integrations/tracing/koa/vendored/internal-types.js.map +1 -1
  81. package/build/cjs/integrations/tracing/koa/vendored/types.js.map +1 -1
  82. package/build/cjs/integrations/tracing/koa/vendored/utils.js.map +1 -1
  83. package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
  84. package/build/cjs/integrations/tracing/mongo/index.js +1 -42
  85. package/build/cjs/integrations/tracing/mongo/index.js.map +1 -1
  86. package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js +12 -562
  87. package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
  88. package/build/cjs/integrations/tracing/mongo/vendored/internal-types.js.map +1 -1
  89. package/build/cjs/integrations/tracing/mongo/vendored/patches.js +151 -0
  90. package/build/cjs/integrations/tracing/mongo/vendored/patches.js.map +1 -0
  91. package/build/cjs/integrations/tracing/mongo/vendored/semconv.js +0 -4
  92. package/build/cjs/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
  93. package/build/cjs/integrations/tracing/mongo/vendored/utils.js +153 -0
  94. package/build/cjs/integrations/tracing/mongo/vendored/utils.js.map +1 -0
  95. package/build/cjs/integrations/tracing/mongoose/index.js +1 -8
  96. package/build/cjs/integrations/tracing/mongoose/index.js.map +1 -1
  97. package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js +56 -203
  98. package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
  99. package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js +0 -4
  100. package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
  101. package/build/cjs/integrations/tracing/mongoose/vendored/utils.js +19 -49
  102. package/build/cjs/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
  103. package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js.map +1 -1
  104. package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
  105. package/build/cjs/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
  106. package/build/cjs/integrations/tracing/mysql/vendored/utils.js.map +1 -1
  107. package/build/cjs/integrations/tracing/mysql2/index.js +1 -8
  108. package/build/cjs/integrations/tracing/mysql2/index.js.map +1 -1
  109. package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +21 -59
  110. package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
  111. package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
  112. package/build/cjs/integrations/tracing/mysql2/vendored/utils.js +14 -33
  113. package/build/cjs/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
  114. package/build/cjs/integrations/tracing/postgres/index.js +0 -4
  115. package/build/cjs/integrations/tracing/postgres/index.js.map +1 -1
  116. package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js +0 -1
  117. package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -1
  118. package/build/cjs/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -1
  119. package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js +51 -261
  120. package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
  121. package/build/cjs/integrations/tracing/postgres/vendored/semconv.js +0 -12
  122. package/build/cjs/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
  123. package/build/cjs/integrations/tracing/postgres/vendored/utils.js +43 -167
  124. package/build/cjs/integrations/tracing/postgres/vendored/utils.js.map +1 -1
  125. package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
  126. package/build/cjs/integrations/tracing/prisma/vendored/constants.js.map +1 -1
  127. package/build/cjs/integrations/tracing/prisma/vendored/global.js.map +1 -1
  128. package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
  129. package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
  130. package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +89 -160
  131. package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
  132. package/build/cjs/integrations/tracing/redis/vendored/redis-common.js.map +1 -1
  133. package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +92 -231
  134. package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
  135. package/build/cjs/integrations/tracing/redis/vendored/semconv.js +0 -2
  136. package/build/cjs/integrations/tracing/redis/vendored/semconv.js.map +1 -1
  137. package/build/cjs/integrations/tracing/tedious/index.js +1 -25
  138. package/build/cjs/integrations/tracing/tedious/index.js.map +1 -1
  139. package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js +25 -76
  140. package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
  141. package/build/cjs/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
  142. package/build/cjs/integrations/tracing/tedious/vendored/utils.js.map +1 -1
  143. package/build/cjs/sdk/diagnosticsChannelInjection.js +21 -0
  144. package/build/cjs/sdk/diagnosticsChannelInjection.js.map +1 -0
  145. package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js +19 -0
  146. package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
  147. package/build/cjs/sdk/index.js +17 -1
  148. package/build/cjs/sdk/index.js.map +1 -1
  149. package/build/cjs/sdk/initOtel.js +2 -1
  150. package/build/cjs/sdk/initOtel.js.map +1 -1
  151. package/build/esm/index.js +2 -1
  152. package/build/esm/index.js.map +1 -1
  153. package/build/esm/integrations/fs/index.js +4 -85
  154. package/build/esm/integrations/fs/index.js.map +1 -1
  155. package/build/esm/integrations/fs/vendored/constants.js.map +1 -1
  156. package/build/esm/integrations/fs/vendored/instrumentation.js +147 -177
  157. package/build/esm/integrations/fs/vendored/instrumentation.js.map +1 -1
  158. package/build/esm/integrations/fs/vendored/utils.js.map +1 -1
  159. package/build/esm/integrations/node-fetch/index.js +8 -9
  160. package/build/esm/integrations/node-fetch/index.js.map +1 -1
  161. package/build/esm/integrations/node-fetch/vendored/semconv.js +15 -0
  162. package/build/esm/integrations/node-fetch/vendored/semconv.js.map +1 -0
  163. package/build/esm/integrations/node-fetch/vendored/undici.js +80 -116
  164. package/build/esm/integrations/node-fetch/vendored/undici.js.map +1 -1
  165. package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
  166. package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +1 -1
  167. package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
  168. package/build/esm/integrations/tracing/amqplib/vendored/types.js.map +1 -1
  169. package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
  170. package/build/esm/integrations/tracing/connect/index.js +1 -22
  171. package/build/esm/integrations/tracing/connect/index.js.map +1 -1
  172. package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js +1 -6
  173. package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -1
  174. package/build/esm/integrations/tracing/connect/vendored/instrumentation.js +36 -44
  175. package/build/esm/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
  176. package/build/esm/integrations/tracing/connect/vendored/internal-types.js.map +1 -1
  177. package/build/esm/integrations/tracing/connect/vendored/utils.js +3 -2
  178. package/build/esm/integrations/tracing/connect/vendored/utils.js.map +1 -1
  179. package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
  180. package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +1 -1
  181. package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
  182. package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js.map +1 -1
  183. package/build/esm/integrations/tracing/genericPool/index.js +3 -17
  184. package/build/esm/integrations/tracing/genericPool/index.js.map +1 -1
  185. package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js +31 -19
  186. package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -1
  187. package/build/esm/integrations/tracing/graphql/index.js +3 -53
  188. package/build/esm/integrations/tracing/graphql/index.js.map +1 -1
  189. package/build/esm/integrations/tracing/graphql/vendored/enum.js.map +1 -1
  190. package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js +0 -2
  191. package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -1
  192. package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js +69 -59
  193. package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
  194. package/build/esm/integrations/tracing/graphql/vendored/internal-types.js.map +1 -1
  195. package/build/esm/integrations/tracing/graphql/vendored/symbols.js.map +1 -1
  196. package/build/esm/integrations/tracing/graphql/vendored/utils.js +29 -62
  197. package/build/esm/integrations/tracing/graphql/vendored/utils.js.map +1 -1
  198. package/build/esm/integrations/tracing/hapi/index.js +1 -18
  199. package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
  200. package/build/esm/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -1
  201. package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js +30 -47
  202. package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
  203. package/build/esm/integrations/tracing/hapi/vendored/internal-types.js.map +1 -1
  204. package/build/esm/integrations/tracing/hapi/vendored/semconv.js.map +1 -1
  205. package/build/esm/integrations/tracing/hapi/vendored/utils.js +5 -10
  206. package/build/esm/integrations/tracing/hapi/vendored/utils.js.map +1 -1
  207. package/build/esm/integrations/tracing/index.js +1 -0
  208. package/build/esm/integrations/tracing/index.js.map +1 -1
  209. package/build/esm/integrations/tracing/kafka/index.js +2 -12
  210. package/build/esm/integrations/tracing/kafka/index.js.map +1 -1
  211. package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js +47 -249
  212. package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
  213. package/build/esm/integrations/tracing/kafka/vendored/semconv.js +3 -5
  214. package/build/esm/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
  215. package/build/esm/integrations/tracing/kafka/vendored/utils.js +107 -0
  216. package/build/esm/integrations/tracing/kafka/vendored/utils.js.map +1 -0
  217. package/build/esm/integrations/tracing/knex/index.js +4 -19
  218. package/build/esm/integrations/tracing/knex/index.js.map +1 -1
  219. package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +66 -94
  220. package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
  221. package/build/esm/integrations/tracing/knex/vendored/semconv.js +2 -1
  222. package/build/esm/integrations/tracing/knex/vendored/semconv.js.map +1 -1
  223. package/build/esm/integrations/tracing/knex/vendored/utils.js +3 -15
  224. package/build/esm/integrations/tracing/knex/vendored/utils.js.map +1 -1
  225. package/build/esm/integrations/tracing/koa/index.js +3 -26
  226. package/build/esm/integrations/tracing/koa/index.js.map +1 -1
  227. package/build/esm/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -1
  228. package/build/esm/integrations/tracing/koa/vendored/instrumentation.js +31 -43
  229. package/build/esm/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
  230. package/build/esm/integrations/tracing/koa/vendored/internal-types.js.map +1 -1
  231. package/build/esm/integrations/tracing/koa/vendored/types.js.map +1 -1
  232. package/build/esm/integrations/tracing/koa/vendored/utils.js.map +1 -1
  233. package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
  234. package/build/esm/integrations/tracing/mongo/index.js +3 -43
  235. package/build/esm/integrations/tracing/mongo/index.js.map +1 -1
  236. package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js +13 -563
  237. package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
  238. package/build/esm/integrations/tracing/mongo/vendored/internal-types.js.map +1 -1
  239. package/build/esm/integrations/tracing/mongo/vendored/patches.js +143 -0
  240. package/build/esm/integrations/tracing/mongo/vendored/patches.js.map +1 -0
  241. package/build/esm/integrations/tracing/mongo/vendored/semconv.js +1 -3
  242. package/build/esm/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
  243. package/build/esm/integrations/tracing/mongo/vendored/utils.js +146 -0
  244. package/build/esm/integrations/tracing/mongo/vendored/utils.js.map +1 -0
  245. package/build/esm/integrations/tracing/mongoose/index.js +2 -9
  246. package/build/esm/integrations/tracing/mongoose/index.js.map +1 -1
  247. package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js +59 -206
  248. package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
  249. package/build/esm/integrations/tracing/mongoose/vendored/semconv.js +1 -3
  250. package/build/esm/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
  251. package/build/esm/integrations/tracing/mongoose/vendored/utils.js +20 -50
  252. package/build/esm/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
  253. package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js.map +1 -1
  254. package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
  255. package/build/esm/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
  256. package/build/esm/integrations/tracing/mysql/vendored/utils.js.map +1 -1
  257. package/build/esm/integrations/tracing/mysql2/index.js +2 -9
  258. package/build/esm/integrations/tracing/mysql2/index.js.map +1 -1
  259. package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +26 -64
  260. package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
  261. package/build/esm/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
  262. package/build/esm/integrations/tracing/mysql2/vendored/utils.js +15 -34
  263. package/build/esm/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
  264. package/build/esm/integrations/tracing/postgres/index.js +1 -5
  265. package/build/esm/integrations/tracing/postgres/index.js.map +1 -1
  266. package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js +0 -1
  267. package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -1
  268. package/build/esm/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -1
  269. package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js +52 -262
  270. package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
  271. package/build/esm/integrations/tracing/postgres/vendored/semconv.js +1 -7
  272. package/build/esm/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
  273. package/build/esm/integrations/tracing/postgres/vendored/utils.js +44 -165
  274. package/build/esm/integrations/tracing/postgres/vendored/utils.js.map +1 -1
  275. package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
  276. package/build/esm/integrations/tracing/prisma/vendored/constants.js.map +1 -1
  277. package/build/esm/integrations/tracing/prisma/vendored/global.js.map +1 -1
  278. package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
  279. package/build/esm/integrations/tracing/redis/index.js.map +1 -1
  280. package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +92 -163
  281. package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
  282. package/build/esm/integrations/tracing/redis/vendored/redis-common.js.map +1 -1
  283. package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +94 -233
  284. package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
  285. package/build/esm/integrations/tracing/redis/vendored/semconv.js +1 -2
  286. package/build/esm/integrations/tracing/redis/vendored/semconv.js.map +1 -1
  287. package/build/esm/integrations/tracing/tedious/index.js +3 -27
  288. package/build/esm/integrations/tracing/tedious/index.js.map +1 -1
  289. package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js +29 -79
  290. package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
  291. package/build/esm/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
  292. package/build/esm/integrations/tracing/tedious/vendored/utils.js.map +1 -1
  293. package/build/esm/package.json +1 -1
  294. package/build/esm/sdk/diagnosticsChannelInjection.js +17 -0
  295. package/build/esm/sdk/diagnosticsChannelInjection.js.map +1 -0
  296. package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js +17 -0
  297. package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
  298. package/build/esm/sdk/index.js +17 -1
  299. package/build/esm/sdk/index.js.map +1 -1
  300. package/build/esm/sdk/initOtel.js +2 -1
  301. package/build/esm/sdk/initOtel.js.map +1 -1
  302. package/build/import-hook.mjs +6 -0
  303. package/build/types/index.d.ts +2 -1
  304. package/build/types/index.d.ts.map +1 -1
  305. package/build/types/integrations/fs/index.d.ts.map +1 -1
  306. package/build/types/integrations/fs/vendored/constants.d.ts.map +1 -1
  307. package/build/types/integrations/fs/vendored/instrumentation.d.ts +6 -10
  308. package/build/types/integrations/fs/vendored/instrumentation.d.ts.map +1 -1
  309. package/build/types/integrations/fs/vendored/types.d.ts +10 -15
  310. package/build/types/integrations/fs/vendored/types.d.ts.map +1 -1
  311. package/build/types/integrations/fs/vendored/utils.d.ts +2 -2
  312. package/build/types/integrations/fs/vendored/utils.d.ts.map +1 -1
  313. package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
  314. package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +1 -1
  315. package/build/types/integrations/node-fetch/vendored/semconv.d.ts +13 -0
  316. package/build/types/integrations/node-fetch/vendored/semconv.d.ts.map +1 -0
  317. package/build/types/integrations/node-fetch/vendored/types.d.ts +2 -4
  318. package/build/types/integrations/node-fetch/vendored/types.d.ts.map +1 -1
  319. package/build/types/integrations/node-fetch/vendored/undici.d.ts +6 -7
  320. package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +1 -1
  321. package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts.map +1 -1
  322. package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts.map +1 -1
  323. package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -1
  324. package/build/types/integrations/tracing/amqplib/vendored/types.d.ts.map +1 -1
  325. package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -1
  326. package/build/types/integrations/tracing/connect/index.d.ts.map +1 -1
  327. package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +0 -4
  328. package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts.map +1 -1
  329. package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts +5 -5
  330. package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts.map +1 -1
  331. package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts +2 -2
  332. package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts.map +1 -1
  333. package/build/types/integrations/tracing/connect/vendored/utils.d.ts +1 -1
  334. package/build/types/integrations/tracing/connect/vendored/utils.d.ts.map +1 -1
  335. package/build/types/integrations/tracing/dataloader/vendored/instrumentation.d.ts.map +1 -1
  336. package/build/types/integrations/tracing/dataloader/vendored/types.d.ts.map +1 -1
  337. package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts.map +1 -1
  338. package/build/types/integrations/tracing/genericPool/index.d.ts.map +1 -1
  339. package/build/types/integrations/tracing/genericPool/vendored/instrumentation.d.ts.map +1 -1
  340. package/build/types/integrations/tracing/graphql/index.d.ts.map +1 -1
  341. package/build/types/integrations/tracing/graphql/vendored/enum.d.ts.map +1 -1
  342. package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +1 -3
  343. package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts.map +1 -1
  344. package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts +7 -2
  345. package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts.map +1 -1
  346. package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts +4 -4
  347. package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts.map +1 -1
  348. package/build/types/integrations/tracing/graphql/vendored/symbols.d.ts.map +1 -1
  349. package/build/types/integrations/tracing/graphql/vendored/types.d.ts +5 -43
  350. package/build/types/integrations/tracing/graphql/vendored/types.d.ts.map +1 -1
  351. package/build/types/integrations/tracing/graphql/vendored/utils.d.ts +8 -11
  352. package/build/types/integrations/tracing/graphql/vendored/utils.d.ts.map +1 -1
  353. package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
  354. package/build/types/integrations/tracing/hapi/vendored/enums/AttributeNames.d.ts.map +1 -1
  355. package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts +2 -2
  356. package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts.map +1 -1
  357. package/build/types/integrations/tracing/hapi/vendored/internal-types.d.ts.map +1 -1
  358. package/build/types/integrations/tracing/hapi/vendored/semconv.d.ts.map +1 -1
  359. package/build/types/integrations/tracing/hapi/vendored/utils.d.ts +3 -4
  360. package/build/types/integrations/tracing/hapi/vendored/utils.d.ts.map +1 -1
  361. package/build/types/integrations/tracing/index.d.ts.map +1 -1
  362. package/build/types/integrations/tracing/kafka/index.d.ts.map +1 -1
  363. package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts +3 -13
  364. package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts.map +1 -1
  365. package/build/types/integrations/tracing/kafka/vendored/kafkajs-types.d.ts +0 -32
  366. package/build/types/integrations/tracing/kafka/vendored/kafkajs-types.d.ts.map +1 -1
  367. package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts +9 -28
  368. package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts.map +1 -1
  369. package/build/types/integrations/tracing/kafka/vendored/utils.d.ts +29 -0
  370. package/build/types/integrations/tracing/kafka/vendored/utils.d.ts.map +1 -0
  371. package/build/types/integrations/tracing/knex/index.d.ts.map +1 -1
  372. package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts +8 -10
  373. package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts.map +1 -1
  374. package/build/types/integrations/tracing/knex/vendored/semconv.d.ts +1 -0
  375. package/build/types/integrations/tracing/knex/vendored/semconv.d.ts.map +1 -1
  376. package/build/types/integrations/tracing/knex/vendored/utils.d.ts +0 -6
  377. package/build/types/integrations/tracing/knex/vendored/utils.d.ts.map +1 -1
  378. package/build/types/integrations/tracing/koa/index.d.ts.map +1 -1
  379. package/build/types/integrations/tracing/koa/vendored/enums/AttributeNames.d.ts.map +1 -1
  380. package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts +1 -1
  381. package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts.map +1 -1
  382. package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts +4 -4
  383. package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts.map +1 -1
  384. package/build/types/integrations/tracing/koa/vendored/types.d.ts +2 -39
  385. package/build/types/integrations/tracing/koa/vendored/types.d.ts.map +1 -1
  386. package/build/types/integrations/tracing/koa/vendored/utils.d.ts +3 -3
  387. package/build/types/integrations/tracing/koa/vendored/utils.d.ts.map +1 -1
  388. package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts.map +1 -1
  389. package/build/types/integrations/tracing/mongo/index.d.ts +0 -4
  390. package/build/types/integrations/tracing/mongo/index.d.ts.map +1 -1
  391. package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts +4 -72
  392. package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts.map +1 -1
  393. package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts +0 -59
  394. package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts.map +1 -1
  395. package/build/types/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
  396. package/build/types/integrations/tracing/mongo/vendored/patches.d.ts.map +1 -0
  397. package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts +0 -54
  398. package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts.map +1 -1
  399. package/build/types/integrations/tracing/mongo/vendored/utils.d.ts +24 -0
  400. package/build/types/integrations/tracing/mongo/vendored/utils.d.ts.map +1 -0
  401. package/build/types/integrations/tracing/mongoose/index.d.ts.map +1 -1
  402. package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +3 -0
  403. package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts.map +1 -1
  404. package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts +3 -8
  405. package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts.map +1 -1
  406. package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -14
  407. package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts.map +1 -1
  408. package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts +4 -6
  409. package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts.map +1 -1
  410. package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts.map +1 -1
  411. package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts.map +1 -1
  412. package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts.map +1 -1
  413. package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts.map +1 -1
  414. package/build/types/integrations/tracing/mysql/vendored/types.d.ts.map +1 -1
  415. package/build/types/integrations/tracing/mysql/vendored/utils.d.ts.map +1 -1
  416. package/build/types/integrations/tracing/mysql2/index.d.ts.map +1 -1
  417. package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts +3 -6
  418. package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -1
  419. package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts.map +1 -1
  420. package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts +3 -5
  421. package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts.map +1 -1
  422. package/build/types/integrations/tracing/postgres/index.d.ts.map +1 -1
  423. package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +0 -1
  424. package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts.map +1 -1
  425. package/build/types/integrations/tracing/postgres/vendored/enums/SpanNames.d.ts.map +1 -1
  426. package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts +1 -9
  427. package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts.map +1 -1
  428. package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts +0 -2
  429. package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts.map +1 -1
  430. package/build/types/integrations/tracing/postgres/vendored/pg-pool-types.d.ts.map +1 -1
  431. package/build/types/integrations/tracing/postgres/vendored/pg-types.d.ts.map +1 -1
  432. package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts +0 -50
  433. package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts.map +1 -1
  434. package/build/types/integrations/tracing/postgres/vendored/types.d.ts +2 -56
  435. package/build/types/integrations/tracing/postgres/vendored/types.d.ts.map +1 -1
  436. package/build/types/integrations/tracing/postgres/vendored/utils.d.ts +13 -26
  437. package/build/types/integrations/tracing/postgres/vendored/utils.d.ts.map +1 -1
  438. package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts.map +1 -1
  439. package/build/types/integrations/tracing/prisma/vendored/constants.d.ts.map +1 -1
  440. package/build/types/integrations/tracing/prisma/vendored/global.d.ts.map +1 -1
  441. package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts.map +1 -1
  442. package/build/types/integrations/tracing/prisma/vendored/types.d.ts.map +1 -1
  443. package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
  444. package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +3 -8
  445. package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts.map +1 -1
  446. package/build/types/integrations/tracing/redis/vendored/redis-common.d.ts.map +1 -1
  447. package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -1
  448. package/build/types/integrations/tracing/redis/vendored/semconv.d.ts.map +1 -1
  449. package/build/types/integrations/tracing/redis/vendored/types.d.ts +2 -36
  450. package/build/types/integrations/tracing/redis/vendored/types.d.ts.map +1 -1
  451. package/build/types/integrations/tracing/tedious/index.d.ts.map +1 -1
  452. package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts +3 -14
  453. package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts.map +1 -1
  454. package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts.map +1 -1
  455. package/build/types/integrations/tracing/tedious/vendored/utils.d.ts.map +1 -1
  456. package/build/types/sdk/diagnosticsChannelInjection.d.ts +41 -0
  457. package/build/types/sdk/diagnosticsChannelInjection.d.ts.map +1 -0
  458. package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +34 -0
  459. package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts.map +1 -0
  460. package/build/types/sdk/index.d.ts.map +1 -1
  461. package/build/types/sdk/initOtel.d.ts.map +1 -1
  462. package/build/types-ts3.8/index.d.ts +2 -1
  463. package/build/types-ts3.8/integrations/fs/vendored/instrumentation.d.ts +6 -10
  464. package/build/types-ts3.8/integrations/fs/vendored/types.d.ts +10 -15
  465. package/build/types-ts3.8/integrations/fs/vendored/utils.d.ts +2 -2
  466. package/build/types-ts3.8/integrations/node-fetch/vendored/semconv.d.ts +13 -0
  467. package/build/types-ts3.8/integrations/node-fetch/vendored/types.d.ts +2 -4
  468. package/build/types-ts3.8/integrations/node-fetch/vendored/undici.d.ts +6 -7
  469. package/build/types-ts3.8/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +0 -4
  470. package/build/types-ts3.8/integrations/tracing/connect/vendored/instrumentation.d.ts +4 -4
  471. package/build/types-ts3.8/integrations/tracing/connect/vendored/internal-types.d.ts +2 -2
  472. package/build/types-ts3.8/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +1 -3
  473. package/build/types-ts3.8/integrations/tracing/graphql/vendored/instrumentation.d.ts +6 -1
  474. package/build/types-ts3.8/integrations/tracing/graphql/vendored/internal-types.d.ts +3 -3
  475. package/build/types-ts3.8/integrations/tracing/graphql/vendored/types.d.ts +4 -42
  476. package/build/types-ts3.8/integrations/tracing/graphql/vendored/utils.d.ts +6 -9
  477. package/build/types-ts3.8/integrations/tracing/hapi/vendored/instrumentation.d.ts +2 -2
  478. package/build/types-ts3.8/integrations/tracing/hapi/vendored/utils.d.ts +1 -2
  479. package/build/types-ts3.8/integrations/tracing/kafka/vendored/instrumentation.d.ts +3 -13
  480. package/build/types-ts3.8/integrations/tracing/kafka/vendored/kafkajs-types.d.ts +0 -32
  481. package/build/types-ts3.8/integrations/tracing/kafka/vendored/semconv.d.ts +9 -28
  482. package/build/types-ts3.8/integrations/tracing/kafka/vendored/utils.d.ts +29 -0
  483. package/build/types-ts3.8/integrations/tracing/knex/vendored/instrumentation.d.ts +8 -10
  484. package/build/types-ts3.8/integrations/tracing/knex/vendored/semconv.d.ts +1 -0
  485. package/build/types-ts3.8/integrations/tracing/knex/vendored/utils.d.ts +0 -6
  486. package/build/types-ts3.8/integrations/tracing/koa/vendored/internal-types.d.ts +4 -4
  487. package/build/types-ts3.8/integrations/tracing/koa/vendored/types.d.ts +1 -38
  488. package/build/types-ts3.8/integrations/tracing/mongo/index.d.ts +0 -4
  489. package/build/types-ts3.8/integrations/tracing/mongo/vendored/instrumentation.d.ts +4 -72
  490. package/build/types-ts3.8/integrations/tracing/mongo/vendored/internal-types.d.ts +0 -59
  491. package/build/types-ts3.8/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
  492. package/build/types-ts3.8/integrations/tracing/mongo/vendored/semconv.d.ts +0 -54
  493. package/build/types-ts3.8/integrations/tracing/mongo/vendored/utils.d.ts +24 -0
  494. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +3 -0
  495. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose.d.ts +3 -8
  496. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -14
  497. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/utils.d.ts +4 -6
  498. package/build/types-ts3.8/integrations/tracing/mysql2/vendored/instrumentation.d.ts +3 -6
  499. package/build/types-ts3.8/integrations/tracing/mysql2/vendored/utils.d.ts +3 -5
  500. package/build/types-ts3.8/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +0 -1
  501. package/build/types-ts3.8/integrations/tracing/postgres/vendored/instrumentation.d.ts +0 -8
  502. package/build/types-ts3.8/integrations/tracing/postgres/vendored/internal-types.d.ts +0 -2
  503. package/build/types-ts3.8/integrations/tracing/postgres/vendored/semconv.d.ts +0 -50
  504. package/build/types-ts3.8/integrations/tracing/postgres/vendored/types.d.ts +1 -55
  505. package/build/types-ts3.8/integrations/tracing/postgres/vendored/utils.d.ts +13 -26
  506. package/build/types-ts3.8/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +3 -8
  507. package/build/types-ts3.8/integrations/tracing/redis/vendored/types.d.ts +2 -36
  508. package/build/types-ts3.8/integrations/tracing/tedious/vendored/instrumentation.d.ts +3 -14
  509. package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +41 -0
  510. package/build/types-ts3.8/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +34 -0
  511. package/package.json +20 -7
  512. package/build/cjs/integrations/tracing/kafka/vendored/internal-types.js +0 -6
  513. package/build/cjs/integrations/tracing/kafka/vendored/internal-types.js.map +0 -1
  514. package/build/cjs/integrations/tracing/kafka/vendored/propagator.js +0 -22
  515. package/build/cjs/integrations/tracing/kafka/vendored/propagator.js.map +0 -1
  516. package/build/cjs/integrations/tracing/knex/vendored/constants.js +0 -16
  517. package/build/cjs/integrations/tracing/knex/vendored/constants.js.map +0 -1
  518. package/build/cjs/integrations/tracing/postgres/vendored/internal-types.js +0 -6
  519. package/build/cjs/integrations/tracing/postgres/vendored/internal-types.js.map +0 -1
  520. package/build/cjs/integrations/tracing/utils/sql-common.js +0 -43
  521. package/build/cjs/integrations/tracing/utils/sql-common.js.map +0 -1
  522. package/build/esm/integrations/tracing/kafka/vendored/internal-types.js +0 -4
  523. package/build/esm/integrations/tracing/kafka/vendored/internal-types.js.map +0 -1
  524. package/build/esm/integrations/tracing/kafka/vendored/propagator.js +0 -20
  525. package/build/esm/integrations/tracing/kafka/vendored/propagator.js.map +0 -1
  526. package/build/esm/integrations/tracing/knex/vendored/constants.js +0 -13
  527. package/build/esm/integrations/tracing/knex/vendored/constants.js.map +0 -1
  528. package/build/esm/integrations/tracing/postgres/vendored/internal-types.js +0 -4
  529. package/build/esm/integrations/tracing/postgres/vendored/internal-types.js.map +0 -1
  530. package/build/esm/integrations/tracing/utils/sql-common.js +0 -41
  531. package/build/esm/integrations/tracing/utils/sql-common.js.map +0 -1
  532. package/build/types/integrations/tracing/kafka/vendored/internal-types.d.ts +0 -9
  533. package/build/types/integrations/tracing/kafka/vendored/internal-types.d.ts.map +0 -1
  534. package/build/types/integrations/tracing/kafka/vendored/propagator.d.ts +0 -3
  535. package/build/types/integrations/tracing/kafka/vendored/propagator.d.ts.map +0 -1
  536. package/build/types/integrations/tracing/kafka/vendored/types.d.ts +0 -26
  537. package/build/types/integrations/tracing/kafka/vendored/types.d.ts.map +0 -1
  538. package/build/types/integrations/tracing/knex/vendored/constants.d.ts +0 -3
  539. package/build/types/integrations/tracing/knex/vendored/constants.d.ts.map +0 -1
  540. package/build/types/integrations/tracing/knex/vendored/types.d.ts +0 -8
  541. package/build/types/integrations/tracing/knex/vendored/types.d.ts.map +0 -1
  542. package/build/types/integrations/tracing/mongo/vendored/types.d.ts +0 -51
  543. package/build/types/integrations/tracing/mongo/vendored/types.d.ts.map +0 -1
  544. package/build/types/integrations/tracing/mongoose/vendored/types.d.ts +0 -36
  545. package/build/types/integrations/tracing/mongoose/vendored/types.d.ts.map +0 -1
  546. package/build/types/integrations/tracing/mysql2/vendored/types.d.ts +0 -18
  547. package/build/types/integrations/tracing/mysql2/vendored/types.d.ts.map +0 -1
  548. package/build/types/integrations/tracing/tedious/vendored/types.d.ts +0 -10
  549. package/build/types/integrations/tracing/tedious/vendored/types.d.ts.map +0 -1
  550. package/build/types/integrations/tracing/utils/sql-common.d.ts +0 -3
  551. package/build/types/integrations/tracing/utils/sql-common.d.ts.map +0 -1
  552. package/build/types-ts3.8/integrations/tracing/kafka/vendored/internal-types.d.ts +0 -9
  553. package/build/types-ts3.8/integrations/tracing/kafka/vendored/propagator.d.ts +0 -3
  554. package/build/types-ts3.8/integrations/tracing/kafka/vendored/types.d.ts +0 -26
  555. package/build/types-ts3.8/integrations/tracing/knex/vendored/constants.d.ts +0 -3
  556. package/build/types-ts3.8/integrations/tracing/knex/vendored/types.d.ts +0 -8
  557. package/build/types-ts3.8/integrations/tracing/mongo/vendored/types.d.ts +0 -51
  558. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/types.d.ts +0 -36
  559. package/build/types-ts3.8/integrations/tracing/mysql2/vendored/types.d.ts +0 -18
  560. package/build/types-ts3.8/integrations/tracing/tedious/vendored/types.d.ts +0 -10
  561. package/build/types-ts3.8/integrations/tracing/utils/sql-common.d.ts +0 -3
@@ -1,48 +1,17 @@
1
- import { context, trace, SpanKind, SpanStatusCode } from '@opentelemetry/api';
2
- import { InstrumentationBase, semconvStabilityFromStr, InstrumentationNodeModuleDefinition, isWrapped, SemconvStability, safeExecuteInTheMiddle } from '@opentelemetry/instrumentation';
3
- import { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile.js';
4
- import { ATTR_DB_SYSTEM_NAME, ATTR_DB_NAMESPACE, ATTR_DB_OPERATION_NAME, ATTR_DB_COLLECTION_NAME, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT, ATTR_DB_QUERY_TEXT } from '@opentelemetry/semantic-conventions';
5
- import { METRIC_DB_CLIENT_CONNECTIONS_USAGE, DB_SYSTEM_VALUE_MONGODB, ATTR_DB_SYSTEM, ATTR_DB_NAME, ATTR_DB_MONGODB_COLLECTION, ATTR_DB_OPERATION, ATTR_DB_CONNECTION_STRING, DB_SYSTEM_NAME_VALUE_MONGODB, ATTR_NET_PEER_NAME, ATTR_NET_PEER_PORT, ATTR_DB_STATEMENT } from './semconv.js';
6
- import { MongodbCommandType } from './internal-types.js';
1
+ import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';
7
2
  import { SDK_VERSION } from '@sentry/core';
3
+ import { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile.js';
4
+ import { getV3PatchOperation, getV3PatchCommand, getV3PatchFind, getV3PatchCursor, getV4ConnectionPoolCheckOut, getV4PatchCommandPromise, getV4PatchCommandCallback } from './patches.js';
8
5
 
9
6
  const PACKAGE_NAME = "@sentry/instrumentation-mongodb";
10
- const DEFAULT_CONFIG = {
11
- requireParentSpan: true
12
- };
13
7
  class MongoDBInstrumentation extends InstrumentationBase {
14
8
  constructor(config = {}) {
15
- super(PACKAGE_NAME, SDK_VERSION, { ...DEFAULT_CONFIG, ...config });
16
- this._setSemconvStabilityFromEnv();
17
- }
18
- // Used for testing.
19
- _setSemconvStabilityFromEnv() {
20
- this._netSemconvStability = semconvStabilityFromStr("http", process.env.OTEL_SEMCONV_STABILITY_OPT_IN);
21
- this._dbSemconvStability = semconvStabilityFromStr("database", process.env.OTEL_SEMCONV_STABILITY_OPT_IN);
22
- }
23
- setConfig(config = {}) {
24
- super.setConfig({ ...DEFAULT_CONFIG, ...config });
25
- }
26
- _updateMetricInstruments() {
27
- this._connectionsUsage = this.meter.createUpDownCounter(METRIC_DB_CLIENT_CONNECTIONS_USAGE, {
28
- description: "The number of connections that are currently in state described by the state attribute.",
29
- unit: "{connection}"
30
- });
31
- }
32
- /**
33
- * Convenience function for updating the `db.client.connections.usage` metric.
34
- * The name "count" comes from the eventual replacement for this metric per
35
- * https://opentelemetry.io/docs/specs/semconv/non-normative/db-migration/#database-client-connection-count
36
- */
37
- _connCountAdd(n, poolName, state) {
38
- this._connectionsUsage?.add(n, { "pool.name": poolName, state });
9
+ super(PACKAGE_NAME, SDK_VERSION, config);
39
10
  }
40
11
  init() {
41
12
  const { v3PatchConnection, v3UnpatchConnection } = this._getV3ConnectionPatches();
42
- const { v4PatchConnect, v4UnpatchConnect } = this._getV4ConnectPatches();
43
13
  const { v4PatchConnectionCallback, v4PatchConnectionPromise, v4UnpatchConnection } = this._getV4ConnectionPatches();
44
14
  const { v4PatchConnectionPool, v4UnpatchConnectionPool } = this._getV4ConnectionPoolPatches();
45
- const { v4PatchSessions, v4UnpatchSessions } = this._getV4SessionsPatches();
46
15
  return [
47
16
  new InstrumentationNodeModuleDefinition("mongodb", [">=3.3.0 <4"], void 0, void 0, [
48
17
  new InstrumentationNodeModuleFile(
@@ -70,18 +39,6 @@ class MongoDBInstrumentation extends InstrumentationBase {
70
39
  [">=4.0.0 <6.4"],
71
40
  v4PatchConnectionPool,
72
41
  v4UnpatchConnectionPool
73
- ),
74
- new InstrumentationNodeModuleFile(
75
- "mongodb/lib/cmap/connect.js",
76
- [">=4.0.0 <8"],
77
- v4PatchConnect,
78
- v4UnpatchConnect
79
- ),
80
- new InstrumentationNodeModuleFile(
81
- "mongodb/lib/sessions.js",
82
- [">=4.0.0 <8"],
83
- v4PatchSessions,
84
- v4UnpatchSessions
85
42
  )
86
43
  ])
87
44
  ];
@@ -92,27 +49,27 @@ class MongoDBInstrumentation extends InstrumentationBase {
92
49
  if (isWrapped(moduleExports.insert)) {
93
50
  this._unwrap(moduleExports, "insert");
94
51
  }
95
- this._wrap(moduleExports, "insert", this._getV3PatchOperation("insert"));
52
+ this._wrap(moduleExports, "insert", getV3PatchOperation("insert"));
96
53
  if (isWrapped(moduleExports.remove)) {
97
54
  this._unwrap(moduleExports, "remove");
98
55
  }
99
- this._wrap(moduleExports, "remove", this._getV3PatchOperation("remove"));
56
+ this._wrap(moduleExports, "remove", getV3PatchOperation("remove"));
100
57
  if (isWrapped(moduleExports.update)) {
101
58
  this._unwrap(moduleExports, "update");
102
59
  }
103
- this._wrap(moduleExports, "update", this._getV3PatchOperation("update"));
60
+ this._wrap(moduleExports, "update", getV3PatchOperation("update"));
104
61
  if (isWrapped(moduleExports.command)) {
105
62
  this._unwrap(moduleExports, "command");
106
63
  }
107
- this._wrap(moduleExports, "command", this._getV3PatchCommand());
64
+ this._wrap(moduleExports, "command", getV3PatchCommand());
108
65
  if (isWrapped(moduleExports.query)) {
109
66
  this._unwrap(moduleExports, "query");
110
67
  }
111
- this._wrap(moduleExports, "query", this._getV3PatchFind());
68
+ this._wrap(moduleExports, "query", getV3PatchFind());
112
69
  if (isWrapped(moduleExports.getMore)) {
113
70
  this._unwrap(moduleExports, "getMore");
114
71
  }
115
- this._wrap(moduleExports, "getMore", this._getV3PatchCursor());
72
+ this._wrap(moduleExports, "getMore", getV3PatchCursor());
116
73
  return moduleExports;
117
74
  },
118
75
  v3UnpatchConnection: (moduleExports) => {
@@ -126,58 +83,6 @@ class MongoDBInstrumentation extends InstrumentationBase {
126
83
  }
127
84
  };
128
85
  }
129
- _getV4SessionsPatches() {
130
- return {
131
- v4PatchSessions: (moduleExports) => {
132
- if (isWrapped(moduleExports.acquire)) {
133
- this._unwrap(moduleExports, "acquire");
134
- }
135
- this._wrap(moduleExports.ServerSessionPool.prototype, "acquire", this._getV4AcquireCommand());
136
- if (isWrapped(moduleExports.release)) {
137
- this._unwrap(moduleExports, "release");
138
- }
139
- this._wrap(moduleExports.ServerSessionPool.prototype, "release", this._getV4ReleaseCommand());
140
- return moduleExports;
141
- },
142
- v4UnpatchSessions: (moduleExports) => {
143
- if (moduleExports === void 0) return;
144
- if (isWrapped(moduleExports.acquire)) {
145
- this._unwrap(moduleExports, "acquire");
146
- }
147
- if (isWrapped(moduleExports.release)) {
148
- this._unwrap(moduleExports, "release");
149
- }
150
- }
151
- };
152
- }
153
- _getV4AcquireCommand() {
154
- const instrumentation = this;
155
- return (original) => {
156
- return function patchAcquire() {
157
- const nSessionsBeforeAcquire = this.sessions.length;
158
- const session = original.call(this);
159
- const nSessionsAfterAcquire = this.sessions.length;
160
- if (nSessionsBeforeAcquire === nSessionsAfterAcquire) {
161
- instrumentation._connCountAdd(1, instrumentation._poolName, "used");
162
- } else if (nSessionsBeforeAcquire - 1 === nSessionsAfterAcquire) {
163
- instrumentation._connCountAdd(-1, instrumentation._poolName, "idle");
164
- instrumentation._connCountAdd(1, instrumentation._poolName, "used");
165
- }
166
- return session;
167
- };
168
- };
169
- }
170
- _getV4ReleaseCommand() {
171
- const instrumentation = this;
172
- return (original) => {
173
- return function patchRelease(session) {
174
- const cmdPromise = original.call(this, session);
175
- instrumentation._connCountAdd(-1, instrumentation._poolName, "used");
176
- instrumentation._connCountAdd(1, instrumentation._poolName, "idle");
177
- return cmdPromise;
178
- };
179
- };
180
- }
181
86
  _getV4ConnectionPoolPatches() {
182
87
  return {
183
88
  v4PatchConnectionPool: (moduleExports) => {
@@ -185,7 +90,7 @@ class MongoDBInstrumentation extends InstrumentationBase {
185
90
  if (isWrapped(poolPrototype.checkOut)) {
186
91
  this._unwrap(poolPrototype, "checkOut");
187
92
  }
188
- this._wrap(poolPrototype, "checkOut", this._getV4ConnectionPoolCheckOut());
93
+ this._wrap(poolPrototype, "checkOut", getV4ConnectionPoolCheckOut());
189
94
  return moduleExports;
190
95
  },
191
96
  v4UnpatchConnectionPool: (moduleExports) => {
@@ -194,73 +99,20 @@ class MongoDBInstrumentation extends InstrumentationBase {
194
99
  }
195
100
  };
196
101
  }
197
- _getV4ConnectPatches() {
198
- return {
199
- v4PatchConnect: (moduleExports) => {
200
- if (isWrapped(moduleExports.connect)) {
201
- this._unwrap(moduleExports, "connect");
202
- }
203
- this._wrap(moduleExports, "connect", this._getV4ConnectCommand());
204
- return moduleExports;
205
- },
206
- v4UnpatchConnect: (moduleExports) => {
207
- if (moduleExports === void 0) return;
208
- this._unwrap(moduleExports, "connect");
209
- }
210
- };
211
- }
212
- // This patch will become unnecessary once
213
- // https://jira.mongodb.org/browse/NODE-5639 is done.
214
- _getV4ConnectionPoolCheckOut() {
215
- return (original) => {
216
- return function patchedCheckout(callback) {
217
- const patchedCallback = context.bind(context.active(), callback);
218
- return original.call(this, patchedCallback);
219
- };
220
- };
221
- }
222
- _getV4ConnectCommand() {
223
- const instrumentation = this;
224
- return (original) => {
225
- return function patchedConnect(options, callback) {
226
- if (original.length === 1) {
227
- const result = original.call(this, options);
228
- if (result && typeof result.then === "function") {
229
- result.then(
230
- () => instrumentation.setPoolName(options),
231
- // this handler is set to pass the lint rules
232
- () => void 0
233
- );
234
- }
235
- return result;
236
- }
237
- const patchedCallback = function(err, conn) {
238
- if (err || !conn) {
239
- callback(err, conn);
240
- return;
241
- }
242
- instrumentation.setPoolName(options);
243
- callback(err, conn);
244
- };
245
- return original.call(this, options, patchedCallback);
246
- };
247
- };
248
- }
249
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
250
102
  _getV4ConnectionPatches() {
251
103
  return {
252
104
  v4PatchConnectionCallback: (moduleExports) => {
253
105
  if (isWrapped(moduleExports.Connection.prototype.command)) {
254
106
  this._unwrap(moduleExports.Connection.prototype, "command");
255
107
  }
256
- this._wrap(moduleExports.Connection.prototype, "command", this._getV4PatchCommandCallback());
108
+ this._wrap(moduleExports.Connection.prototype, "command", getV4PatchCommandCallback());
257
109
  return moduleExports;
258
110
  },
259
111
  v4PatchConnectionPromise: (moduleExports) => {
260
112
  if (isWrapped(moduleExports.Connection.prototype.command)) {
261
113
  this._unwrap(moduleExports.Connection.prototype, "command");
262
114
  }
263
- this._wrap(moduleExports.Connection.prototype, "command", this._getV4PatchCommandPromise());
115
+ this._wrap(moduleExports.Connection.prototype, "command", getV4PatchCommandPromise());
264
116
  return moduleExports;
265
117
  },
266
118
  v4UnpatchConnection: (moduleExports) => {
@@ -269,408 +121,6 @@ class MongoDBInstrumentation extends InstrumentationBase {
269
121
  }
270
122
  };
271
123
  }
272
- /** Creates spans for common operations */
273
- _getV3PatchOperation(operationName) {
274
- const instrumentation = this;
275
- return (original) => {
276
- return function patchedServerCommand(server, ns, ops, options, callback) {
277
- const currentSpan = trace.getSpan(context.active());
278
- const skipInstrumentation = instrumentation._checkSkipInstrumentation(currentSpan);
279
- const resultHandler = typeof options === "function" ? options : callback;
280
- if (skipInstrumentation || typeof resultHandler !== "function" || typeof ops !== "object") {
281
- if (typeof options === "function") {
282
- return original.call(this, server, ns, ops, options);
283
- } else {
284
- return original.call(this, server, ns, ops, options, callback);
285
- }
286
- }
287
- const attributes = instrumentation._getV3SpanAttributes(
288
- ns,
289
- server,
290
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
291
- ops[0],
292
- operationName
293
- );
294
- const spanName = instrumentation._spanNameFromAttrs(attributes);
295
- const span = instrumentation.tracer.startSpan(spanName, {
296
- kind: SpanKind.CLIENT,
297
- attributes
298
- });
299
- const patchedCallback = instrumentation._patchEnd(span, resultHandler);
300
- if (typeof options === "function") {
301
- return original.call(this, server, ns, ops, patchedCallback);
302
- } else {
303
- return original.call(this, server, ns, ops, options, patchedCallback);
304
- }
305
- };
306
- };
307
- }
308
- /** Creates spans for command operation */
309
- _getV3PatchCommand() {
310
- const instrumentation = this;
311
- return (original) => {
312
- return function patchedServerCommand(server, ns, cmd, options, callback) {
313
- const currentSpan = trace.getSpan(context.active());
314
- const skipInstrumentation = instrumentation._checkSkipInstrumentation(currentSpan);
315
- const resultHandler = typeof options === "function" ? options : callback;
316
- if (skipInstrumentation || typeof resultHandler !== "function" || typeof cmd !== "object") {
317
- if (typeof options === "function") {
318
- return original.call(this, server, ns, cmd, options);
319
- } else {
320
- return original.call(this, server, ns, cmd, options, callback);
321
- }
322
- }
323
- const commandType = MongoDBInstrumentation._getCommandType(cmd);
324
- const operationName = commandType === MongodbCommandType.UNKNOWN ? void 0 : commandType;
325
- const attributes = instrumentation._getV3SpanAttributes(ns, server, cmd, operationName);
326
- const spanName = instrumentation._spanNameFromAttrs(attributes);
327
- const span = instrumentation.tracer.startSpan(spanName, {
328
- kind: SpanKind.CLIENT,
329
- attributes
330
- });
331
- const patchedCallback = instrumentation._patchEnd(span, resultHandler);
332
- if (typeof options === "function") {
333
- return original.call(this, server, ns, cmd, patchedCallback);
334
- } else {
335
- return original.call(this, server, ns, cmd, options, patchedCallback);
336
- }
337
- };
338
- };
339
- }
340
- /** Creates spans for command operation */
341
- _getV4PatchCommandCallback() {
342
- const instrumentation = this;
343
- return (original) => {
344
- return function patchedV4ServerCommand(ns, cmd, options, callback) {
345
- const currentSpan = trace.getSpan(context.active());
346
- const skipInstrumentation = instrumentation._checkSkipInstrumentation(currentSpan);
347
- const resultHandler = callback;
348
- const commandType = Object.keys(cmd)[0];
349
- if (typeof cmd !== "object" || cmd.ismaster || cmd.hello) {
350
- return original.call(this, ns, cmd, options, callback);
351
- }
352
- let span = void 0;
353
- if (!skipInstrumentation) {
354
- const attributes = instrumentation._getV4SpanAttributes(this, ns, cmd, commandType);
355
- const spanName = instrumentation._spanNameFromAttrs(attributes);
356
- span = instrumentation.tracer.startSpan(spanName, {
357
- kind: SpanKind.CLIENT,
358
- attributes
359
- });
360
- }
361
- const patchedCallback = instrumentation._patchEnd(span, resultHandler, this.id, commandType);
362
- return original.call(this, ns, cmd, options, patchedCallback);
363
- };
364
- };
365
- }
366
- _getV4PatchCommandPromise() {
367
- const instrumentation = this;
368
- return (original) => {
369
- return function patchedV4ServerCommand(...args) {
370
- const [ns, cmd] = args;
371
- const currentSpan = trace.getSpan(context.active());
372
- const skipInstrumentation = instrumentation._checkSkipInstrumentation(currentSpan);
373
- const commandType = Object.keys(cmd)[0];
374
- const resultHandler = () => void 0;
375
- if (typeof cmd !== "object" || cmd.ismaster || cmd.hello) {
376
- return original.apply(this, args);
377
- }
378
- let span = void 0;
379
- if (!skipInstrumentation) {
380
- const attributes = instrumentation._getV4SpanAttributes(this, ns, cmd, commandType);
381
- const spanName = instrumentation._spanNameFromAttrs(attributes);
382
- span = instrumentation.tracer.startSpan(spanName, {
383
- kind: SpanKind.CLIENT,
384
- attributes
385
- });
386
- }
387
- const patchedCallback = instrumentation._patchEnd(span, resultHandler, this.id, commandType);
388
- const result = original.apply(this, args);
389
- result.then(
390
- (res) => patchedCallback(null, res),
391
- (err) => patchedCallback(err)
392
- );
393
- return result;
394
- };
395
- };
396
- }
397
- /** Creates spans for find operation */
398
- _getV3PatchFind() {
399
- const instrumentation = this;
400
- return (original) => {
401
- return function patchedServerCommand(server, ns, cmd, cursorState, options, callback) {
402
- const currentSpan = trace.getSpan(context.active());
403
- const skipInstrumentation = instrumentation._checkSkipInstrumentation(currentSpan);
404
- const resultHandler = typeof options === "function" ? options : callback;
405
- if (skipInstrumentation || typeof resultHandler !== "function" || typeof cmd !== "object") {
406
- if (typeof options === "function") {
407
- return original.call(this, server, ns, cmd, cursorState, options);
408
- } else {
409
- return original.call(this, server, ns, cmd, cursorState, options, callback);
410
- }
411
- }
412
- const attributes = instrumentation._getV3SpanAttributes(ns, server, cmd, "find");
413
- const spanName = instrumentation._spanNameFromAttrs(attributes);
414
- const span = instrumentation.tracer.startSpan(spanName, {
415
- kind: SpanKind.CLIENT,
416
- attributes
417
- });
418
- const patchedCallback = instrumentation._patchEnd(span, resultHandler);
419
- if (typeof options === "function") {
420
- return original.call(this, server, ns, cmd, cursorState, patchedCallback);
421
- } else {
422
- return original.call(this, server, ns, cmd, cursorState, options, patchedCallback);
423
- }
424
- };
425
- };
426
- }
427
- /** Creates spans for find operation */
428
- _getV3PatchCursor() {
429
- const instrumentation = this;
430
- return (original) => {
431
- return function patchedServerCommand(server, ns, cursorState, batchSize, options, callback) {
432
- const currentSpan = trace.getSpan(context.active());
433
- const skipInstrumentation = instrumentation._checkSkipInstrumentation(currentSpan);
434
- const resultHandler = typeof options === "function" ? options : callback;
435
- if (skipInstrumentation || typeof resultHandler !== "function") {
436
- if (typeof options === "function") {
437
- return original.call(this, server, ns, cursorState, batchSize, options);
438
- } else {
439
- return original.call(this, server, ns, cursorState, batchSize, options, callback);
440
- }
441
- }
442
- const attributes = instrumentation._getV3SpanAttributes(ns, server, cursorState.cmd, "getMore");
443
- const spanName = instrumentation._spanNameFromAttrs(attributes);
444
- const span = instrumentation.tracer.startSpan(spanName, {
445
- kind: SpanKind.CLIENT,
446
- attributes
447
- });
448
- const patchedCallback = instrumentation._patchEnd(span, resultHandler);
449
- if (typeof options === "function") {
450
- return original.call(this, server, ns, cursorState, batchSize, patchedCallback);
451
- } else {
452
- return original.call(this, server, ns, cursorState, batchSize, options, patchedCallback);
453
- }
454
- };
455
- };
456
- }
457
- /**
458
- * Get the mongodb command type from the object.
459
- * @param command Internal mongodb command object
460
- */
461
- static _getCommandType(command) {
462
- if (command.createIndexes !== void 0) {
463
- return MongodbCommandType.CREATE_INDEXES;
464
- } else if (command.findandmodify !== void 0) {
465
- return MongodbCommandType.FIND_AND_MODIFY;
466
- } else if (command.ismaster !== void 0) {
467
- return MongodbCommandType.IS_MASTER;
468
- } else if (command.count !== void 0) {
469
- return MongodbCommandType.COUNT;
470
- } else if (command.aggregate !== void 0) {
471
- return MongodbCommandType.AGGREGATE;
472
- } else {
473
- return MongodbCommandType.UNKNOWN;
474
- }
475
- }
476
- /**
477
- * Determine a span's attributes by fetching related metadata from the context
478
- * @param connectionCtx mongodb internal connection context
479
- * @param ns mongodb namespace
480
- * @param command mongodb internal representation of a command
481
- */
482
- _getV4SpanAttributes(connectionCtx, ns, command, operation) {
483
- let host, port;
484
- if (connectionCtx) {
485
- const hostParts = typeof connectionCtx.address === "string" ? connectionCtx.address.split(":") : "";
486
- if (hostParts.length === 2) {
487
- host = hostParts[0];
488
- port = hostParts[1];
489
- }
490
- }
491
- let commandObj;
492
- if (command?.documents && command.documents[0]) {
493
- commandObj = command.documents[0];
494
- } else if (command?.cursors) {
495
- commandObj = command.cursors;
496
- } else {
497
- commandObj = command;
498
- }
499
- return this._getSpanAttributes(ns.db, ns.collection, host, port, commandObj, operation);
500
- }
501
- /**
502
- * Determine a span's attributes by fetching related metadata from the context
503
- * @param ns mongodb namespace
504
- * @param topology mongodb internal representation of the network topology
505
- * @param command mongodb internal representation of a command
506
- */
507
- _getV3SpanAttributes(ns, topology, command, operation) {
508
- let host;
509
- let port;
510
- if (topology && topology.s) {
511
- host = topology.s.options?.host ?? topology.s.host;
512
- port = (topology.s.options?.port ?? topology.s.port)?.toString();
513
- if (host == null || port == null) {
514
- const address = topology.description?.address;
515
- if (address) {
516
- const addressSegments = address.split(":");
517
- host = addressSegments[0];
518
- port = addressSegments[1];
519
- }
520
- }
521
- }
522
- const [dbName, dbCollection] = ns.toString().split(".");
523
- const commandObj = command?.query ?? command?.q ?? command;
524
- return this._getSpanAttributes(dbName, dbCollection, host, port, commandObj, operation);
525
- }
526
- _getSpanAttributes(dbName, dbCollection, host, port, commandObj, operation) {
527
- const attributes = {};
528
- if (this._dbSemconvStability & SemconvStability.OLD) {
529
- attributes[ATTR_DB_SYSTEM] = DB_SYSTEM_VALUE_MONGODB;
530
- attributes[ATTR_DB_NAME] = dbName;
531
- attributes[ATTR_DB_MONGODB_COLLECTION] = dbCollection;
532
- attributes[ATTR_DB_OPERATION] = operation;
533
- attributes[ATTR_DB_CONNECTION_STRING] = `mongodb://${host}:${port}/${dbName}`;
534
- }
535
- if (this._dbSemconvStability & SemconvStability.STABLE) {
536
- attributes[ATTR_DB_SYSTEM_NAME] = DB_SYSTEM_NAME_VALUE_MONGODB;
537
- attributes[ATTR_DB_NAMESPACE] = dbName;
538
- attributes[ATTR_DB_OPERATION_NAME] = operation;
539
- attributes[ATTR_DB_COLLECTION_NAME] = dbCollection;
540
- }
541
- if (host && port) {
542
- if (this._netSemconvStability & SemconvStability.OLD) {
543
- attributes[ATTR_NET_PEER_NAME] = host;
544
- }
545
- if (this._netSemconvStability & SemconvStability.STABLE) {
546
- attributes[ATTR_SERVER_ADDRESS] = host;
547
- }
548
- const portNumber = parseInt(port, 10);
549
- if (!isNaN(portNumber)) {
550
- if (this._netSemconvStability & SemconvStability.OLD) {
551
- attributes[ATTR_NET_PEER_PORT] = portNumber;
552
- }
553
- if (this._netSemconvStability & SemconvStability.STABLE) {
554
- attributes[ATTR_SERVER_PORT] = portNumber;
555
- }
556
- }
557
- }
558
- if (commandObj) {
559
- const { dbStatementSerializer: configDbStatementSerializer } = this.getConfig();
560
- const dbStatementSerializer = typeof configDbStatementSerializer === "function" ? configDbStatementSerializer : this._defaultDbStatementSerializer.bind(this);
561
- safeExecuteInTheMiddle(
562
- () => {
563
- const query = dbStatementSerializer(commandObj);
564
- if (this._dbSemconvStability & SemconvStability.OLD) {
565
- attributes[ATTR_DB_STATEMENT] = query;
566
- }
567
- if (this._dbSemconvStability & SemconvStability.STABLE) {
568
- attributes[ATTR_DB_QUERY_TEXT] = query;
569
- }
570
- },
571
- (err) => {
572
- if (err) {
573
- this._diag.error("Error running dbStatementSerializer hook", err);
574
- }
575
- },
576
- true
577
- );
578
- }
579
- return attributes;
580
- }
581
- _spanNameFromAttrs(attributes) {
582
- let spanName;
583
- if (this._dbSemconvStability & SemconvStability.STABLE) {
584
- spanName = [attributes[ATTR_DB_OPERATION_NAME], attributes[ATTR_DB_COLLECTION_NAME]].filter((attr) => attr).join(" ") || DB_SYSTEM_NAME_VALUE_MONGODB;
585
- } else {
586
- spanName = `mongodb.${attributes[ATTR_DB_OPERATION] || "command"}`;
587
- }
588
- return spanName;
589
- }
590
- _getDefaultDbStatementReplacer() {
591
- const seen = /* @__PURE__ */ new WeakSet();
592
- return (_key, value) => {
593
- if (typeof value !== "object" || !value) return "?";
594
- if (seen.has(value)) return "[Circular]";
595
- seen.add(value);
596
- return value;
597
- };
598
- }
599
- _defaultDbStatementSerializer(commandObj) {
600
- const { enhancedDatabaseReporting } = this.getConfig();
601
- if (enhancedDatabaseReporting) {
602
- return JSON.stringify(commandObj);
603
- }
604
- return JSON.stringify(commandObj, this._getDefaultDbStatementReplacer());
605
- }
606
- /**
607
- * Triggers the response hook in case it is defined.
608
- * @param span The span to add the results to.
609
- * @param result The command result
610
- */
611
- _handleExecutionResult(span, result) {
612
- const { responseHook } = this.getConfig();
613
- if (typeof responseHook === "function") {
614
- safeExecuteInTheMiddle(
615
- () => {
616
- responseHook(span, { data: result });
617
- },
618
- (err) => {
619
- if (err) {
620
- this._diag.error("Error running response hook", err);
621
- }
622
- },
623
- true
624
- );
625
- }
626
- }
627
- /**
628
- * Ends a created span.
629
- * @param span The created span to end.
630
- * @param resultHandler A callback function.
631
- * @param connectionId: The connection ID of the Command response.
632
- */
633
- _patchEnd(span, resultHandler, connectionId, commandType) {
634
- const activeContext = context.active();
635
- const instrumentation = this;
636
- let spanEnded = false;
637
- return function patchedEnd(...args) {
638
- if (!spanEnded) {
639
- spanEnded = true;
640
- const error = args[0];
641
- if (span) {
642
- if (error instanceof Error) {
643
- span.setStatus({
644
- code: SpanStatusCode.ERROR,
645
- message: error.message
646
- });
647
- } else {
648
- const result = args[1];
649
- instrumentation._handleExecutionResult(span, result);
650
- }
651
- span.end();
652
- }
653
- if (commandType === "endSessions") {
654
- instrumentation._connCountAdd(-1, instrumentation._poolName, "idle");
655
- }
656
- }
657
- return context.with(activeContext, () => {
658
- return resultHandler.apply(this, args);
659
- });
660
- };
661
- }
662
- setPoolName(options) {
663
- const host = options.hostAddress?.host;
664
- const port = options.hostAddress?.port;
665
- const database = options.dbName;
666
- const poolName = `mongodb://${host}:${port}/${database}`;
667
- this._poolName = poolName;
668
- }
669
- _checkSkipInstrumentation(currentSpan) {
670
- const requireParentSpan = this.getConfig().requireParentSpan;
671
- const hasNoParentSpan = currentSpan === void 0;
672
- return requireParentSpan === true && hasNoParentSpan;
673
- }
674
124
  }
675
125
 
676
126
  export { MongoDBInstrumentation };