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