@sentry/node 10.62.0 → 10.64.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 (497) hide show
  1. package/build/cjs/index.js +15 -14
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/featureFlagShims/launchDarkly.js.map +1 -1
  4. package/build/cjs/integrations/featureFlagShims/openFeature.js.map +1 -1
  5. package/build/cjs/integrations/featureFlagShims/statsig.js.map +1 -1
  6. package/build/cjs/integrations/featureFlagShims/unleash.js.map +1 -1
  7. package/build/cjs/integrations/fs/index.js.map +1 -1
  8. package/build/cjs/integrations/http.js.map +1 -1
  9. package/build/cjs/integrations/node-fetch.js +24 -0
  10. package/build/cjs/integrations/node-fetch.js.map +1 -0
  11. package/build/cjs/integrations/tracing/amqplib/index.js.map +1 -1
  12. package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js +0 -6
  13. package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
  14. package/build/cjs/integrations/tracing/amqplib/vendored/utils.js +11 -10
  15. package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
  16. package/build/cjs/integrations/tracing/connect/index.js.map +1 -1
  17. package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js +2 -2
  18. package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
  19. package/build/cjs/integrations/tracing/dataloader/index.js.map +1 -1
  20. package/build/cjs/integrations/tracing/express.js.map +1 -1
  21. package/build/cjs/integrations/tracing/fastify/index.js +7 -103
  22. package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
  23. package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +4 -5
  24. package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
  25. package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -1
  26. package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js +9 -9
  27. package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
  28. package/build/cjs/integrations/tracing/genericPool/index.js.map +1 -1
  29. package/build/cjs/integrations/tracing/graphql/index.js.map +1 -1
  30. package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
  31. package/build/cjs/integrations/tracing/hapi/vendored/utils.js +8 -9
  32. package/build/cjs/integrations/tracing/hapi/vendored/utils.js.map +1 -1
  33. package/build/cjs/integrations/tracing/hono/index.js +7 -7
  34. package/build/cjs/integrations/tracing/hono/index.js.map +1 -1
  35. package/build/cjs/integrations/tracing/index.js +0 -1
  36. package/build/cjs/integrations/tracing/index.js.map +1 -1
  37. package/build/cjs/integrations/tracing/kafka/index.js.map +1 -1
  38. package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js +2 -1
  39. package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
  40. package/build/cjs/integrations/tracing/kafka/vendored/semconv.js +0 -12
  41. package/build/cjs/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
  42. package/build/cjs/integrations/tracing/kafka/vendored/utils.js +12 -11
  43. package/build/cjs/integrations/tracing/kafka/vendored/utils.js.map +1 -1
  44. package/build/cjs/integrations/tracing/knex/index.js.map +1 -1
  45. package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +11 -10
  46. package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
  47. package/build/cjs/integrations/tracing/knex/vendored/semconv.js +0 -16
  48. package/build/cjs/integrations/tracing/knex/vendored/semconv.js.map +1 -1
  49. package/build/cjs/integrations/tracing/koa/index.js.map +1 -1
  50. package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js +2 -2
  51. package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
  52. package/build/cjs/integrations/tracing/koa/vendored/utils.js +2 -2
  53. package/build/cjs/integrations/tracing/koa/vendored/utils.js.map +1 -1
  54. package/build/cjs/integrations/tracing/lrumemoizer/index.js.map +1 -1
  55. package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js +4 -2
  56. package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
  57. package/build/cjs/integrations/tracing/mongo/index.js.map +1 -1
  58. package/build/cjs/integrations/tracing/mongo/vendored/semconv.js +0 -12
  59. package/build/cjs/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
  60. package/build/cjs/integrations/tracing/mongo/vendored/utils.js +12 -11
  61. package/build/cjs/integrations/tracing/mongo/vendored/utils.js.map +1 -1
  62. package/build/cjs/integrations/tracing/mongoose/index.js +3 -2
  63. package/build/cjs/integrations/tracing/mongoose/index.js.map +1 -1
  64. package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js +11 -8
  65. package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
  66. package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js +0 -12
  67. package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
  68. package/build/cjs/integrations/tracing/mongoose/vendored/utils.js +9 -9
  69. package/build/cjs/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
  70. package/build/cjs/integrations/tracing/mysql/index.js.map +1 -1
  71. package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js +36 -129
  72. package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
  73. package/build/cjs/integrations/tracing/mysql/vendored/semconv.js +0 -14
  74. package/build/cjs/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
  75. package/build/cjs/integrations/tracing/mysql/vendored/utils.js +2 -27
  76. package/build/cjs/integrations/tracing/mysql/vendored/utils.js.map +1 -1
  77. package/build/cjs/integrations/tracing/mysql2/index.js.map +1 -1
  78. package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +7 -4
  79. package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
  80. package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js +0 -12
  81. package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
  82. package/build/cjs/integrations/tracing/mysql2/vendored/utils.js +7 -4
  83. package/build/cjs/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
  84. package/build/cjs/integrations/tracing/postgres/index.js.map +1 -1
  85. package/build/cjs/integrations/tracing/postgres/vendored/semconv.js +0 -12
  86. package/build/cjs/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
  87. package/build/cjs/integrations/tracing/postgres/vendored/utils.js +12 -11
  88. package/build/cjs/integrations/tracing/postgres/vendored/utils.js.map +1 -1
  89. package/build/cjs/integrations/tracing/postgresjs.js +8 -7
  90. package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
  91. package/build/cjs/integrations/tracing/prisma/index.js +48 -62
  92. package/build/cjs/integrations/tracing/prisma/index.js.map +1 -1
  93. package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js +83 -57
  94. package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
  95. package/build/cjs/integrations/tracing/prisma/vendored/constants.js.map +1 -1
  96. package/build/cjs/integrations/tracing/prisma/vendored/global.js +2 -2
  97. package/build/cjs/integrations/tracing/prisma/vendored/global.js.map +1 -1
  98. package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js +1 -6
  99. package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
  100. package/build/cjs/integrations/tracing/redis/cache.js +41 -0
  101. package/build/cjs/integrations/tracing/redis/cache.js.map +1 -0
  102. package/build/cjs/integrations/tracing/redis/index.js +16 -38
  103. package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
  104. package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +22 -13
  105. package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
  106. package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +21 -15
  107. package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
  108. package/build/cjs/integrations/tracing/redis/vendored/semconv.js +0 -8
  109. package/build/cjs/integrations/tracing/redis/vendored/semconv.js.map +1 -1
  110. package/build/cjs/integrations/tracing/tedious/index.js.map +1 -1
  111. package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js +9 -8
  112. package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
  113. package/build/cjs/integrations/tracing/tedious/vendored/semconv.js +0 -12
  114. package/build/cjs/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
  115. package/build/cjs/integrations/tracing/vercelai/constants.js.map +1 -1
  116. package/build/cjs/integrations/tracing/vercelai/index.js +2 -4
  117. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
  118. package/build/cjs/sdk/diagnosticsChannelInjection.js.map +1 -1
  119. package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js +18 -6
  120. package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -1
  121. package/build/cjs/sdk/index.js +2 -2
  122. package/build/cjs/sdk/index.js.map +1 -1
  123. package/build/cjs/sdk/initOtel.js +36 -0
  124. package/build/cjs/sdk/initOtel.js.map +1 -1
  125. package/build/esm/index.js +2 -2
  126. package/build/esm/integrations/featureFlagShims/launchDarkly.js.map +1 -1
  127. package/build/esm/integrations/featureFlagShims/openFeature.js.map +1 -1
  128. package/build/esm/integrations/featureFlagShims/statsig.js.map +1 -1
  129. package/build/esm/integrations/featureFlagShims/unleash.js.map +1 -1
  130. package/build/esm/integrations/fs/index.js.map +1 -1
  131. package/build/esm/integrations/http.js.map +1 -1
  132. package/build/esm/integrations/node-fetch.js +22 -0
  133. package/build/esm/integrations/node-fetch.js.map +1 -0
  134. package/build/esm/integrations/tracing/amqplib/index.js.map +1 -1
  135. package/build/esm/integrations/tracing/amqplib/vendored/semconv.js +1 -4
  136. package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
  137. package/build/esm/integrations/tracing/amqplib/vendored/utils.js +7 -6
  138. package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
  139. package/build/esm/integrations/tracing/connect/index.js.map +1 -1
  140. package/build/esm/integrations/tracing/connect/vendored/instrumentation.js +2 -2
  141. package/build/esm/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
  142. package/build/esm/integrations/tracing/dataloader/index.js.map +1 -1
  143. package/build/esm/integrations/tracing/express.js.map +1 -1
  144. package/build/esm/integrations/tracing/fastify/index.js +8 -103
  145. package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
  146. package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +5 -6
  147. package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
  148. package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -1
  149. package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js +7 -7
  150. package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
  151. package/build/esm/integrations/tracing/genericPool/index.js.map +1 -1
  152. package/build/esm/integrations/tracing/graphql/index.js.map +1 -1
  153. package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
  154. package/build/esm/integrations/tracing/hapi/vendored/utils.js +3 -4
  155. package/build/esm/integrations/tracing/hapi/vendored/utils.js.map +1 -1
  156. package/build/esm/integrations/tracing/hono/index.js +3 -3
  157. package/build/esm/integrations/tracing/hono/index.js.map +1 -1
  158. package/build/esm/integrations/tracing/index.js +1 -2
  159. package/build/esm/integrations/tracing/index.js.map +1 -1
  160. package/build/esm/integrations/tracing/kafka/index.js.map +1 -1
  161. package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js +3 -2
  162. package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
  163. package/build/esm/integrations/tracing/kafka/vendored/semconv.js +1 -7
  164. package/build/esm/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
  165. package/build/esm/integrations/tracing/kafka/vendored/utils.js +11 -10
  166. package/build/esm/integrations/tracing/kafka/vendored/utils.js.map +1 -1
  167. package/build/esm/integrations/tracing/knex/index.js.map +1 -1
  168. package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +10 -9
  169. package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
  170. package/build/esm/integrations/tracing/knex/vendored/semconv.js +1 -9
  171. package/build/esm/integrations/tracing/knex/vendored/semconv.js.map +1 -1
  172. package/build/esm/integrations/tracing/koa/index.js.map +1 -1
  173. package/build/esm/integrations/tracing/koa/vendored/instrumentation.js +2 -2
  174. package/build/esm/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
  175. package/build/esm/integrations/tracing/koa/vendored/utils.js +2 -2
  176. package/build/esm/integrations/tracing/koa/vendored/utils.js.map +1 -1
  177. package/build/esm/integrations/tracing/lrumemoizer/index.js.map +1 -1
  178. package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js +5 -3
  179. package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
  180. package/build/esm/integrations/tracing/mongo/index.js.map +1 -1
  181. package/build/esm/integrations/tracing/mongo/vendored/semconv.js +1 -7
  182. package/build/esm/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
  183. package/build/esm/integrations/tracing/mongo/vendored/utils.js +9 -8
  184. package/build/esm/integrations/tracing/mongo/vendored/utils.js.map +1 -1
  185. package/build/esm/integrations/tracing/mongoose/index.js +4 -3
  186. package/build/esm/integrations/tracing/mongoose/index.js.map +1 -1
  187. package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js +9 -6
  188. package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
  189. package/build/esm/integrations/tracing/mongoose/vendored/semconv.js +1 -7
  190. package/build/esm/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
  191. package/build/esm/integrations/tracing/mongoose/vendored/utils.js +10 -10
  192. package/build/esm/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
  193. package/build/esm/integrations/tracing/mysql/index.js.map +1 -1
  194. package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js +38 -131
  195. package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
  196. package/build/esm/integrations/tracing/mysql/vendored/semconv.js +1 -8
  197. package/build/esm/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
  198. package/build/esm/integrations/tracing/mysql/vendored/utils.js +3 -25
  199. package/build/esm/integrations/tracing/mysql/vendored/utils.js.map +1 -1
  200. package/build/esm/integrations/tracing/mysql2/index.js.map +1 -1
  201. package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +6 -3
  202. package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
  203. package/build/esm/integrations/tracing/mysql2/vendored/semconv.js +1 -7
  204. package/build/esm/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
  205. package/build/esm/integrations/tracing/mysql2/vendored/utils.js +8 -5
  206. package/build/esm/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
  207. package/build/esm/integrations/tracing/postgres/index.js.map +1 -1
  208. package/build/esm/integrations/tracing/postgres/vendored/semconv.js +1 -7
  209. package/build/esm/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
  210. package/build/esm/integrations/tracing/postgres/vendored/utils.js +13 -12
  211. package/build/esm/integrations/tracing/postgres/vendored/utils.js.map +1 -1
  212. package/build/esm/integrations/tracing/postgresjs.js +7 -6
  213. package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
  214. package/build/esm/integrations/tracing/prisma/index.js +49 -63
  215. package/build/esm/integrations/tracing/prisma/index.js.map +1 -1
  216. package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js +83 -57
  217. package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
  218. package/build/esm/integrations/tracing/prisma/vendored/constants.js.map +1 -1
  219. package/build/esm/integrations/tracing/prisma/vendored/global.js +2 -2
  220. package/build/esm/integrations/tracing/prisma/vendored/global.js.map +1 -1
  221. package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js +1 -6
  222. package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
  223. package/build/esm/integrations/tracing/redis/cache.js +38 -0
  224. package/build/esm/integrations/tracing/redis/cache.js.map +1 -0
  225. package/build/esm/integrations/tracing/redis/index.js +12 -37
  226. package/build/esm/integrations/tracing/redis/index.js.map +1 -1
  227. package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +19 -10
  228. package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
  229. package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +16 -10
  230. package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
  231. package/build/esm/integrations/tracing/redis/vendored/semconv.js +1 -5
  232. package/build/esm/integrations/tracing/redis/vendored/semconv.js.map +1 -1
  233. package/build/esm/integrations/tracing/tedious/index.js.map +1 -1
  234. package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js +8 -7
  235. package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
  236. package/build/esm/integrations/tracing/tedious/vendored/semconv.js +1 -7
  237. package/build/esm/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
  238. package/build/esm/integrations/tracing/vercelai/constants.js.map +1 -1
  239. package/build/esm/integrations/tracing/vercelai/index.js +3 -5
  240. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
  241. package/build/esm/package.json +1 -1
  242. package/build/esm/sdk/diagnosticsChannelInjection.js.map +1 -1
  243. package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js +19 -8
  244. package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -1
  245. package/build/esm/sdk/index.js +1 -1
  246. package/build/esm/sdk/initOtel.js +38 -2
  247. package/build/esm/sdk/initOtel.js.map +1 -1
  248. package/build/types/index.d.ts +1 -1
  249. package/build/types/index.d.ts.map +1 -1
  250. package/build/types/integrations/featureFlagShims/launchDarkly.d.ts +3 -1
  251. package/build/types/integrations/featureFlagShims/launchDarkly.d.ts.map +1 -1
  252. package/build/types/integrations/featureFlagShims/openFeature.d.ts +3 -1
  253. package/build/types/integrations/featureFlagShims/openFeature.d.ts.map +1 -1
  254. package/build/types/integrations/featureFlagShims/statsig.d.ts +3 -1
  255. package/build/types/integrations/featureFlagShims/statsig.d.ts.map +1 -1
  256. package/build/types/integrations/featureFlagShims/unleash.d.ts +3 -1
  257. package/build/types/integrations/featureFlagShims/unleash.d.ts.map +1 -1
  258. package/build/types/integrations/fs/index.d.ts +3 -1
  259. package/build/types/integrations/fs/index.d.ts.map +1 -1
  260. package/build/types/integrations/http.d.ts +3 -1
  261. package/build/types/integrations/http.d.ts.map +1 -1
  262. package/build/types/integrations/node-fetch.d.ts +9 -0
  263. package/build/types/integrations/node-fetch.d.ts.map +1 -0
  264. package/build/types/integrations/tracing/amqplib/index.d.ts +3 -1
  265. package/build/types/integrations/tracing/amqplib/index.d.ts.map +1 -1
  266. package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts +0 -6
  267. package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -1
  268. package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -1
  269. package/build/types/integrations/tracing/anthropic-ai/index.d.ts +3 -1
  270. package/build/types/integrations/tracing/anthropic-ai/index.d.ts.map +1 -1
  271. package/build/types/integrations/tracing/connect/index.d.ts +3 -1
  272. package/build/types/integrations/tracing/connect/index.d.ts.map +1 -1
  273. package/build/types/integrations/tracing/dataloader/index.d.ts +3 -1
  274. package/build/types/integrations/tracing/dataloader/index.d.ts.map +1 -1
  275. package/build/types/integrations/tracing/express.d.ts +3 -1
  276. package/build/types/integrations/tracing/express.d.ts.map +1 -1
  277. package/build/types/integrations/tracing/fastify/index.d.ts +6 -6
  278. package/build/types/integrations/tracing/fastify/index.d.ts.map +1 -1
  279. package/build/types/integrations/tracing/fastify/v3/instrumentation.d.ts.map +1 -1
  280. package/build/types/integrations/tracing/firebase/firebase.d.ts +3 -1
  281. package/build/types/integrations/tracing/firebase/firebase.d.ts.map +1 -1
  282. package/build/types/integrations/tracing/genericPool/index.d.ts +3 -1
  283. package/build/types/integrations/tracing/genericPool/index.d.ts.map +1 -1
  284. package/build/types/integrations/tracing/google-genai/index.d.ts +3 -1
  285. package/build/types/integrations/tracing/google-genai/index.d.ts.map +1 -1
  286. package/build/types/integrations/tracing/graphql/index.d.ts +3 -1
  287. package/build/types/integrations/tracing/graphql/index.d.ts.map +1 -1
  288. package/build/types/integrations/tracing/hapi/index.d.ts +3 -1
  289. package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
  290. package/build/types/integrations/tracing/hapi/vendored/utils.d.ts.map +1 -1
  291. package/build/types/integrations/tracing/hono/index.d.ts +3 -1
  292. package/build/types/integrations/tracing/hono/index.d.ts.map +1 -1
  293. package/build/types/integrations/tracing/index.d.ts.map +1 -1
  294. package/build/types/integrations/tracing/kafka/index.d.ts +3 -1
  295. package/build/types/integrations/tracing/kafka/index.d.ts.map +1 -1
  296. package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts +5 -63
  297. package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts.map +1 -1
  298. package/build/types/integrations/tracing/kafka/vendored/utils.d.ts.map +1 -1
  299. package/build/types/integrations/tracing/knex/index.d.ts +3 -1
  300. package/build/types/integrations/tracing/knex/index.d.ts.map +1 -1
  301. package/build/types/integrations/tracing/knex/vendored/semconv.d.ts +0 -32
  302. package/build/types/integrations/tracing/knex/vendored/semconv.d.ts.map +1 -1
  303. package/build/types/integrations/tracing/koa/index.d.ts +3 -1
  304. package/build/types/integrations/tracing/koa/index.d.ts.map +1 -1
  305. package/build/types/integrations/tracing/langchain/index.d.ts +3 -1
  306. package/build/types/integrations/tracing/langchain/index.d.ts.map +1 -1
  307. package/build/types/integrations/tracing/langgraph/index.d.ts +3 -1
  308. package/build/types/integrations/tracing/langgraph/index.d.ts.map +1 -1
  309. package/build/types/integrations/tracing/lrumemoizer/index.d.ts +3 -1
  310. package/build/types/integrations/tracing/lrumemoizer/index.d.ts.map +1 -1
  311. package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts.map +1 -1
  312. package/build/types/integrations/tracing/mongo/index.d.ts +3 -1
  313. package/build/types/integrations/tracing/mongo/index.d.ts.map +1 -1
  314. package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts +1 -37
  315. package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts.map +1 -1
  316. package/build/types/integrations/tracing/mongo/vendored/utils.d.ts.map +1 -1
  317. package/build/types/integrations/tracing/mongoose/index.d.ts +3 -1
  318. package/build/types/integrations/tracing/mongoose/index.d.ts.map +1 -1
  319. package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts.map +1 -1
  320. package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -48
  321. package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts.map +1 -1
  322. package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts.map +1 -1
  323. package/build/types/integrations/tracing/mysql/index.d.ts +3 -1
  324. package/build/types/integrations/tracing/mysql/index.d.ts.map +1 -1
  325. package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts +3 -17
  326. package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts.map +1 -1
  327. package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts +16 -16
  328. package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts.map +1 -1
  329. package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts +1 -70
  330. package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts.map +1 -1
  331. package/build/types/integrations/tracing/mysql/vendored/utils.d.ts +6 -9
  332. package/build/types/integrations/tracing/mysql/vendored/utils.d.ts.map +1 -1
  333. package/build/types/integrations/tracing/mysql2/index.d.ts +3 -1
  334. package/build/types/integrations/tracing/mysql2/index.d.ts.map +1 -1
  335. package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -1
  336. package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts +0 -6
  337. package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts.map +1 -1
  338. package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts.map +1 -1
  339. package/build/types/integrations/tracing/openai/index.d.ts +3 -1
  340. package/build/types/integrations/tracing/openai/index.d.ts.map +1 -1
  341. package/build/types/integrations/tracing/postgres/index.d.ts +3 -1
  342. package/build/types/integrations/tracing/postgres/index.d.ts.map +1 -1
  343. package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts +1 -50
  344. package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts.map +1 -1
  345. package/build/types/integrations/tracing/postgres/vendored/utils.d.ts.map +1 -1
  346. package/build/types/integrations/tracing/postgresjs.d.ts +3 -1
  347. package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
  348. package/build/types/integrations/tracing/prisma/index.d.ts +5 -21
  349. package/build/types/integrations/tracing/prisma/index.d.ts.map +1 -1
  350. package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts +5 -7
  351. package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts.map +1 -1
  352. package/build/types/integrations/tracing/prisma/vendored/constants.d.ts.map +1 -1
  353. package/build/types/integrations/tracing/prisma/vendored/global.d.ts.map +1 -1
  354. package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts +2 -4
  355. package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts.map +1 -1
  356. package/build/types/integrations/tracing/prisma/vendored/types.d.ts +5 -23
  357. package/build/types/integrations/tracing/prisma/vendored/types.d.ts.map +1 -1
  358. package/build/types/integrations/tracing/redis/cache.d.ts +22 -0
  359. package/build/types/integrations/tracing/redis/cache.d.ts.map +1 -0
  360. package/build/types/integrations/tracing/redis/index.d.ts +6 -22
  361. package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
  362. package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts.map +1 -1
  363. package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -1
  364. package/build/types/integrations/tracing/redis/vendored/semconv.d.ts +0 -4
  365. package/build/types/integrations/tracing/redis/vendored/semconv.d.ts.map +1 -1
  366. package/build/types/integrations/tracing/tedious/index.d.ts +3 -1
  367. package/build/types/integrations/tracing/tedious/index.d.ts.map +1 -1
  368. package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts.map +1 -1
  369. package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts +1 -62
  370. package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts.map +1 -1
  371. package/build/types/integrations/tracing/vercelai/constants.d.ts +1 -1
  372. package/build/types/integrations/tracing/vercelai/constants.d.ts.map +1 -1
  373. package/build/types/integrations/tracing/vercelai/index.d.ts +3 -1
  374. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
  375. package/build/types/sdk/diagnosticsChannelInjection.d.ts +1 -1
  376. package/build/types/sdk/diagnosticsChannelInjection.d.ts.map +1 -1
  377. package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +2 -0
  378. package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts.map +1 -1
  379. package/build/types/sdk/initOtel.d.ts +2 -3
  380. package/build/types/sdk/initOtel.d.ts.map +1 -1
  381. package/build/types-ts3.8/index.d.ts +1 -1
  382. package/build/types-ts3.8/integrations/featureFlagShims/launchDarkly.d.ts +3 -1
  383. package/build/types-ts3.8/integrations/featureFlagShims/openFeature.d.ts +3 -1
  384. package/build/types-ts3.8/integrations/featureFlagShims/statsig.d.ts +3 -1
  385. package/build/types-ts3.8/integrations/featureFlagShims/unleash.d.ts +3 -1
  386. package/build/types-ts3.8/integrations/fs/index.d.ts +3 -1
  387. package/build/types-ts3.8/integrations/http.d.ts +3 -1
  388. package/build/types-ts3.8/integrations/node-fetch.d.ts +9 -0
  389. package/build/types-ts3.8/integrations/tracing/amqplib/index.d.ts +3 -1
  390. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/semconv.d.ts +0 -6
  391. package/build/types-ts3.8/integrations/tracing/anthropic-ai/index.d.ts +3 -1
  392. package/build/types-ts3.8/integrations/tracing/connect/index.d.ts +3 -1
  393. package/build/types-ts3.8/integrations/tracing/dataloader/index.d.ts +3 -1
  394. package/build/types-ts3.8/integrations/tracing/express.d.ts +3 -1
  395. package/build/types-ts3.8/integrations/tracing/fastify/index.d.ts +6 -6
  396. package/build/types-ts3.8/integrations/tracing/firebase/firebase.d.ts +3 -1
  397. package/build/types-ts3.8/integrations/tracing/genericPool/index.d.ts +3 -1
  398. package/build/types-ts3.8/integrations/tracing/google-genai/index.d.ts +3 -1
  399. package/build/types-ts3.8/integrations/tracing/graphql/index.d.ts +3 -1
  400. package/build/types-ts3.8/integrations/tracing/hapi/index.d.ts +3 -1
  401. package/build/types-ts3.8/integrations/tracing/hono/index.d.ts +3 -1
  402. package/build/types-ts3.8/integrations/tracing/kafka/index.d.ts +3 -1
  403. package/build/types-ts3.8/integrations/tracing/kafka/vendored/semconv.d.ts +5 -63
  404. package/build/types-ts3.8/integrations/tracing/knex/index.d.ts +3 -1
  405. package/build/types-ts3.8/integrations/tracing/knex/vendored/semconv.d.ts +0 -32
  406. package/build/types-ts3.8/integrations/tracing/koa/index.d.ts +3 -1
  407. package/build/types-ts3.8/integrations/tracing/langchain/index.d.ts +3 -1
  408. package/build/types-ts3.8/integrations/tracing/langgraph/index.d.ts +3 -1
  409. package/build/types-ts3.8/integrations/tracing/lrumemoizer/index.d.ts +3 -1
  410. package/build/types-ts3.8/integrations/tracing/mongo/index.d.ts +3 -1
  411. package/build/types-ts3.8/integrations/tracing/mongo/vendored/semconv.d.ts +1 -37
  412. package/build/types-ts3.8/integrations/tracing/mongoose/index.d.ts +3 -1
  413. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -48
  414. package/build/types-ts3.8/integrations/tracing/mysql/index.d.ts +3 -1
  415. package/build/types-ts3.8/integrations/tracing/mysql/vendored/instrumentation.d.ts +3 -17
  416. package/build/types-ts3.8/integrations/tracing/mysql/vendored/mysql-types.d.ts +16 -16
  417. package/build/types-ts3.8/integrations/tracing/mysql/vendored/semconv.d.ts +1 -70
  418. package/build/types-ts3.8/integrations/tracing/mysql/vendored/utils.d.ts +6 -9
  419. package/build/types-ts3.8/integrations/tracing/mysql2/index.d.ts +3 -1
  420. package/build/types-ts3.8/integrations/tracing/mysql2/vendored/semconv.d.ts +0 -6
  421. package/build/types-ts3.8/integrations/tracing/openai/index.d.ts +3 -1
  422. package/build/types-ts3.8/integrations/tracing/postgres/index.d.ts +3 -1
  423. package/build/types-ts3.8/integrations/tracing/postgres/vendored/semconv.d.ts +1 -50
  424. package/build/types-ts3.8/integrations/tracing/postgresjs.d.ts +3 -1
  425. package/build/types-ts3.8/integrations/tracing/prisma/index.d.ts +5 -21
  426. package/build/types-ts3.8/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts +5 -7
  427. package/build/types-ts3.8/integrations/tracing/prisma/vendored/instrumentation.d.ts +2 -4
  428. package/build/types-ts3.8/integrations/tracing/prisma/vendored/types.d.ts +5 -23
  429. package/build/types-ts3.8/integrations/tracing/redis/cache.d.ts +22 -0
  430. package/build/types-ts3.8/integrations/tracing/redis/index.d.ts +6 -22
  431. package/build/types-ts3.8/integrations/tracing/redis/vendored/semconv.d.ts +0 -4
  432. package/build/types-ts3.8/integrations/tracing/tedious/index.d.ts +3 -1
  433. package/build/types-ts3.8/integrations/tracing/tedious/vendored/semconv.d.ts +1 -62
  434. package/build/types-ts3.8/integrations/tracing/vercelai/constants.d.ts +1 -1
  435. package/build/types-ts3.8/integrations/tracing/vercelai/index.d.ts +3 -1
  436. package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +1 -1
  437. package/build/types-ts3.8/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +2 -0
  438. package/build/types-ts3.8/sdk/initOtel.d.ts +3 -4
  439. package/package.json +8 -8
  440. package/build/cjs/integrations/node-fetch/index.js +0 -80
  441. package/build/cjs/integrations/node-fetch/index.js.map +0 -1
  442. package/build/cjs/integrations/node-fetch/vendored/semconv.js +0 -28
  443. package/build/cjs/integrations/node-fetch/vendored/semconv.js.map +0 -1
  444. package/build/cjs/integrations/node-fetch/vendored/undici.js +0 -302
  445. package/build/cjs/integrations/node-fetch/vendored/undici.js.map +0 -1
  446. package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js +0 -387
  447. package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js.map +0 -1
  448. package/build/cjs/integrations/tracing/hapi/vendored/semconv.js +0 -6
  449. package/build/cjs/integrations/tracing/hapi/vendored/semconv.js.map +0 -1
  450. package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js +0 -9
  451. package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js.map +0 -1
  452. package/build/cjs/integrations/tracing/redis/vendored/redis-common.js +0 -34
  453. package/build/cjs/integrations/tracing/redis/vendored/redis-common.js.map +0 -1
  454. package/build/esm/integrations/node-fetch/index.js +0 -77
  455. package/build/esm/integrations/node-fetch/index.js.map +0 -1
  456. package/build/esm/integrations/node-fetch/vendored/semconv.js +0 -15
  457. package/build/esm/integrations/node-fetch/vendored/semconv.js.map +0 -1
  458. package/build/esm/integrations/node-fetch/vendored/undici.js +0 -300
  459. package/build/esm/integrations/node-fetch/vendored/undici.js.map +0 -1
  460. package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js +0 -385
  461. package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js.map +0 -1
  462. package/build/esm/integrations/tracing/hapi/vendored/semconv.js +0 -4
  463. package/build/esm/integrations/tracing/hapi/vendored/semconv.js.map +0 -1
  464. package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js +0 -7
  465. package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js.map +0 -1
  466. package/build/esm/integrations/tracing/redis/vendored/redis-common.js +0 -32
  467. package/build/esm/integrations/tracing/redis/vendored/redis-common.js.map +0 -1
  468. package/build/types/integrations/node-fetch/index.d.ts +0 -36
  469. package/build/types/integrations/node-fetch/index.d.ts.map +0 -1
  470. package/build/types/integrations/node-fetch/vendored/internal-types.d.ts +0 -25
  471. package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +0 -1
  472. package/build/types/integrations/node-fetch/vendored/semconv.d.ts +0 -13
  473. package/build/types/integrations/node-fetch/vendored/semconv.d.ts.map +0 -1
  474. package/build/types/integrations/node-fetch/vendored/types.d.ts +0 -60
  475. package/build/types/integrations/node-fetch/vendored/types.d.ts.map +0 -1
  476. package/build/types/integrations/node-fetch/vendored/undici.d.ts +0 -21
  477. package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +0 -1
  478. package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts +0 -27
  479. package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts.map +0 -1
  480. package/build/types/integrations/tracing/hapi/vendored/semconv.d.ts +0 -13
  481. package/build/types/integrations/tracing/hapi/vendored/semconv.d.ts.map +0 -1
  482. package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts +0 -4
  483. package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts.map +0 -1
  484. package/build/types/integrations/tracing/mysql/vendored/types.d.ts +0 -9
  485. package/build/types/integrations/tracing/mysql/vendored/types.d.ts.map +0 -1
  486. package/build/types/integrations/tracing/redis/vendored/redis-common.d.ts +0 -6
  487. package/build/types/integrations/tracing/redis/vendored/redis-common.d.ts.map +0 -1
  488. package/build/types-ts3.8/integrations/node-fetch/index.d.ts +0 -36
  489. package/build/types-ts3.8/integrations/node-fetch/vendored/internal-types.d.ts +0 -25
  490. package/build/types-ts3.8/integrations/node-fetch/vendored/semconv.d.ts +0 -13
  491. package/build/types-ts3.8/integrations/node-fetch/vendored/types.d.ts +0 -60
  492. package/build/types-ts3.8/integrations/node-fetch/vendored/undici.d.ts +0 -21
  493. package/build/types-ts3.8/integrations/tracing/fastify/vendored/instrumentation.d.ts +0 -27
  494. package/build/types-ts3.8/integrations/tracing/hapi/vendored/semconv.d.ts +0 -13
  495. package/build/types-ts3.8/integrations/tracing/mysql/vendored/AttributeNames.d.ts +0 -4
  496. package/build/types-ts3.8/integrations/tracing/mysql/vendored/types.d.ts +0 -9
  497. package/build/types-ts3.8/integrations/tracing/redis/vendored/redis-common.d.ts +0 -6
@@ -1,7 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  function getConfig(config) {
4
- const { host, port, database, user } = config && config.connectionConfig || config || {};
4
+ const resolved = config?.connectionConfig || config || {};
5
+ const { host, port, database, user } = resolved;
5
6
  return { host, port, database, user };
6
7
  }
7
8
  function getJDBCString(host, port, database) {
@@ -21,13 +22,6 @@ function getDbQueryText(query) {
21
22
  return query.sql;
22
23
  }
23
24
  }
24
- function getDbValues(query, values) {
25
- if (typeof query === "string") {
26
- return arrayStringifyHelper(values);
27
- } else {
28
- return arrayStringifyHelper(values || query.values);
29
- }
30
- }
31
25
  function getSpanName(query) {
32
26
  const rawQuery = typeof query === "object" ? query.sql : query;
33
27
  const firstSpace = rawQuery?.indexOf(" ");
@@ -36,28 +30,9 @@ function getSpanName(query) {
36
30
  }
37
31
  return rawQuery;
38
32
  }
39
- function arrayStringifyHelper(arr) {
40
- if (arr) return `[${arr.toString()}]`;
41
- return "";
42
- }
43
- function getPoolNameOld(pool) {
44
- const c = pool.config.connectionConfig;
45
- let poolName = "";
46
- poolName += c?.host ? `host: '${c.host}', ` : "";
47
- poolName += c?.port ? `port: ${c.port}, ` : "";
48
- poolName += c?.database ? `database: '${c.database}', ` : "";
49
- poolName += c?.user ? `user: '${c.user}'` : "";
50
- if (!c?.user) {
51
- poolName = poolName.substring(0, poolName.length - 2);
52
- }
53
- return poolName.trim();
54
- }
55
33
 
56
- exports.arrayStringifyHelper = arrayStringifyHelper;
57
34
  exports.getConfig = getConfig;
58
35
  exports.getDbQueryText = getDbQueryText;
59
- exports.getDbValues = getDbValues;
60
36
  exports.getJDBCString = getJDBCString;
61
- exports.getPoolNameOld = getPoolNameOld;
62
37
  exports.getSpanName = getSpanName;
63
38
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/mysql/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql\n * - Upstream version: @opentelemetry/instrumentation-mysql@0.64.0\n * - Types from the `mysql` package inlined as simplified interfaces\n */\n/* eslint-disable */\n\nimport type { Pool, Query, QueryOptions } from './mysql-types';\n\nexport function getConfig(config: any) {\n const { host, port, database, user } = (config && config.connectionConfig) || config || {};\n return { host, port, database, user };\n}\n\nexport function getJDBCString(host: string | undefined, port: number | undefined, database: string | undefined) {\n let jdbcString = `jdbc:mysql://${host || 'localhost'}`;\n\n if (typeof port === 'number') {\n jdbcString += `:${port}`;\n }\n\n if (typeof database === 'string') {\n jdbcString += `/${database}`;\n }\n\n return jdbcString;\n}\n\n/**\n * @returns the database query being executed.\n */\nexport function getDbQueryText(query: string | Query | QueryOptions): string {\n if (typeof query === 'string') {\n return query;\n } else {\n return query.sql;\n }\n}\n\nexport function getDbValues(query: string | Query | QueryOptions, values?: any[]): string {\n if (typeof query === 'string') {\n return arrayStringifyHelper(values);\n } else {\n // According to https://github.com/mysqljs/mysql#performing-queries\n // The values argument will override the values in the option object.\n return arrayStringifyHelper(values || query.values);\n }\n}\n\n/**\n * The span name SHOULD be set to a low cardinality value\n * representing the statement executed on the database.\n *\n * TODO: revisit span name based on https://github.com/open-telemetry/semantic-conventions/blob/v1.33.0/docs/database/database-spans.md#name\n *\n * @returns SQL statement without variable arguments or SQL verb\n */\nexport function getSpanName(query: string | Query | QueryOptions): string {\n const rawQuery = typeof query === 'object' ? query.sql : query;\n // Extract the SQL verb\n const firstSpace = rawQuery?.indexOf(' ');\n if (typeof firstSpace === 'number' && firstSpace !== -1) {\n return rawQuery?.substring(0, firstSpace);\n }\n return rawQuery;\n}\n\nexport function arrayStringifyHelper(arr: Array<unknown> | undefined): string {\n if (arr) return `[${arr.toString()}]`;\n return '';\n}\n\nexport function getPoolNameOld(pool: Pool): string {\n const c = pool.config.connectionConfig;\n let poolName = '';\n poolName += c?.host ? `host: '${c.host}', ` : '';\n poolName += c?.port ? `port: ${c.port}, ` : '';\n poolName += c?.database ? `database: '${c.database}', ` : '';\n poolName += c?.user ? `user: '${c.user}'` : '';\n if (!c?.user) {\n poolName = poolName.substring(0, poolName.length - 2); //omit last comma\n }\n return poolName.trim();\n}\n"],"names":[],"mappings":";;AAaO,SAAS,UAAU,MAAA,EAAa;AACrC,EAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAM,QAAA,EAAU,IAAA,KAAU,MAAA,IAAU,MAAA,CAAO,gBAAA,IAAqB,MAAA,IAAU,EAAC;AACzF,EAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,QAAA,EAAU,IAAA,EAAK;AACtC;AAEO,SAAS,aAAA,CAAc,IAAA,EAA0B,IAAA,EAA0B,QAAA,EAA8B;AAC9G,EAAA,IAAI,UAAA,GAAa,CAAA,aAAA,EAAgB,IAAA,IAAQ,WAAW,CAAA,CAAA;AAEpD,EAAA,IAAI,OAAO,SAAS,QAAA,EAAU;AAC5B,IAAA,UAAA,IAAc,IAAI,IAAI,CAAA,CAAA;AAAA,EACxB;AAEA,EAAA,IAAI,OAAO,aAAa,QAAA,EAAU;AAChC,IAAA,UAAA,IAAc,IAAI,QAAQ,CAAA,CAAA;AAAA,EAC5B;AAEA,EAAA,OAAO,UAAA;AACT;AAKO,SAAS,eAAe,KAAA,EAA8C;AAC3E,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,OAAO,KAAA;AAAA,EACT,CAAA,MAAO;AACL,IAAA,OAAO,KAAA,CAAM,GAAA;AAAA,EAC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AC1D,EAAA,QAAA,IAAY,CAAA,EAAG,IAAA,GAAO,CAAA,OAAA,EAAU,CAAA,CAAE,IAAI,CAAA,CAAA,CAAA,GAAM,EAAA;AAC5C,EAAA,IAAI,CAAC,GAAG,IAAA,EAAM;AACZ,IAAA,QAAA,GAAW,QAAA,CAAS,SAAA,CAAU,CAAA,EAAG,QAAA,CAAS,SAAS,CAAC,CAAA;AAAA,EACtD;AACA,EAAA,OAAO,SAAS,IAAA,EAAK;AACvB;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/mysql/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql\n * - Upstream version: @opentelemetry/instrumentation-mysql@0.64.0\n * - Types from the `mysql` package inlined as simplified interfaces\n */\n\nimport type { ConnectionConfig, PoolConfig, Query, QueryOptions } from './mysql-types';\n\nexport function getConfig(config: ConnectionConfig | PoolConfig | undefined) {\n const resolved = (config as PoolConfig | undefined)?.connectionConfig || config || {};\n const { host, port, database, user } = resolved;\n return { host, port, database, user };\n}\n\nexport function getJDBCString(host: string | undefined, port: number | undefined, database: string | undefined) {\n let jdbcString = `jdbc:mysql://${host || 'localhost'}`;\n\n if (typeof port === 'number') {\n jdbcString += `:${port}`;\n }\n\n if (typeof database === 'string') {\n jdbcString += `/${database}`;\n }\n\n return jdbcString;\n}\n\n/**\n * @returns the database query being executed.\n */\nexport function getDbQueryText(query: string | Query | QueryOptions): string {\n if (typeof query === 'string') {\n return query;\n } else {\n return query.sql;\n }\n}\n\n/**\n * The span name SHOULD be set to a low cardinality value\n * representing the statement executed on the database.\n *\n * TODO: revisit span name based on https://github.com/open-telemetry/semantic-conventions/blob/v1.33.0/docs/database/database-spans.md#name\n *\n * @returns SQL statement without variable arguments or SQL verb\n */\nexport function getSpanName(query: string | Query | QueryOptions): string {\n const rawQuery = typeof query === 'object' ? query.sql : query;\n // Extract the SQL verb\n const firstSpace = rawQuery?.indexOf(' ');\n if (typeof firstSpace === 'number' && firstSpace !== -1) {\n return rawQuery?.substring(0, firstSpace);\n }\n return rawQuery;\n}\n"],"names":[],"mappings":";;AAYO,SAAS,UAAU,MAAA,EAAmD;AAC3E,EAAA,MAAM,QAAA,GAAY,MAAA,EAAmC,gBAAA,IAAoB,MAAA,IAAU,EAAC;AACpF,EAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAM,QAAA,EAAU,MAAK,GAAI,QAAA;AACvC,EAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,QAAA,EAAU,IAAA,EAAK;AACtC;AAEO,SAAS,aAAA,CAAc,IAAA,EAA0B,IAAA,EAA0B,QAAA,EAA8B;AAC9G,EAAA,IAAI,UAAA,GAAa,CAAA,aAAA,EAAgB,IAAA,IAAQ,WAAW,CAAA,CAAA;AAEpD,EAAA,IAAI,OAAO,SAAS,QAAA,EAAU;AAC5B,IAAA,UAAA,IAAc,IAAI,IAAI,CAAA,CAAA;AAAA,EACxB;AAEA,EAAA,IAAI,OAAO,aAAa,QAAA,EAAU;AAChC,IAAA,UAAA,IAAc,IAAI,QAAQ,CAAA,CAAA;AAAA,EAC5B;AAEA,EAAA,OAAO,UAAA;AACT;AAKO,SAAS,eAAe,KAAA,EAA8C;AAC3E,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,OAAO,KAAA;AAAA,EACT,CAAA,MAAO;AACL,IAAA,OAAO,KAAA,CAAM,GAAA;AAAA,EACf;AACF;AAUO,SAAS,YAAY,KAAA,EAA8C;AACxE,EAAA,MAAM,QAAA,GAAW,OAAO,KAAA,KAAU,QAAA,GAAW,MAAM,GAAA,GAAM,KAAA;AAEzD,EAAA,MAAM,UAAA,GAAa,QAAA,EAAU,OAAA,CAAQ,GAAG,CAAA;AACxC,EAAA,IAAI,OAAO,UAAA,KAAe,QAAA,IAAY,UAAA,KAAe,EAAA,EAAI;AACvD,IAAA,OAAO,QAAA,EAAU,SAAA,CAAU,CAAA,EAAG,UAAU,CAAA;AAAA,EAC1C;AACA,EAAA,OAAO,QAAA;AACT;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/mysql2/index.ts"],"sourcesContent":["import { MySQL2Instrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mysql2';\n\nexport const instrumentMysql2 = generateInstrumentOnce(INTEGRATION_NAME, () => new MySQL2Instrumentation());\n\nconst _mysql2Integration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql2();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql2](https://www.npmjs.com/package/mysql2) library.\n *\n * For more information, see the [`mysql2Integration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql2/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysql2Integration = defineIntegration(_mysql2Integration);\n"],"names":["generateInstrumentOnce","MySQL2Instrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,QAAA;AAElB,MAAM,mBAAmBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,uCAAuB;AAE1G,MAAM,sBAAsB,MAAM;AAChC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,gBAAA,EAAiB;AAAA,IACnB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,iBAAA,GAAoBC,uBAAkB,kBAAkB;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/mysql2/index.ts"],"sourcesContent":["import { MySQL2Instrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mysql2' as const;\n\nexport const instrumentMysql2 = generateInstrumentOnce(INTEGRATION_NAME, () => new MySQL2Instrumentation());\n\nconst _mysql2Integration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql2();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql2](https://www.npmjs.com/package/mysql2) library.\n *\n * For more information, see the [`mysql2Integration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql2/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysql2Integration = defineIntegration(_mysql2Integration);\n"],"names":["generateInstrumentOnce","MySQL2Instrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,QAAA;AAElB,MAAM,mBAAmBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,uCAAuB;AAE1G,MAAM,sBAAsB,MAAM;AAChC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,gBAAA,EAAiB;AAAA,IACnB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,iBAAA,GAAoBC,uBAAkB,kBAAkB;;;;;"}
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentation = require('@opentelemetry/instrumentation');
4
+ const attributes = require('@sentry/conventions/attributes');
4
5
  const core = require('@sentry/core');
5
6
  const InstrumentationNodeModuleFile = require('../../InstrumentationNodeModuleFile.js');
6
7
  const semconv = require('./semconv.js');
@@ -83,16 +84,18 @@ class MySQL2Instrumentation extends instrumentation.InstrumentationBase {
83
84
  } else if (arguments[2]) {
84
85
  values = [_valuesOrCallback];
85
86
  }
86
- const attributes = {
87
+ const attributes$1 = {
87
88
  ...utils.getConnectionAttributes(this.config),
88
- [semconv.ATTR_DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_MYSQL,
89
- [semconv.ATTR_DB_STATEMENT]: utils.getQueryText(query, format, values),
89
+ // oxlint-disable-next-line typescript/no-deprecated
90
+ [attributes.DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_MYSQL,
91
+ // oxlint-disable-next-line typescript/no-deprecated
92
+ [attributes.DB_STATEMENT]: utils.getQueryText(query, format, values),
90
93
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
91
94
  };
92
95
  const span = core.startInactiveSpan({
93
96
  name: utils.getSpanName(query),
94
97
  kind: core.SPAN_KIND.CLIENT,
95
- attributes
98
+ attributes: attributes$1
96
99
  });
97
100
  const endSpan = utils.once((err) => {
98
101
  if (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/mysql2/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql2\n * - Upstream version: @opentelemetry/instrumentation-mysql2@0.64.0\n * - Types from 'mysql2' inlined as simplified interfaces\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport type { SpanAttributes } from '@sentry/core';\nimport {\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile';\nimport type { Connection, FormatFunction, Query, QueryError, QueryOptions } from './mysql2-types';\nimport { ATTR_DB_STATEMENT, ATTR_DB_SYSTEM, DB_SYSTEM_VALUE_MYSQL } from './semconv';\nimport { getConnectionAttributes, getConnectionPrototypeToInstrument, getQueryText, getSpanName, once } from './utils';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-mysql2';\nconst ORIGIN = 'auto.db.otel.mysql2';\n\nconst supportedVersions = ['>=1.4.2 <4'];\n\n// The raw imported `mysql2` module exposes the `format` helper used to render\n// parameterized queries. Typed shallowly since it is only read internally.\ntype MySQL2Module = { format?: FormatFunction; [key: string]: unknown };\n\nexport class MySQL2Instrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init(): InstrumentationNodeModuleDefinition[] {\n let format: FormatFunction | undefined;\n function setFormatFunction(moduleExports: MySQL2Module): void {\n if (!format && moduleExports.format) {\n format = moduleExports.format;\n }\n }\n const patch = (ConnectionPrototype: Connection): void => {\n if (isWrapped(ConnectionPrototype.query)) {\n this._unwrap(ConnectionPrototype, 'query');\n }\n this._wrap(ConnectionPrototype, 'query', this._patchQuery(format) as any);\n if (isWrapped(ConnectionPrototype.execute)) {\n this._unwrap(ConnectionPrototype, 'execute');\n }\n this._wrap(ConnectionPrototype, 'execute', this._patchQuery(format) as any);\n };\n const unpatch = (ConnectionPrototype: Connection): void => {\n this._unwrap(ConnectionPrototype, 'query');\n this._unwrap(ConnectionPrototype, 'execute');\n };\n return [\n new InstrumentationNodeModuleDefinition(\n 'mysql2',\n supportedVersions,\n (moduleExports: MySQL2Module) => {\n setFormatFunction(moduleExports);\n return moduleExports;\n },\n () => {},\n [\n new InstrumentationNodeModuleFile(\n 'mysql2/promise.js',\n supportedVersions,\n (moduleExports: MySQL2Module) => {\n setFormatFunction(moduleExports);\n return moduleExports;\n },\n () => {},\n ),\n new InstrumentationNodeModuleFile(\n 'mysql2/lib/connection.js',\n supportedVersions,\n (moduleExports: any) => {\n const ConnectionPrototype: Connection = getConnectionPrototypeToInstrument(moduleExports);\n patch(ConnectionPrototype);\n return moduleExports;\n },\n (moduleExports: any) => {\n if (moduleExports === undefined) return;\n const ConnectionPrototype: Connection = getConnectionPrototypeToInstrument(moduleExports);\n unpatch(ConnectionPrototype);\n },\n ),\n ],\n ),\n ];\n }\n\n private _patchQuery(format: FormatFunction | undefined) {\n const thisPlugin = this;\n return (originalQuery: Function): Function => {\n return function query(\n this: Connection,\n query: string | Query | QueryOptions,\n _valuesOrCallback?: unknown[] | Function,\n _callback?: Function,\n ) {\n let values;\n if (Array.isArray(_valuesOrCallback)) {\n values = _valuesOrCallback;\n } else if (arguments[2]) {\n values = [_valuesOrCallback];\n }\n\n const attributes: SpanAttributes = {\n ...getConnectionAttributes(this.config),\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_MYSQL,\n [ATTR_DB_STATEMENT]: getQueryText(query, format, values),\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n };\n\n const span = startInactiveSpan({\n name: getSpanName(query),\n kind: SPAN_KIND.CLIENT,\n attributes,\n });\n\n const endSpan = once((err?: QueryError | null) => {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: err.message });\n }\n span.end();\n });\n\n if (arguments.length === 1) {\n if (typeof (query as any).onResult === 'function') {\n thisPlugin._wrap(query as any, 'onResult', thisPlugin._patchCallbackQuery(endSpan));\n }\n\n const streamableQuery: Query = originalQuery.apply(this, arguments);\n\n streamableQuery\n .once('error', (err: any) => {\n endSpan(err);\n })\n .once('result', () => {\n endSpan();\n });\n\n return streamableQuery;\n }\n\n if (typeof arguments[1] === 'function') {\n thisPlugin._wrap(arguments, 1, thisPlugin._patchCallbackQuery(endSpan));\n } else if (typeof arguments[2] === 'function') {\n thisPlugin._wrap(arguments, 2, thisPlugin._patchCallbackQuery(endSpan));\n }\n\n return originalQuery.apply(this, arguments);\n };\n };\n }\n\n private _patchCallbackQuery(endSpan: (err?: QueryError | null) => void) {\n return (originalCallback: Function) => {\n return function (...args: [err: QueryError | null, ...rest: unknown[]]) {\n endSpan(args[0]);\n return originalCallback(...args);\n };\n };\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","isWrapped","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","getConnectionPrototypeToInstrument","getConnectionAttributes","ATTR_DB_SYSTEM","DB_SYSTEM_VALUE_MYSQL","ATTR_DB_STATEMENT","getQueryText","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","startInactiveSpan","getSpanName","SPAN_KIND","once","SPAN_STATUS_ERROR"],"mappings":";;;;;;;;AA2BA,MAAM,YAAA,GAAe,gCAAA;AACrB,MAAM,MAAA,GAAS,qBAAA;AAEf,MAAM,iBAAA,GAAoB,CAAC,YAAY,CAAA;AAMhC,MAAM,8BAA8BA,mCAAA,CAA2C;AAAA,EAC7E,WAAA,CAAY,MAAA,GAAgC,EAAC,EAAG;AACrD,IAAA,KAAA,CAAM,YAAA,EAAcC,kBAAa,MAAM,CAAA;AAAA,EACzC;AAAA,EAEU,IAAA,GAA8C;AACtD,IAAA,IAAI,MAAA;AACJ,IAAA,SAAS,kBAAkB,aAAA,EAAmC;AAC5D,MAAA,IAAI,CAAC,MAAA,IAAU,aAAA,CAAc,MAAA,EAAQ;AACnC,QAAA,MAAA,GAAS,aAAA,CAAc,MAAA;AAAA,MACzB;AAAA,IACF;AACA,IAAA,MAAM,KAAA,GAAQ,CAAC,mBAAA,KAA0C;AACvD,MAAA,IAAIC,yBAAA,CAAU,mBAAA,CAAoB,KAAK,CAAA,EAAG;AACxC,QAAA,IAAA,CA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AAC,CAAC,CAAA;AACf,QAAA,OAAO,gBAAA,CAAiB,GAAG,IAAI,CAAA;AAAA,MACjC,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/mysql2/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql2\n * - Upstream version: @opentelemetry/instrumentation-mysql2@0.64.0\n * - Types from 'mysql2' inlined as simplified interfaces\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport { DB_STATEMENT, DB_SYSTEM } from '@sentry/conventions/attributes';\nimport type { SpanAttributes } from '@sentry/core';\nimport {\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile';\nimport type { Connection, FormatFunction, Query, QueryError, QueryOptions } from './mysql2-types';\nimport { DB_SYSTEM_VALUE_MYSQL } from './semconv';\nimport { getConnectionAttributes, getConnectionPrototypeToInstrument, getQueryText, getSpanName, once } from './utils';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-mysql2';\nconst ORIGIN = 'auto.db.otel.mysql2';\n\nconst supportedVersions = ['>=1.4.2 <4'];\n\n// The raw imported `mysql2` module exposes the `format` helper used to render\n// parameterized queries. Typed shallowly since it is only read internally.\ntype MySQL2Module = { format?: FormatFunction; [key: string]: unknown };\n\nexport class MySQL2Instrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init(): InstrumentationNodeModuleDefinition[] {\n let format: FormatFunction | undefined;\n function setFormatFunction(moduleExports: MySQL2Module): void {\n if (!format && moduleExports.format) {\n format = moduleExports.format;\n }\n }\n const patch = (ConnectionPrototype: Connection): void => {\n if (isWrapped(ConnectionPrototype.query)) {\n this._unwrap(ConnectionPrototype, 'query');\n }\n this._wrap(ConnectionPrototype, 'query', this._patchQuery(format) as any);\n if (isWrapped(ConnectionPrototype.execute)) {\n this._unwrap(ConnectionPrototype, 'execute');\n }\n this._wrap(ConnectionPrototype, 'execute', this._patchQuery(format) as any);\n };\n const unpatch = (ConnectionPrototype: Connection): void => {\n this._unwrap(ConnectionPrototype, 'query');\n this._unwrap(ConnectionPrototype, 'execute');\n };\n return [\n new InstrumentationNodeModuleDefinition(\n 'mysql2',\n supportedVersions,\n (moduleExports: MySQL2Module) => {\n setFormatFunction(moduleExports);\n return moduleExports;\n },\n () => {},\n [\n new InstrumentationNodeModuleFile(\n 'mysql2/promise.js',\n supportedVersions,\n (moduleExports: MySQL2Module) => {\n setFormatFunction(moduleExports);\n return moduleExports;\n },\n () => {},\n ),\n new InstrumentationNodeModuleFile(\n 'mysql2/lib/connection.js',\n supportedVersions,\n (moduleExports: any) => {\n const ConnectionPrototype: Connection = getConnectionPrototypeToInstrument(moduleExports);\n patch(ConnectionPrototype);\n return moduleExports;\n },\n (moduleExports: any) => {\n if (moduleExports === undefined) return;\n const ConnectionPrototype: Connection = getConnectionPrototypeToInstrument(moduleExports);\n unpatch(ConnectionPrototype);\n },\n ),\n ],\n ),\n ];\n }\n\n private _patchQuery(format: FormatFunction | undefined) {\n const thisPlugin = this;\n return (originalQuery: Function): Function => {\n return function query(\n this: Connection,\n query: string | Query | QueryOptions,\n _valuesOrCallback?: unknown[] | Function,\n _callback?: Function,\n ) {\n let values;\n if (Array.isArray(_valuesOrCallback)) {\n values = _valuesOrCallback;\n } else if (arguments[2]) {\n values = [_valuesOrCallback];\n }\n\n const attributes: SpanAttributes = {\n ...getConnectionAttributes(this.config),\n // oxlint-disable-next-line typescript/no-deprecated\n [DB_SYSTEM]: DB_SYSTEM_VALUE_MYSQL,\n // oxlint-disable-next-line typescript/no-deprecated\n [DB_STATEMENT]: getQueryText(query, format, values),\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n };\n\n const span = startInactiveSpan({\n name: getSpanName(query),\n kind: SPAN_KIND.CLIENT,\n attributes,\n });\n\n const endSpan = once((err?: QueryError | null) => {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: err.message });\n }\n span.end();\n });\n\n if (arguments.length === 1) {\n if (typeof (query as any).onResult === 'function') {\n thisPlugin._wrap(query as any, 'onResult', thisPlugin._patchCallbackQuery(endSpan));\n }\n\n const streamableQuery: Query = originalQuery.apply(this, arguments);\n\n streamableQuery\n .once('error', (err: any) => {\n endSpan(err);\n })\n .once('result', () => {\n endSpan();\n });\n\n return streamableQuery;\n }\n\n if (typeof arguments[1] === 'function') {\n thisPlugin._wrap(arguments, 1, thisPlugin._patchCallbackQuery(endSpan));\n } else if (typeof arguments[2] === 'function') {\n thisPlugin._wrap(arguments, 2, thisPlugin._patchCallbackQuery(endSpan));\n }\n\n return originalQuery.apply(this, arguments);\n };\n };\n }\n\n private _patchCallbackQuery(endSpan: (err?: QueryError | null) => void) {\n return (originalCallback: Function) => {\n return function (...args: [err: QueryError | null, ...rest: unknown[]]) {\n endSpan(args[0]);\n return originalCallback(...args);\n };\n };\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","isWrapped","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","getConnectionPrototypeToInstrument","attributes","getConnectionAttributes","DB_SYSTEM","DB_SYSTEM_VALUE_MYSQL","DB_STATEMENT","getQueryText","SEMANTIC_ATTRIBUTE_SENTRY_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,EAAU,MAAM;AACpB,YAAA,OAAA,EAAQ;AAAA,UACV,CAAC,CAAA;AAEH,UAAA,OAAO,eAAA;AAAA,QACT;AAEA,QAAA,IAAI,OAAO,SAAA,CAAU,CAAC,CAAA,KAAM,UAAA,EAAY;AACtC,UAAA,UAAA,CAAW,MAAM,SAAA,EAAW,CAAA,EAAG,UAAA,CAAW,mBAAA,CAAoB,OAAO,CAAC,CAAA;AAAA,QACxE,CAAA,MAAA,IAAW,OAAO,SAAA,CAAU,CAAC,MAAM,UAAA,EAAY;AAC7C,UAAA,UAAA,CAAW,MAAM,SAAA,EAAW,CAAA,EAAG,UAAA,CAAW,mBAAA,CAAoB,OAAO,CAAC,CAAA;AAAA,QACxE;AAEA,QAAA,OAAO,aAAA,CAAc,KAAA,CAAM,IAAA,EAAM,SAAS,CAAA;AAAA,MAC5C,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AAAA,EAEQ,oBAAoB,OAAA,EAA4C;AACtE,IAAA,OAAO,CAAC,gBAAA,KAA+B;AACrC,MAAA,OAAO,YAAa,IAAA,EAAoD;AACtE,QAAA,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,gBAAA,CAAiB,GAAG,IAAI,CAAA;AAAA,MACjC,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AACF;;;;"}
@@ -1,20 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const ATTR_DB_CONNECTION_STRING = "db.connection_string";
4
- const ATTR_DB_NAME = "db.name";
5
- const ATTR_DB_STATEMENT = "db.statement";
6
- const ATTR_DB_SYSTEM = "db.system";
7
- const ATTR_DB_USER = "db.user";
8
- const ATTR_NET_PEER_NAME = "net.peer.name";
9
- const ATTR_NET_PEER_PORT = "net.peer.port";
10
4
  const DB_SYSTEM_VALUE_MYSQL = "mysql";
11
5
 
12
6
  exports.ATTR_DB_CONNECTION_STRING = ATTR_DB_CONNECTION_STRING;
13
- exports.ATTR_DB_NAME = ATTR_DB_NAME;
14
- exports.ATTR_DB_STATEMENT = ATTR_DB_STATEMENT;
15
- exports.ATTR_DB_SYSTEM = ATTR_DB_SYSTEM;
16
- exports.ATTR_DB_USER = ATTR_DB_USER;
17
- exports.ATTR_NET_PEER_NAME = ATTR_NET_PEER_NAME;
18
- exports.ATTR_NET_PEER_PORT = ATTR_NET_PEER_PORT;
19
7
  exports.DB_SYSTEM_VALUE_MYSQL = DB_SYSTEM_VALUE_MYSQL;
20
8
  //# sourceMappingURL=semconv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/mysql2/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql2\n * - Upstream version: @opentelemetry/instrumentation-mysql2@0.64.0\n */\n\nexport const ATTR_DB_CONNECTION_STRING = 'db.connection_string' as const;\nexport const ATTR_DB_NAME = 'db.name' as const;\nexport const ATTR_DB_STATEMENT = 'db.statement' as const;\nexport const ATTR_DB_SYSTEM = 'db.system' as const;\nexport const ATTR_DB_USER = 'db.user' as const;\nexport const ATTR_NET_PEER_NAME = 'net.peer.name' as const;\nexport const ATTR_NET_PEER_PORT = 'net.peer.port' as const;\nexport const DB_SYSTEM_VALUE_MYSQL = 'mysql' as const;\n"],"names":[],"mappings":";;AASO,MAAM,yBAAA,GAA4B;AAClC,MAAM,YAAA,GAAe;AACrB,MAAM,iBAAA,GAAoB;AAC1B,MAAM,cAAA,GAAiB;AACvB,MAAM,YAAA,GAAe;AACrB,MAAM,kBAAA,GAAqB;AAC3B,MAAM,kBAAA,GAAqB;AAC3B,MAAM,qBAAA,GAAwB;;;;;;;;;;;"}
1
+ {"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/mysql2/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql2\n * - Upstream version: @opentelemetry/instrumentation-mysql2@0.64.0\n */\n\nexport const ATTR_DB_CONNECTION_STRING = 'db.connection_string' as const;\nexport const DB_SYSTEM_VALUE_MYSQL = 'mysql' as const;\n"],"names":[],"mappings":";;AASO,MAAM,yBAAA,GAA4B;AAClC,MAAM,qBAAA,GAAwB;;;;;"}
@@ -1,18 +1,21 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
+ const attributes = require('@sentry/conventions/attributes');
3
4
  const semconv = require('./semconv.js');
4
5
 
5
6
  function getConnectionAttributes(config) {
6
7
  const { host, port, database, user } = getConfig(config);
7
8
  const attrs = {
8
9
  [semconv.ATTR_DB_CONNECTION_STRING]: getJDBCString(host, port, database),
9
- [semconv.ATTR_DB_NAME]: database,
10
- [semconv.ATTR_DB_USER]: user,
11
- [semconv.ATTR_NET_PEER_NAME]: host
10
+ // oxlint-disable-next-line typescript/no-deprecated
11
+ [attributes.DB_NAME]: database,
12
+ [attributes.DB_USER]: user,
13
+ // oxlint-disable-next-line typescript/no-deprecated
14
+ [attributes.NET_PEER_NAME]: host
12
15
  };
13
16
  const portNumber = parseInt(port, 10);
14
17
  if (!isNaN(portNumber)) {
15
- attrs[semconv.ATTR_NET_PEER_PORT] = portNumber;
18
+ attrs[attributes.NET_PEER_PORT] = portNumber;
16
19
  }
17
20
  return attrs;
18
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/mysql2/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql2\n * - Upstream version: @opentelemetry/instrumentation-mysql2@0.64.0\n * - Types from 'mysql2' inlined as simplified interfaces\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n */\n\nimport type { SpanAttributes } from '@sentry/core';\nimport type { FormatFunction } from './mysql2-types';\nimport {\n ATTR_DB_CONNECTION_STRING,\n ATTR_DB_NAME,\n ATTR_DB_USER,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n} from './semconv';\n\ninterface QueryOptions {\n sql: string;\n values?: any | any[] | { [param: string]: any };\n}\n\ninterface Query {\n sql: string;\n}\n\ninterface Config {\n host?: string;\n port?: number;\n database?: string;\n user?: string;\n connectionConfig?: Config;\n}\n\nexport function getConnectionAttributes(config: Config): SpanAttributes {\n const { host, port, database, user } = getConfig(config);\n\n const attrs: SpanAttributes = {\n [ATTR_DB_CONNECTION_STRING]: getJDBCString(host, port, database),\n [ATTR_DB_NAME]: database,\n [ATTR_DB_USER]: user,\n [ATTR_NET_PEER_NAME]: host,\n };\n\n const portNumber = parseInt(port, 10);\n if (!isNaN(portNumber)) {\n attrs[ATTR_NET_PEER_PORT] = portNumber;\n }\n\n return attrs;\n}\n\nfunction getConfig(config: any) {\n const { host, port, database, user } = config?.connectionConfig || config || {};\n return { host, port, database, user };\n}\n\nfunction getJDBCString(host: string | undefined, port: number | undefined, database: string | undefined) {\n let jdbcString = `jdbc:mysql://${host || 'localhost'}`;\n\n if (typeof port === 'number') {\n jdbcString += `:${port}`;\n }\n\n if (typeof database === 'string') {\n jdbcString += `/${database}`;\n }\n\n return jdbcString;\n}\n\nexport function getQueryText(query: string | Query | QueryOptions, format?: FormatFunction, values?: any[]): string {\n const [querySql, queryValues] =\n typeof query === 'string' ? [query, values] : [query.sql, hasValues(query) ? values || query.values : values];\n try {\n if (format && queryValues) {\n return format(querySql, queryValues);\n } else {\n return querySql;\n }\n } catch {\n return 'Could not determine the query due to an error in formatting';\n }\n}\n\nfunction hasValues(obj: Query | QueryOptions): obj is QueryOptions {\n return 'values' in obj;\n}\n\nexport function getSpanName(query: string | Query | QueryOptions): string {\n const rawQuery = typeof query === 'object' ? query.sql : query;\n const firstSpace = rawQuery?.indexOf(' ');\n if (typeof firstSpace === 'number' && firstSpace !== -1) {\n return rawQuery?.substring(0, firstSpace);\n }\n return rawQuery;\n}\n\nexport const once = (fn: Function) => {\n let called = false;\n return (...args: unknown[]) => {\n if (called) return;\n called = true;\n return fn(...args);\n };\n};\n\nexport function getConnectionPrototypeToInstrument(connection: any) {\n const connectionPrototype = connection.prototype;\n const basePrototype = Object.getPrototypeOf(connectionPrototype);\n\n if (typeof basePrototype?.query === 'function' && typeof basePrototype?.execute === 'function') {\n return basePrototype;\n }\n\n return connectionPrototype;\n}\n"],"names":["ATTR_DB_CONNECTION_STRING","ATTR_DB_NAME","ATTR_DB_USER","ATTR_NET_PEER_NAME","ATTR_NET_PEER_PORT"],"mappings":";;;;AAsCO,SAAS,wBAAwB,MAAA,EAAgC;AACtE,EAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAM,UAAU,IAAA,EAAK,GAAI,UAAU,MAAM,CAAA;AAEvD,EAAA,MAAM,KAAA,GAAwB;AAAA,IAC5B,CAACA,iCAAyB,GAAG,aAAA,CAAc,IAAA,EAAM,MAAM,QAAQ,CAAA;AAAA,IAC/D,CAACC,oBAAY,GAAG,QAAA;AAAA,IAChB,CAACC,oBAAY,GAAG,IAAA;AAAA,IAChB,CAACC,0BAAkB,GAAG;AAAA,GACxB;AAEA,EAAA,MAAM,UAAA,GAAa,QAAA,CAAS,IAAA,EAAM,EAAE,CAAA;AACpC,EAAA,IAAI,CAAC,KAAA,CAAM,UAAU,CAAA,EAAG;AACtB,IAAA,KAAA,CAAMC,0BAAkB,CAAA,GAAI,UAAA;AAAA,EAC9B;AAEA,EAAA,OAAO,KAAA;AACT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W,OAAO,KAAA,KAAU,QAAA,GAAW,MAAM,GAAA,GAAM,KAAA;AACzD,EAAA,MAAM,UAAA,GAAa,QAAA,EAAU,OAAA,CAAQ,GAAG,CAAA;AACxC,EAAA,IAAI,OAAO,UAAA,KAAe,QAAA,IAAY,UAAA,KAAe,EAAA,EAAI;AACvD,IAAA,OAAO,QAAA,EAAU,SAAA,CAAU,CAAA,EAAG,UAAU,CAAA;AAAA,EAC1C;AACA,EAAA,OAAO,QAAA;AACT;AAEO,MAAM,IAAA,GAAO,CAAC,EAAA,KAAiB;AACpC,EAAA,IAAI,MAAA,GAAS,KAAA;AACb,EAAA,OAAO,IAAI,IAAA,KAAoB;AAC7B,IAAA,IAAI,MAAA,EAAQ;AACZ,IAAA,MAAA,GAAS,IAAA;AACT,IAAA,OAAO,EAAA,CAAG,GAAG,IAAI,CAAA;AAAA,EACnB,CAAA;AACF;AAEO,SAAS,mCAAmC,UAAA,EAAiB;AAClE,EAAA,MAAM,sBAAsB,UAAA,CAAW,SAAA;AACvC,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAO,cAAA,CAAe,mBAAmB,CAAA;AAE/D,EAAA,IAAI,OAAO,aAAA,EAAe,KAAA,KAAU,cAAc,OAAO,aAAA,EAAe,YAAY,UAAA,EAAY;AAC9F,IAAA,OAAO,aAAA;AAAA,EACT;AAEA,EAAA,OAAO,mBAAA;AACT;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/mysql2/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql2\n * - Upstream version: @opentelemetry/instrumentation-mysql2@0.64.0\n * - Types from 'mysql2' inlined as simplified interfaces\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n */\n\nimport { DB_NAME, DB_USER, NET_PEER_NAME, NET_PEER_PORT } from '@sentry/conventions/attributes';\nimport type { SpanAttributes } from '@sentry/core';\nimport type { FormatFunction } from './mysql2-types';\nimport { ATTR_DB_CONNECTION_STRING } from './semconv';\n\ninterface QueryOptions {\n sql: string;\n values?: any | any[] | { [param: string]: any };\n}\n\ninterface Query {\n sql: string;\n}\n\ninterface Config {\n host?: string;\n port?: number;\n database?: string;\n user?: string;\n connectionConfig?: Config;\n}\n\nexport function getConnectionAttributes(config: Config): SpanAttributes {\n const { host, port, database, user } = getConfig(config);\n\n const attrs: SpanAttributes = {\n [ATTR_DB_CONNECTION_STRING]: getJDBCString(host, port, database),\n // oxlint-disable-next-line typescript/no-deprecated\n [DB_NAME]: database,\n [DB_USER]: user,\n // oxlint-disable-next-line typescript/no-deprecated\n [NET_PEER_NAME]: host,\n };\n\n const portNumber = parseInt(port, 10);\n if (!isNaN(portNumber)) {\n // oxlint-disable-next-line typescript/no-deprecated\n attrs[NET_PEER_PORT] = portNumber;\n }\n\n return attrs;\n}\n\nfunction getConfig(config: any) {\n const { host, port, database, user } = config?.connectionConfig || config || {};\n return { host, port, database, user };\n}\n\nfunction getJDBCString(host: string | undefined, port: number | undefined, database: string | undefined) {\n let jdbcString = `jdbc:mysql://${host || 'localhost'}`;\n\n if (typeof port === 'number') {\n jdbcString += `:${port}`;\n }\n\n if (typeof database === 'string') {\n jdbcString += `/${database}`;\n }\n\n return jdbcString;\n}\n\nexport function getQueryText(query: string | Query | QueryOptions, format?: FormatFunction, values?: any[]): string {\n const [querySql, queryValues] =\n typeof query === 'string' ? [query, values] : [query.sql, hasValues(query) ? values || query.values : values];\n try {\n if (format && queryValues) {\n return format(querySql, queryValues);\n } else {\n return querySql;\n }\n } catch {\n return 'Could not determine the query due to an error in formatting';\n }\n}\n\nfunction hasValues(obj: Query | QueryOptions): obj is QueryOptions {\n return 'values' in obj;\n}\n\nexport function getSpanName(query: string | Query | QueryOptions): string {\n const rawQuery = typeof query === 'object' ? query.sql : query;\n const firstSpace = rawQuery?.indexOf(' ');\n if (typeof firstSpace === 'number' && firstSpace !== -1) {\n return rawQuery?.substring(0, firstSpace);\n }\n return rawQuery;\n}\n\nexport const once = (fn: Function) => {\n let called = false;\n return (...args: unknown[]) => {\n if (called) return;\n called = true;\n return fn(...args);\n };\n};\n\nexport function getConnectionPrototypeToInstrument(connection: any) {\n const connectionPrototype = connection.prototype;\n const basePrototype = Object.getPrototypeOf(connectionPrototype);\n\n if (typeof basePrototype?.query === 'function' && typeof basePrototype?.execute === 'function') {\n return basePrototype;\n }\n\n return connectionPrototype;\n}\n"],"names":["ATTR_DB_CONNECTION_STRING","DB_NAME","DB_USER","NET_PEER_NAME","NET_PEER_PORT"],"mappings":";;;;;AAiCO,SAAS,wBAAwB,MAAA,EAAgC;AACtE,EAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAM,UAAU,IAAA,EAAK,GAAI,UAAU,MAAM,CAAA;AAEvD,EAAA,MAAM,KAAA,GAAwB;AAAA,IAC5B,CAACA,iCAAyB,GAAG,aAAA,CAAc,IAAA,EAAM,MAAM,QAAQ,CAAA;AAAA;AAAA,IAE/D,CAACC,kBAAO,GAAG,QAAA;AAAA,IACX,CAACC,kBAAO,GAAG,IAAA;AAAA;AAAA,IAEX,CAACC,wBAAa,GAAG;AAAA,GACnB;AAEA,EAAA,MAAM,UAAA,GAAa,QAAA,CAAS,IAAA,EAAM,EAAE,CAAA;AACpC,EAAA,IAAI,CAAC,KAAA,CAAM,UAAU,CAAA,EAAG;AAEtB,IAAA,KAAA,CAAMC,wBAAa,CAAA,GAAI,UAAA;AAAA,EACzB;AAEA,EAAA,OAAO,KAAA;AACT;AAEA,SAAS,UAAU,MAAA,EAAa;AAC9B,EAAA,MAAM,EAAE,MAAM,IAAA,EAAM,QAAA,EAAU,MAAK,GAAI,MAAA,EAAQ,gBAAA,IAAoB,MAAA,IAAU,EAAC;AAC9E,EAAA,OAAO,EAAE,IAAA,EAAM,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e,EAAA,EAAI;AACvD,IAAA,OAAO,QAAA,EAAU,SAAA,CAAU,CAAA,EAAG,UAAU,CAAA;AAAA,EAC1C;AACA,EAAA,OAAO,QAAA;AACT;AAEO,MAAM,IAAA,GAAO,CAAC,EAAA,KAAiB;AACpC,EAAA,IAAI,MAAA,GAAS,KAAA;AACb,EAAA,OAAO,IAAI,IAAA,KAAoB;AAC7B,IAAA,IAAI,MAAA,EAAQ;AACZ,IAAA,MAAA,GAAS,IAAA;AACT,IAAA,OAAO,EAAA,CAAG,GAAG,IAAI,CAAA;AAAA,EACnB,CAAA;AACF;AAEO,SAAS,mCAAmC,UAAA,EAAiB;AAClE,EAAA,MAAM,sBAAsB,UAAA,CAAW,SAAA;AACvC,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAO,cAAA,CAAe,mBAAmB,CAAA;AAE/D,EAAA,IAAI,OAAO,aAAA,EAAe,KAAA,KAAU,cAAc,OAAO,aAAA,EAAe,YAAY,UAAA,EAAY;AAC9F,IAAA,OAAO,aAAA;AAAA,EACT;AAEA,EAAA,OAAO,mBAAA;AACT;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/postgres/index.ts"],"sourcesContent":["import { PgInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\ninterface PostgresIntegrationOptions {\n ignoreConnectSpans?: boolean;\n}\n\nconst INTEGRATION_NAME = 'Postgres';\n\nexport const instrumentPostgres = generateInstrumentOnce(\n INTEGRATION_NAME,\n PgInstrumentation,\n (options?: PostgresIntegrationOptions) => ({\n ignoreConnectSpans: options?.ignoreConnectSpans ?? false,\n }),\n);\n\nconst _postgresIntegration = ((options?: PostgresIntegrationOptions) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPostgres(options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [pg](https://www.npmjs.com/package/pg) library.\n *\n * For more information, see the [`postgresIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/postgres/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.postgresIntegration()],\n * });\n * ```\n */\nexport const postgresIntegration = defineIntegration(_postgresIntegration);\n"],"names":["generateInstrumentOnce","PgInstrumentation","defineIntegration"],"mappings":";;;;;;AASA,MAAM,gBAAA,GAAmB,UAAA;AAElB,MAAM,kBAAA,GAAqBA,+BAAA;AAAA,EAChC,gBAAA;AAAA,EACAC,iCAAA;AAAA,EACA,CAAC,OAAA,MAA0C;AAAA,IACzC,kBAAA,EAAoB,SAAS,kBAAA,IAAsB;AAAA,GACrD;AACF;AAEA,MAAM,oBAAA,IAAwB,CAAC,OAAA,KAAyC;AACtE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,CAAmB,OAAO,CAAA;AAAA,IAC5B;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,mBAAA,GAAsBC,uBAAkB,oBAAoB;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/postgres/index.ts"],"sourcesContent":["import { PgInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\ninterface PostgresIntegrationOptions {\n ignoreConnectSpans?: boolean;\n}\n\nconst INTEGRATION_NAME = 'Postgres' as const;\n\nexport const instrumentPostgres = generateInstrumentOnce(\n INTEGRATION_NAME,\n PgInstrumentation,\n (options?: PostgresIntegrationOptions) => ({\n ignoreConnectSpans: options?.ignoreConnectSpans ?? false,\n }),\n);\n\nconst _postgresIntegration = ((options?: PostgresIntegrationOptions) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPostgres(options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [pg](https://www.npmjs.com/package/pg) library.\n *\n * For more information, see the [`postgresIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/postgres/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.postgresIntegration()],\n * });\n * ```\n */\nexport const postgresIntegration = defineIntegration(_postgresIntegration);\n"],"names":["generateInstrumentOnce","PgInstrumentation","defineIntegration"],"mappings":";;;;;;AASA,MAAM,gBAAA,GAAmB,UAAA;AAElB,MAAM,kBAAA,GAAqBA,+BAAA;AAAA,EAChC,gBAAA;AAAA,EACAC,iCAAA;AAAA,EACA,CAAC,OAAA,MAA0C;AAAA,IACzC,kBAAA,EAAoB,SAAS,kBAAA,IAAsB;AAAA,GACrD;AACF;AAEA,MAAM,oBAAA,IAAwB,CAAC,OAAA,KAAyC;AACtE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,CAAmB,OAAO,CAAA;AAAA,IAC5B;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,mBAAA,GAAsBC,uBAAkB,oBAAoB;;;;;"}
@@ -1,20 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const ATTR_DB_CONNECTION_STRING = "db.connection_string";
4
- const ATTR_DB_NAME = "db.name";
5
- const ATTR_DB_STATEMENT = "db.statement";
6
- const ATTR_DB_SYSTEM = "db.system";
7
- const ATTR_DB_USER = "db.user";
8
- const ATTR_NET_PEER_NAME = "net.peer.name";
9
- const ATTR_NET_PEER_PORT = "net.peer.port";
10
4
  const DB_SYSTEM_VALUE_POSTGRESQL = "postgresql";
11
5
 
12
6
  exports.ATTR_DB_CONNECTION_STRING = ATTR_DB_CONNECTION_STRING;
13
- exports.ATTR_DB_NAME = ATTR_DB_NAME;
14
- exports.ATTR_DB_STATEMENT = ATTR_DB_STATEMENT;
15
- exports.ATTR_DB_SYSTEM = ATTR_DB_SYSTEM;
16
- exports.ATTR_DB_USER = ATTR_DB_USER;
17
- exports.ATTR_NET_PEER_NAME = ATTR_NET_PEER_NAME;
18
- exports.ATTR_NET_PEER_PORT = ATTR_NET_PEER_PORT;
19
7
  exports.DB_SYSTEM_VALUE_POSTGRESQL = DB_SYSTEM_VALUE_POSTGRESQL;
20
8
  //# sourceMappingURL=semconv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/postgres/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-pg\n * - Upstream version: @opentelemetry/instrumentation-pg@0.70.0\n * - Trimmed to the (old) semantic conventions the SDK actually emits\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * Deprecated, use `server.address`, `server.port` attributes instead.\n *\n * @example \"Server=(localdb)\\\\v11.0;Integrated Security=true;\"\n *\n * @deprecated Replaced by `server.address` and `server.port`.\n */\nexport const ATTR_DB_CONNECTION_STRING = 'db.connection_string' as const;\n\n/**\n * Deprecated, use `db.namespace` instead.\n *\n * @example customers\n * @example main\n *\n * @deprecated Replaced by `db.namespace`.\n */\nexport const ATTR_DB_NAME = 'db.name' as const;\n\n/**\n * The database statement being executed.\n *\n * @example SELECT * FROM wuser_table\n * @example SET mykey \"WuValue\"\n *\n * @deprecated Replaced by `db.query.text`.\n */\nexport const ATTR_DB_STATEMENT = 'db.statement' as const;\n\n/**\n * Deprecated, use `db.system.name` instead.\n *\n * @deprecated Replaced by `db.system.name`.\n */\nexport const ATTR_DB_SYSTEM = 'db.system' as const;\n\n/**\n * Deprecated, no replacement at this time.\n *\n * @example readonly_user\n * @example reporting_user\n *\n * @deprecated Removed, no replacement at this time.\n */\nexport const ATTR_DB_USER = 'db.user' as const;\n\n/**\n * Deprecated, use `server.address` on client spans and `client.address` on server spans.\n *\n * @example example.com\n *\n * @deprecated Replaced by `server.address` on client spans and `client.address` on server spans.\n */\nexport const ATTR_NET_PEER_NAME = 'net.peer.name' as const;\n\n/**\n * Deprecated, use `server.port` on client spans and `client.port` on server spans.\n *\n * @example 8080\n *\n * @deprecated Replaced by `server.port` on client spans and `client.port` on server spans.\n */\nexport const ATTR_NET_PEER_PORT = 'net.peer.port' as const;\n\n/**\n * Enum value \"postgresql\" for attribute {@link ATTR_DB_SYSTEM}.\n */\nexport const DB_SYSTEM_VALUE_POSTGRESQL = 'postgresql' as const;\n"],"names":[],"mappings":";;AAuBO,MAAM,yBAAA,GAA4B;AAUlC,MAAM,YAAA,GAAe;AAUrB,MAAM,iBAAA,GAAoB;AAO1B,MAAM,cAAA,GAAiB;AAUvB,MAAM,YAAA,GAAe;AASrB,MAAM,kBAAA,GAAqB;AAS3B,MAAM,kBAAA,GAAqB;AAK3B,MAAM,0BAAA,GAA6B;;;;;;;;;;;"}
1
+ {"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/postgres/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-pg\n * - Upstream version: @opentelemetry/instrumentation-pg@0.70.0\n * - Trimmed to the (old) semantic conventions the SDK actually emits\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * Deprecated, use `server.address`, `server.port` attributes instead.\n *\n * @example \"Server=(localdb)\\\\v11.0;Integrated Security=true;\"\n *\n * @deprecated Replaced by `server.address` and `server.port`.\n */\nexport const ATTR_DB_CONNECTION_STRING = 'db.connection_string' as const;\n\n/**\n * Enum value \"postgresql\" for attribute `db.system`.\n */\nexport const DB_SYSTEM_VALUE_POSTGRESQL = 'postgresql' as const;\n"],"names":[],"mappings":";;AAuBO,MAAM,yBAAA,GAA4B;AAKlC,MAAM,0BAAA,GAA6B;;;;;"}
@@ -4,6 +4,7 @@ const core = require('@sentry/core');
4
4
  const AttributeNames = require('./enums/AttributeNames.js');
5
5
  const SpanNames = require('./enums/SpanNames.js');
6
6
  const semconv = require('./semconv.js');
7
+ const attributes = require('@sentry/conventions/attributes');
7
8
 
8
9
  const ORIGIN = "auto.db.otel.postgres";
9
10
  function getQuerySpanName(dbName, queryConfig) {
@@ -45,13 +46,13 @@ function getPort(port) {
45
46
  }
46
47
  function getSemanticAttributesFromConnection(params) {
47
48
  return {
48
- [semconv.ATTR_DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_POSTGRESQL,
49
- [semconv.ATTR_DB_NAME]: params.database,
49
+ [attributes.DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_POSTGRESQL,
50
+ [attributes.DB_NAME]: params.database,
50
51
  [semconv.ATTR_DB_CONNECTION_STRING]: getConnectionString(params),
51
- [semconv.ATTR_DB_USER]: params.user,
52
- [semconv.ATTR_NET_PEER_NAME]: params.host,
52
+ [attributes.DB_USER]: params.user,
53
+ [attributes.NET_PEER_NAME]: params.host,
53
54
  // required
54
- [semconv.ATTR_NET_PEER_PORT]: getPort(params.port)
55
+ [attributes.NET_PEER_PORT]: getPort(params.port)
55
56
  };
56
57
  }
57
58
  function getSemanticAttributesFromPoolConnection(params) {
@@ -64,12 +65,12 @@ function getSemanticAttributesFromPoolConnection(params) {
64
65
  return {
65
66
  [AttributeNames.AttributeNames.IDLE_TIMEOUT_MILLIS]: params.idleTimeoutMillis,
66
67
  [AttributeNames.AttributeNames.MAX_CLIENT]: params.maxClient,
67
- [semconv.ATTR_DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_POSTGRESQL,
68
- [semconv.ATTR_DB_NAME]: url?.pathname.slice(1) ?? params.database,
68
+ [attributes.DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_POSTGRESQL,
69
+ [attributes.DB_NAME]: url?.pathname.slice(1) ?? params.database,
69
70
  [semconv.ATTR_DB_CONNECTION_STRING]: getConnectionString(params),
70
- [semconv.ATTR_NET_PEER_NAME]: url?.hostname ?? params.host,
71
- [semconv.ATTR_NET_PEER_PORT]: Number(url?.port) || getPort(params.port),
72
- [semconv.ATTR_DB_USER]: url?.username ?? params.user
71
+ [attributes.NET_PEER_NAME]: url?.hostname ?? params.host,
72
+ [attributes.NET_PEER_PORT]: Number(url?.port) || getPort(params.port),
73
+ [attributes.DB_USER]: url?.username ?? params.user
73
74
  };
74
75
  }
75
76
  function shouldSkipInstrumentation() {
@@ -91,7 +92,7 @@ function handleConfigQuery(queryConfig) {
91
92
  return span;
92
93
  }
93
94
  if (queryConfig.text) {
94
- span.setAttribute(semconv.ATTR_DB_STATEMENT, queryConfig.text);
95
+ span.setAttribute(attributes.DB_STATEMENT, queryConfig.text);
95
96
  }
96
97
  if (typeof queryConfig.name === "string") {
97
98
  span.setAttribute(AttributeNames.AttributeNames.PG_PLAN, queryConfig.name);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/postgres/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-pg\n * - Upstream version: @opentelemetry/instrumentation-pg@0.70.0\n * - Types from `pg` package inlined as simplified interfaces\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n */\n\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n getActiveSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport { AttributeNames } from './enums/AttributeNames';\nimport { SpanNames } from './enums/SpanNames';\nimport type {\n PgClientExtended,\n PgParsedConnectionParams,\n PgPoolCallback,\n PgPoolExtended,\n PgPoolOptionsParams,\n PostgresCallback,\n} from './internal-types';\nimport type { PgClient } from './pg-types';\nimport {\n ATTR_DB_CONNECTION_STRING,\n ATTR_DB_NAME,\n ATTR_DB_STATEMENT,\n ATTR_DB_SYSTEM,\n ATTR_DB_USER,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n DB_SYSTEM_VALUE_POSTGRESQL,\n} from './semconv';\n\n/* oxlint-disable typescript/no-deprecated */\n\nexport const ORIGIN = 'auto.db.otel.postgres';\n\n/**\n * Helper function to get a low cardinality span name from whatever info we have\n * about the query.\n *\n * This is tricky, because we don't have most of the information (table name,\n * operation name, etc) the spec recommends using to build a low-cardinality\n * value w/o parsing. So, we use db.name and assume that, if the query's a named\n * prepared statement, those `name` values will be low cardinality. If we don't\n * have a named prepared statement, we try to parse an operation (despite the\n * spec's warnings).\n *\n * @params dbName The name of the db against which this query is being issued,\n * which could be missing if no db name was given at the time that the\n * connection was established.\n * @params queryConfig Information we have about the query being issued, typed\n * to reflect only the validation we've actually done on the args to\n * `client.query()`. This will be undefined if `client.query()` was called\n * with invalid arguments.\n */\nexport function getQuerySpanName(dbName: string | undefined, queryConfig?: { text: string; name?: unknown }): string {\n // NB: when the query config is invalid, we omit the dbName too, so that\n // someone (or some tool) reading the span name doesn't misinterpret the\n // dbName as being a prepared statement or sql commit name.\n if (!queryConfig) return SpanNames.QUERY_PREFIX;\n\n // Either the name of a prepared statement; or an attempted parse\n // of the SQL command, normalized to uppercase; or unknown.\n const command =\n typeof queryConfig.name === 'string' && queryConfig.name\n ? queryConfig.name\n : parseNormalizedOperationName(queryConfig.text);\n\n return `${SpanNames.QUERY_PREFIX}:${command}${dbName ? ` ${dbName}` : ''}`;\n}\n\nexport function parseNormalizedOperationName(queryText: string): string {\n // Trim the query text to handle leading/trailing whitespace\n const trimmedQuery = queryText.trim();\n const indexOfFirstSpace = trimmedQuery.indexOf(' ');\n let sqlCommand = indexOfFirstSpace === -1 ? trimmedQuery : trimmedQuery.slice(0, indexOfFirstSpace);\n sqlCommand = sqlCommand.toUpperCase();\n\n // Handle query text being \"COMMIT;\", which has an extra semicolon before the space.\n return sqlCommand.endsWith(';') ? sqlCommand.slice(0, -1) : sqlCommand;\n}\n\nexport function parseAndMaskConnectionString(connectionString: string): string {\n try {\n // Parse the connection string\n const url = new URL(connectionString);\n\n // Remove all auth information (username and password)\n url.username = '';\n url.password = '';\n\n return url.toString();\n } catch {\n // If parsing fails, return a generic connection string\n return 'postgresql://localhost:5432/';\n }\n}\n\nexport function getConnectionString(params: PgParsedConnectionParams | PgPoolOptionsParams): string {\n if ('connectionString' in params && params.connectionString) {\n return parseAndMaskConnectionString(params.connectionString);\n }\n const host = params.host || 'localhost';\n const port = params.port || 5432;\n const database = params.database || '';\n return `postgresql://${host}:${port}/${database}`;\n}\n\nfunction getPort(port: number | undefined): number | undefined {\n // Port may be NaN as parseInt() is used on the value, passing null will result in NaN being parsed.\n // https://github.com/brianc/node-postgres/blob/2a8efbee09a284be12748ed3962bc9b816965e36/packages/pg/lib/connection-parameters.js#L66\n if (Number.isInteger(port)) {\n return port;\n }\n\n // Unable to find the default used in pg code, so falling back to 'undefined'.\n return undefined;\n}\n\nexport function getSemanticAttributesFromConnection(params: PgParsedConnectionParams): SpanAttributes {\n return {\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_POSTGRESQL,\n [ATTR_DB_NAME]: params.database,\n [ATTR_DB_CONNECTION_STRING]: getConnectionString(params),\n [ATTR_DB_USER]: params.user,\n [ATTR_NET_PEER_NAME]: params.host, // required\n [ATTR_NET_PEER_PORT]: getPort(params.port),\n };\n}\n\nexport function getSemanticAttributesFromPoolConnection(params: PgPoolOptionsParams): SpanAttributes {\n let url: URL | undefined;\n try {\n url = params.connectionString ? new URL(params.connectionString) : undefined;\n } catch {\n url = undefined;\n }\n\n return {\n [AttributeNames.IDLE_TIMEOUT_MILLIS]: params.idleTimeoutMillis,\n [AttributeNames.MAX_CLIENT]: params.maxClient,\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_POSTGRESQL,\n [ATTR_DB_NAME]: url?.pathname.slice(1) ?? params.database,\n [ATTR_DB_CONNECTION_STRING]: getConnectionString(params),\n [ATTR_NET_PEER_NAME]: url?.hostname ?? params.host,\n [ATTR_NET_PEER_PORT]: Number(url?.port) || getPort(params.port),\n [ATTR_DB_USER]: url?.username ?? params.user,\n };\n}\n\n/**\n * The SDK always requires a parent span (it sets `requireParentSpan: true`), so\n * we only instrument when there is an active span to parent the new span under.\n */\nexport function shouldSkipInstrumentation(): boolean {\n return getActiveSpan() === undefined;\n}\n\n// Create an (inactive) span from our normalized queryConfig object,\n// or return a basic span if no queryConfig was given/could be created.\nexport function handleConfigQuery(\n this: PgClientExtended,\n queryConfig?: { text: string; values?: unknown; name?: unknown },\n): Span {\n // Create child span.\n const { connectionParameters } = this;\n const dbName = connectionParameters.database;\n\n const spanName = getQuerySpanName(dbName, queryConfig);\n const span = startInactiveSpan({\n name: spanName,\n kind: SPAN_KIND.CLIENT,\n attributes: {\n ...getSemanticAttributesFromConnection(connectionParameters),\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n },\n });\n\n if (!queryConfig) {\n return span;\n }\n\n // Set attributes\n if (queryConfig.text) {\n span.setAttribute(ATTR_DB_STATEMENT, queryConfig.text);\n }\n\n // Set plan name attribute, if present\n if (typeof queryConfig.name === 'string') {\n span.setAttribute(AttributeNames.PG_PLAN, queryConfig.name);\n }\n\n return span;\n}\n\nexport function patchCallback(span: Span, cb: PostgresCallback): PostgresCallback {\n return function patchedCallback(this: PgClientExtended, err: Error, res: object) {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: err.message });\n }\n span.end();\n cb.call(this, err, res);\n };\n}\n\nexport function patchCallbackPGPool(span: Span, cb: PgPoolCallback): PgPoolCallback {\n return function patchedCallback(this: PgPoolExtended, err: Error, res: object, done: any) {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: err.message });\n }\n span.end();\n cb.call(this, err, res, done);\n };\n}\n\nexport function patchClientConnectCallback(span: Span, cb: (...args: unknown[]) => void): (...args: unknown[]) => void {\n return function patchedClientConnectCallback(this: PgClient, ...args: unknown[]) {\n const err = args[0];\n if (err instanceof Error) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: err.message });\n }\n span.end();\n cb.apply(this, args);\n };\n}\n\n/**\n * Attempt to get a message string from a thrown value, while being quite\n * defensive, to recognize the fact that, in JS, any kind of value (even\n * primitives) can be thrown.\n */\nexport function getErrorMessage(e: unknown): string | undefined {\n return typeof e === 'object' && e !== null && 'message' in e\n ? String((e as { message?: unknown }).message)\n : undefined;\n}\n\nexport function isObjectWithTextString(it: unknown): it is ObjectWithText {\n return typeof it === 'object' && typeof (it as null | { text?: unknown })?.text === 'string';\n}\n\nexport type ObjectWithText = {\n text: string;\n [k: string]: unknown;\n};\n"],"names":["SpanNames","ATTR_DB_SYSTEM","DB_SYSTEM_VALUE_POSTGRESQL","ATTR_DB_NAME","ATTR_DB_CONNECTION_STRING","ATTR_DB_USER","ATTR_NET_PEER_NAME","ATTR_NET_PEER_PORT","AttributeNames","getActiveSpan","startInactiveSpan","SPAN_KIND","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","ATTR_DB_STATEMENT","SPAN_STATUS_ERROR"],"mappings":";;;;;;;AA2CO,MAAM,MAAA,GAAS;AAqBf,SAAS,gBAAA,CAAiB,QAA4B,WAAA,EAAwD;AAInH,EAAA,IAAI,CAAC,WA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;AAOO,SAAS,gBAAgB,CAAA,EAAgC;AAC9D,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,IAAY,CAAA,KAAM,IAAA,IAAQ,aAAa,CAAA,GACvD,MAAA,CAAQ,CAAA,CAA4B,OAAO,CAAA,GAC3C,MAAA;AACN;AAEO,SAAS,uBAAuB,EAAA,EAAmC;AACxE,EAAA,OAAO,OAAO,EAAA,KAAO,QAAA,IAAY,OAAQ,IAAkC,IAAA,KAAS,QAAA;AACtF;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/postgres/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-pg\n * - Upstream version: @opentelemetry/instrumentation-pg@0.70.0\n * - Types from `pg` package inlined as simplified interfaces\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n */\n\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n getActiveSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport { AttributeNames } from './enums/AttributeNames';\nimport { SpanNames } from './enums/SpanNames';\nimport type {\n PgClientExtended,\n PgParsedConnectionParams,\n PgPoolCallback,\n PgPoolExtended,\n PgPoolOptionsParams,\n PostgresCallback,\n} from './internal-types';\nimport type { PgClient } from './pg-types';\nimport { ATTR_DB_CONNECTION_STRING, DB_SYSTEM_VALUE_POSTGRESQL } from './semconv';\nimport {\n DB_NAME,\n DB_STATEMENT,\n DB_SYSTEM,\n DB_USER,\n NET_PEER_NAME,\n NET_PEER_PORT,\n} from '@sentry/conventions/attributes';\n\n/* oxlint-disable typescript/no-deprecated */\n\nexport const ORIGIN = 'auto.db.otel.postgres';\n\n/**\n * Helper function to get a low cardinality span name from whatever info we have\n * about the query.\n *\n * This is tricky, because we don't have most of the information (table name,\n * operation name, etc) the spec recommends using to build a low-cardinality\n * value w/o parsing. So, we use db.name and assume that, if the query's a named\n * prepared statement, those `name` values will be low cardinality. If we don't\n * have a named prepared statement, we try to parse an operation (despite the\n * spec's warnings).\n *\n * @params dbName The name of the db against which this query is being issued,\n * which could be missing if no db name was given at the time that the\n * connection was established.\n * @params queryConfig Information we have about the query being issued, typed\n * to reflect only the validation we've actually done on the args to\n * `client.query()`. This will be undefined if `client.query()` was called\n * with invalid arguments.\n */\nexport function getQuerySpanName(dbName: string | undefined, queryConfig?: { text: string; name?: unknown }): string {\n // NB: when the query config is invalid, we omit the dbName too, so that\n // someone (or some tool) reading the span name doesn't misinterpret the\n // dbName as being a prepared statement or sql commit name.\n if (!queryConfig) return SpanNames.QUERY_PREFIX;\n\n // Either the name of a prepared statement; or an attempted parse\n // of the SQL command, normalized to uppercase; or unknown.\n const command =\n typeof queryConfig.name === 'string' && queryConfig.name\n ? queryConfig.name\n : parseNormalizedOperationName(queryConfig.text);\n\n return `${SpanNames.QUERY_PREFIX}:${command}${dbName ? ` ${dbName}` : ''}`;\n}\n\nexport function parseNormalizedOperationName(queryText: string): string {\n // Trim the query text to handle leading/trailing whitespace\n const trimmedQuery = queryText.trim();\n const indexOfFirstSpace = trimmedQuery.indexOf(' ');\n let sqlCommand = indexOfFirstSpace === -1 ? trimmedQuery : trimmedQuery.slice(0, indexOfFirstSpace);\n sqlCommand = sqlCommand.toUpperCase();\n\n // Handle query text being \"COMMIT;\", which has an extra semicolon before the space.\n return sqlCommand.endsWith(';') ? sqlCommand.slice(0, -1) : sqlCommand;\n}\n\nexport function parseAndMaskConnectionString(connectionString: string): string {\n try {\n // Parse the connection string\n const url = new URL(connectionString);\n\n // Remove all auth information (username and password)\n url.username = '';\n url.password = '';\n\n return url.toString();\n } catch {\n // If parsing fails, return a generic connection string\n return 'postgresql://localhost:5432/';\n }\n}\n\nexport function getConnectionString(params: PgParsedConnectionParams | PgPoolOptionsParams): string {\n if ('connectionString' in params && params.connectionString) {\n return parseAndMaskConnectionString(params.connectionString);\n }\n const host = params.host || 'localhost';\n const port = params.port || 5432;\n const database = params.database || '';\n return `postgresql://${host}:${port}/${database}`;\n}\n\nfunction getPort(port: number | undefined): number | undefined {\n // Port may be NaN as parseInt() is used on the value, passing null will result in NaN being parsed.\n // https://github.com/brianc/node-postgres/blob/2a8efbee09a284be12748ed3962bc9b816965e36/packages/pg/lib/connection-parameters.js#L66\n if (Number.isInteger(port)) {\n return port;\n }\n\n // Unable to find the default used in pg code, so falling back to 'undefined'.\n return undefined;\n}\n\nexport function getSemanticAttributesFromConnection(params: PgParsedConnectionParams): SpanAttributes {\n return {\n [DB_SYSTEM]: DB_SYSTEM_VALUE_POSTGRESQL,\n [DB_NAME]: params.database,\n [ATTR_DB_CONNECTION_STRING]: getConnectionString(params),\n [DB_USER]: params.user,\n [NET_PEER_NAME]: params.host, // required\n [NET_PEER_PORT]: getPort(params.port),\n };\n}\n\nexport function getSemanticAttributesFromPoolConnection(params: PgPoolOptionsParams): SpanAttributes {\n let url: URL | undefined;\n try {\n url = params.connectionString ? new URL(params.connectionString) : undefined;\n } catch {\n url = undefined;\n }\n\n return {\n [AttributeNames.IDLE_TIMEOUT_MILLIS]: params.idleTimeoutMillis,\n [AttributeNames.MAX_CLIENT]: params.maxClient,\n [DB_SYSTEM]: DB_SYSTEM_VALUE_POSTGRESQL,\n [DB_NAME]: url?.pathname.slice(1) ?? params.database,\n [ATTR_DB_CONNECTION_STRING]: getConnectionString(params),\n [NET_PEER_NAME]: url?.hostname ?? params.host,\n [NET_PEER_PORT]: Number(url?.port) || getPort(params.port),\n [DB_USER]: url?.username ?? params.user,\n };\n}\n\n/**\n * The SDK always requires a parent span (it sets `requireParentSpan: true`), so\n * we only instrument when there is an active span to parent the new span under.\n */\nexport function shouldSkipInstrumentation(): boolean {\n return getActiveSpan() === undefined;\n}\n\n// Create an (inactive) span from our normalized queryConfig object,\n// or return a basic span if no queryConfig was given/could be created.\nexport function handleConfigQuery(\n this: PgClientExtended,\n queryConfig?: { text: string; values?: unknown; name?: unknown },\n): Span {\n // Create child span.\n const { connectionParameters } = this;\n const dbName = connectionParameters.database;\n\n const spanName = getQuerySpanName(dbName, queryConfig);\n const span = startInactiveSpan({\n name: spanName,\n kind: SPAN_KIND.CLIENT,\n attributes: {\n ...getSemanticAttributesFromConnection(connectionParameters),\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n },\n });\n\n if (!queryConfig) {\n return span;\n }\n\n // Set attributes\n if (queryConfig.text) {\n span.setAttribute(DB_STATEMENT, queryConfig.text);\n }\n\n // Set plan name attribute, if present\n if (typeof queryConfig.name === 'string') {\n span.setAttribute(AttributeNames.PG_PLAN, queryConfig.name);\n }\n\n return span;\n}\n\nexport function patchCallback(span: Span, cb: PostgresCallback): PostgresCallback {\n return function patchedCallback(this: PgClientExtended, err: Error, res: object) {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: err.message });\n }\n span.end();\n cb.call(this, err, res);\n };\n}\n\nexport function patchCallbackPGPool(span: Span, cb: PgPoolCallback): PgPoolCallback {\n return function patchedCallback(this: PgPoolExtended, err: Error, res: object, done: any) {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: err.message });\n }\n span.end();\n cb.call(this, err, res, done);\n };\n}\n\nexport function patchClientConnectCallback(span: Span, cb: (...args: unknown[]) => void): (...args: unknown[]) => void {\n return function patchedClientConnectCallback(this: PgClient, ...args: unknown[]) {\n const err = args[0];\n if (err instanceof Error) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: err.message });\n }\n span.end();\n cb.apply(this, args);\n };\n}\n\n/**\n * Attempt to get a message string from a thrown value, while being quite\n * defensive, to recognize the fact that, in JS, any kind of value (even\n * primitives) can be thrown.\n */\nexport function getErrorMessage(e: unknown): string | undefined {\n return typeof e === 'object' && e !== null && 'message' in e\n ? String((e as { message?: unknown }).message)\n : undefined;\n}\n\nexport function isObjectWithTextString(it: unknown): it is ObjectWithText {\n return typeof it === 'object' && typeof (it as null | { text?: unknown })?.text === 'string';\n}\n\nexport type ObjectWithText = {\n text: string;\n [k: string]: unknown;\n};\n"],"names":["SpanNames","DB_SYSTEM","DB_SYSTEM_VALUE_POSTGRESQL","DB_NAME","ATTR_DB_CONNECTION_STRING","DB_USER","NET_PEER_NAME","NET_PEER_PORT","AttributeNames","getActiveSpan","startInactiveSpan","SPAN_KIND","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","DB_STATEMENT","SPAN_STATUS_ERROR"],"mappings":";;;;;;;;AA0CO,MAAM,MAAA,GAAS;AAqBf,SAAS,gBAAA,CAAiB,QAA4B,WAAA,EAAwD;AAInH,EAAA,IAAI,CAAC,WAAA,EAAa,OAAOA,mBAAA,CAAU,YAAA;AAInC,EAAA,MAAM,OAAA,GACJ,OAAO,WAAA,CAAY,IAAA,KAAS,QAAA,IAAY,WAAA,CAAY,IAAA,GAChD,WAAA,CAAY,IAAA,GACZ,4BAAA,CAA6B,WAAA,CAAY,IAAI,CAAA;AAEnD,EAAA,OAAO,CAAA,EAAGA,mBAAA,CAAU,YAAY,CAAA,CAAA,EAAI,OAAO,GAAG,MAAA,GAAS,CAAA,CAAA,EAAI,MAAM,CAAA,CAAA,GAAK,EAAE,CAAA,CAAA;AAC1E;AAEO,SAAS,6BAA6B,SAAA,EAA2B;AAEtE,EAAA,MAAM,YAAA,GAAe,UAAU,IAAA,EAAK;AACpC,EAAA,MAAM,iBAAA,GAAoB,YAAA,CAAa,OAAA,CAAQ,GAAG,CAAA;AAClD,EAAA,IAAI,aAAa,iBAAA,KAAsB,EAAA,GAAK,eAAe,YAAA,CAAa,KAAA,CAAM,GAAG,iBAAiB,CAAA;AAClG,EAAA,UAAA,GAAa,WAAW,WAAA,EAAY;AAGpC,EAAA,OAAO,UAAA,CAAW,SAAS,GAAG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,IAAA,CAAK,GAAA,EAAI;AACT,IAAA,EAAA,CAAG,IAAA,CAAK,IAAA,EAAM,GAAA,EAAK,GAAA,EAAK,IAAI,CAAA;AAAA,EAC9B,CAAA;AACF;AAEO,SAAS,0BAAA,CAA2B,MAAY,EAAA,EAAgE;AACrH,EAAA,OAAO,SAAS,gCAAgD,IAAA,EAAiB;AAC/E,IAAA,MAAM,GAAA,GAAM,KAAK,CAAC,CAAA;AAClB,IAAA,IAAI,eAAe,KAAA,EAAO;AACxB,MAAA,IAAA,CAAK,UAAU,EAAE,IAAA,EAAMA,wBAAmB,OAAA,EAAS,GAAA,CAAI,SAAS,CAAA;AAAA,IAClE;AACA,IAAA,IAAA,CAAK,GAAA,EAAI;AACT,IAAA,EAAA,CAAG,KAAA,CAAM,MAAM,IAAI,CAAA;AAAA,EACrB,CAAA;AACF;AAOO,SAAS,gBAAgB,CAAA,EAAgC;AAC9D,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,IAAY,CAAA,KAAM,IAAA,IAAQ,aAAa,CAAA,GACvD,MAAA,CAAQ,CAAA,CAA4B,OAAO,CAAA,GAC3C,MAAA;AACN;AAEO,SAAS,uBAAuB,EAAA,EAAmC;AACxE,EAAA,OAAO,OAAO,EAAA,KAAO,QAAA,IAAY,OAAQ,IAAkC,IAAA,KAAS,QAAA;AACtF;;;;;;;;;;;;;;;;;"}
@@ -3,13 +3,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
3
  const api = require('@opentelemetry/api');
4
4
  const instrumentation = require('@opentelemetry/instrumentation');
5
5
  const InstrumentationNodeModuleFile = require('./InstrumentationNodeModuleFile.js');
6
- const semanticConventions = require('@opentelemetry/semantic-conventions');
6
+ const attributes = require('@sentry/conventions/attributes');
7
7
  const core = require('@sentry/core');
8
8
  const nodeCore = require('@sentry/node-core');
9
9
  const debugBuild = require('../../debug-build.js');
10
10
 
11
11
  const INTEGRATION_NAME = "PostgresJs";
12
12
  const SUPPORTED_VERSIONS = [">=3.0.0 <4"];
13
+ const ATTR_DB_RESPONSE_STATUS_CODE = "db.response.status_code";
13
14
  const SQL_OPERATION_REGEX = /^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i;
14
15
  const QUERY_FROM_INSTRUMENTED_SQL = /* @__PURE__ */ Symbol.for("sentry.query.from.instrumented.sql");
15
16
  const instrumentPostgresJs = nodeCore.generateInstrumentOnce(
@@ -111,12 +112,12 @@ class PostgresJsInstrumentation extends instrumentation.InstrumentationBase {
111
112
  */
112
113
  _setOperationName(span, sanitizedQuery, command) {
113
114
  if (command) {
114
- span.setAttribute(semanticConventions.ATTR_DB_OPERATION_NAME, command);
115
+ span.setAttribute(attributes.DB_OPERATION_NAME, command);
115
116
  return;
116
117
  }
117
118
  const operationMatch = sanitizedQuery?.match(SQL_OPERATION_REGEX);
118
119
  if (operationMatch?.[1]) {
119
- span.setAttribute(semanticConventions.ATTR_DB_OPERATION_NAME, operationMatch[1].toUpperCase());
120
+ span.setAttribute(attributes.DB_OPERATION_NAME, operationMatch[1].toUpperCase());
120
121
  }
121
122
  }
122
123
  /**
@@ -175,8 +176,8 @@ class PostgresJsInstrumentation extends instrumentation.InstrumentationBase {
175
176
  (span) => {
176
177
  nodeCore.addOriginToSpan(span, "auto.db.postgresjs");
177
178
  span.setAttributes({
178
- [semanticConventions.ATTR_DB_SYSTEM_NAME]: "postgres",
179
- [semanticConventions.ATTR_DB_QUERY_TEXT]: sanitizedSqlQuery
179
+ [attributes.DB_SYSTEM_NAME]: "postgres",
180
+ [attributes.DB_QUERY_TEXT]: sanitizedSqlQuery
180
181
  });
181
182
  const config = self.getConfig();
182
183
  const { requestHook } = config;
@@ -212,8 +213,8 @@ class PostgresJsInstrumentation extends instrumentation.InstrumentationBase {
212
213
  code: core.SPAN_STATUS_ERROR,
213
214
  message: rejectArgs?.[0]?.message || "unknown_error"
214
215
  });
215
- span.setAttribute(semanticConventions.ATTR_DB_RESPONSE_STATUS_CODE, rejectArgs?.[0]?.code || "unknown");
216
- span.setAttribute(semanticConventions.ATTR_ERROR_TYPE, rejectArgs?.[0]?.name || "unknown");
216
+ span.setAttribute(ATTR_DB_RESPONSE_STATUS_CODE, rejectArgs?.[0]?.code || "unknown");
217
+ span.setAttribute(attributes.ERROR_TYPE, rejectArgs?.[0]?.name || "unknown");
217
218
  self._setOperationName(span, sanitizedSqlQuery);
218
219
  span.end();
219
220
  } catch (e) {