@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 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/hapi/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-hapi\n * - Upstream version: @opentelemetry/instrumentation-hapi@0.64.0\n * - Types vendored from @hapi/hapi as simplified interfaces\n */\n\nimport type { Attributes } from '@opentelemetry/api';\nimport { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';\nimport { ATTR_HTTP_METHOD } from './semconv';\nimport type * as Hapi from './hapi-types';\nimport {\n HapiLayerType,\n HapiLifecycleMethodNames,\n type HapiPluginObject,\n type PatchableExtMethod,\n type ServerExtDirectInput,\n} from './internal-types';\nimport { AttributeNames } from './enums/AttributeNames';\n\nexport function getPluginName<T>(plugin: Hapi.Plugin<T>): string {\n if ((plugin as Hapi.PluginNameVersion).name) {\n return (plugin as Hapi.PluginNameVersion).name;\n } else {\n return (plugin as Hapi.PluginPackage).pkg.name;\n }\n}\n\nexport const isLifecycleExtType = (variableToCheck: unknown): variableToCheck is Hapi.ServerRequestExtType => {\n return typeof variableToCheck === 'string' && HapiLifecycleMethodNames.has(variableToCheck);\n};\n\nexport const isLifecycleExtEventObj = (\n variableToCheck: unknown,\n): variableToCheck is Hapi.ServerExtEventsRequestObject => {\n const event = (variableToCheck as Hapi.ServerExtEventsRequestObject)?.type;\n return event !== undefined && isLifecycleExtType(event);\n};\n\nexport const isDirectExtInput = (variableToCheck: unknown): variableToCheck is ServerExtDirectInput => {\n return (\n Array.isArray(variableToCheck) &&\n variableToCheck.length <= 3 &&\n isLifecycleExtType(variableToCheck[0]) &&\n typeof variableToCheck[1] === 'function'\n );\n};\n\nexport const isPatchableExtMethod = (\n variableToCheck: PatchableExtMethod | PatchableExtMethod[],\n): variableToCheck is PatchableExtMethod => {\n return !Array.isArray(variableToCheck);\n};\n\nexport const getRouteMetadata = (\n route: Hapi.ServerRoute,\n pluginName?: string,\n): {\n attributes: Attributes;\n name: string;\n} => {\n const attributes: Attributes = {\n [ATTR_HTTP_ROUTE]: route.path,\n // eslint-disable-next-line typescript/no-deprecated\n [ATTR_HTTP_METHOD]: route.method,\n };\n\n let name;\n if (pluginName) {\n attributes[AttributeNames.HAPI_TYPE] = HapiLayerType.PLUGIN;\n attributes[AttributeNames.PLUGIN_NAME] = pluginName;\n name = `${pluginName}: route - ${route.path}`;\n } else {\n attributes[AttributeNames.HAPI_TYPE] = HapiLayerType.ROUTER;\n name = `route - ${route.path}`;\n }\n\n return { attributes, name };\n};\n\nexport const getExtMetadata = (\n extPoint: Hapi.ServerRequestExtType,\n pluginName?: string,\n methodName?: string,\n): {\n attributes: Attributes;\n name: string;\n} => {\n let baseName = `ext - ${extPoint}`;\n if (methodName && methodName !== 'method') {\n // method is the default name for the extension in the ServerExtEventsObject format.\n baseName = `ext - ${extPoint} - ${methodName}`;\n }\n if (pluginName) {\n return {\n attributes: {\n [AttributeNames.EXT_TYPE]: extPoint,\n [AttributeNames.HAPI_TYPE]: HapiLayerType.EXT,\n [AttributeNames.PLUGIN_NAME]: pluginName,\n },\n name: `${pluginName}: ${baseName}`,\n };\n }\n return {\n attributes: {\n [AttributeNames.EXT_TYPE]: extPoint,\n [AttributeNames.HAPI_TYPE]: HapiLayerType.EXT,\n },\n name: baseName,\n };\n};\n\nexport const getPluginFromInput = <T>(pluginObj: HapiPluginObject<T>): Hapi.Plugin<T, void> => {\n if ('plugin' in pluginObj) {\n if ('plugin' in pluginObj.plugin) {\n return pluginObj.plugin.plugin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C5C;AAAA,IACA,IAAA,EAAM;AAAA,GACR;AACF;AAEO,MAAM,kBAAA,GAAqB,CAAI,SAAA,KAAyD;AAC7F,EAAA,IAAI,YAAY,SAAA,EAAW;AACzB,IAAA,IAAI,QAAA,IAAY,UAAU,MAAA,EAAQ;AAChC,MAAA,OAAO,UAAU,MAAA,CAAO,MAAA;AAAA,IAC1B;AACA,IAAA,OAAO,SAAA,CAAU,MAAA;AAAA,EACnB;AACA,EAAA,OAAO,SAAA;AACT;;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/hapi/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-hapi\n * - Upstream version: @opentelemetry/instrumentation-hapi@0.64.0\n * - Types vendored from @hapi/hapi as simplified interfaces\n */\n\nimport type { Attributes } from '@opentelemetry/api';\nimport { HTTP_METHOD, HTTP_ROUTE } from '@sentry/conventions/attributes';\nimport type * as Hapi from './hapi-types';\nimport {\n HapiLayerType,\n HapiLifecycleMethodNames,\n type HapiPluginObject,\n type PatchableExtMethod,\n type ServerExtDirectInput,\n} from './internal-types';\nimport { AttributeNames } from './enums/AttributeNames';\n\nexport function getPluginName<T>(plugin: Hapi.Plugin<T>): string {\n if ((plugin as Hapi.PluginNameVersion).name) {\n return (plugin as Hapi.PluginNameVersion).name;\n } else {\n return (plugin as Hapi.PluginPackage).pkg.name;\n }\n}\n\nexport const isLifecycleExtType = (variableToCheck: unknown): variableToCheck is Hapi.ServerRequestExtType => {\n return typeof variableToCheck === 'string' && HapiLifecycleMethodNames.has(variableToCheck);\n};\n\nexport const isLifecycleExtEventObj = (\n variableToCheck: unknown,\n): variableToCheck is Hapi.ServerExtEventsRequestObject => {\n const event = (variableToCheck as Hapi.ServerExtEventsRequestObject)?.type;\n return event !== undefined && isLifecycleExtType(event);\n};\n\nexport const isDirectExtInput = (variableToCheck: unknown): variableToCheck is ServerExtDirectInput => {\n return (\n Array.isArray(variableToCheck) &&\n variableToCheck.length <= 3 &&\n isLifecycleExtType(variableToCheck[0]) &&\n typeof variableToCheck[1] === 'function'\n );\n};\n\nexport const isPatchableExtMethod = (\n variableToCheck: PatchableExtMethod | PatchableExtMethod[],\n): variableToCheck is PatchableExtMethod => {\n return !Array.isArray(variableToCheck);\n};\n\nexport const getRouteMetadata = (\n route: Hapi.ServerRoute,\n pluginName?: string,\n): {\n attributes: Attributes;\n name: string;\n} => {\n const attributes: Attributes = {\n [HTTP_ROUTE]: route.path,\n // eslint-disable-next-line typescript/no-deprecated\n [HTTP_METHOD]: route.method,\n };\n\n let name;\n if (pluginName) {\n attributes[AttributeNames.HAPI_TYPE] = HapiLayerType.PLUGIN;\n attributes[AttributeNames.PLUGIN_NAME] = pluginName;\n name = `${pluginName}: route - ${route.path}`;\n } else {\n attributes[AttributeNames.HAPI_TYPE] = HapiLayerType.ROUTER;\n name = `route - ${route.path}`;\n }\n\n return { attributes, name };\n};\n\nexport const getExtMetadata = (\n extPoint: Hapi.ServerRequestExtType,\n pluginName?: string,\n methodName?: string,\n): {\n attributes: Attributes;\n name: string;\n} => {\n let baseName = `ext - ${extPoint}`;\n if (methodName && methodName !== 'method') {\n // method is the default name for the extension in the ServerExtEventsObject format.\n baseName = `ext - ${extPoint} - ${methodName}`;\n }\n if (pluginName) {\n return {\n attributes: {\n [AttributeNames.EXT_TYPE]: extPoint,\n [AttributeNames.HAPI_TYPE]: HapiLayerType.EXT,\n [AttributeNames.PLUGIN_NAME]: pluginName,\n },\n name: `${pluginName}: ${baseName}`,\n };\n }\n return {\n attributes: {\n [AttributeNames.EXT_TYPE]: extPoint,\n [AttributeNames.HAPI_TYPE]: HapiLayerType.EXT,\n },\n name: baseName,\n };\n};\n\nexport const getPluginFromInput = <T>(pluginObj: HapiPluginObject<T>): Hapi.Plugin<T, void> => {\n if ('plugin' in pluginObj) {\n if ('plugin' in pluginObj.plugin) {\n return pluginObj.plugin.plugin;\n }\n return pluginObj.plugin;\n }\n return pluginObj;\n};\n"],"names":["HapiLifecycleMethodNames","attributes","HTTP_ROUTE","HTTP_METHOD","AttributeNames","HapiLayerType"],"mappings":";;;;;;AAsBO,SAAS,cAAiB,MAAA,EAAgC;AAC/D,EAAA,IAAK,OAAkC,IAAA,EAAM;AAC3C,IAAA,OAAQ,MAAA,CAAkC,IAAA;AAAA,EAC5C,CAAA,MAAO;AACL,IAAA,OAAQ,OAA8B,GAAA,CAAI,IAAA;AAAA,EAC5C;AACF;AAEO,MAAM,kBAAA,GAAqB,CAAC,eAAA,KAA2E;AAC5G,EAAA,OAAO,OAAO,eAAA,KAAoB,QAAA,IAAYA,sCAAA,CAAyB,IAAI,eAAe,CAAA;AAC5F;AAEO,MAAM,sBAAA,GAAyB,CACpC,eAAA,KACyD;AACzD,EAAA,MAAM,QAAS,eAAA,EAAuD,IAAA;AACtE,EAAA,OAAO,KAAA,KAAU,MAAA,IAAa,kBAAA,CAAmB,KAAK,CAAA;AACxD;AAEO,MAAM,gBAAA,GAAmB,CAAC,eAAA,KAAsE;AACrG,EAAA,OACE,KAAA,CAAM,OAAA,CAAQ,eAAe,CAAA,IAC7B,gBAAgB,MAAA,IAAU,CAAA,IAC1B,kBAAA,CAAmB,eAAA,CAAgB,CAAC,CAAC,CAAA,IACrC,OAAO,eAAA,CAAgB,CAAC,CAAA,KAAM,UAAA;AAElC;AAEO,MAAM,oBAAA,GAAuB,CAClC,eAAA,KAC0C;AAC1C,EAAA,OAAO,CAAC,KAAA,CAAM,OAAA,CAAQ,eAAe,CAAA;AACvC;AAEO,MAAM,gBAAA,GAAmB,CAC9B,KAAA,EACA,UAAA,KAIG;AACH,EAAA,MAAMC,YAAA,GAAyB;AAAA,IAC7B,CAACC,qBAAU,GAAG,KAAA,CAAM,IAAA;AAAA;AAAA,IAEpB,CA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,QAAQ,GAAG,QAAA;AAAA,MAC3B,CAACA,6BAAA,CAAe,SAAS,GAAGC,2BAAA,CAAc;AAAA,KAC5C;AAAA,IACA,IAAA,EAAM;AAAA,GACR;AACF;AAEO,MAAM,kBAAA,GAAqB,CAAI,SAAA,KAAyD;AAC7F,EAAA,IAAI,YAAY,SAAA,EAAW;AACzB,IAAA,IAAI,QAAA,IAAY,UAAU,MAAA,EAAQ;AAChC,MAAA,OAAO,UAAU,MAAA,CAAO,MAAA;AAAA,IAC1B;AACA,IAAA,OAAO,SAAA,CAAU,MAAA;AAAA,EACnB;AACA,EAAA,OAAO,SAAA;AACT;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const semanticConventions = require('@opentelemetry/semantic-conventions');
3
+ const attributes = require('@sentry/conventions/attributes');
4
4
  const core = require('@sentry/core');
5
5
  const nodeCore = require('@sentry/node-core');
6
6
  const debugBuild = require('../../../debug-build.js');
@@ -9,16 +9,16 @@ const instrumentation = require('./instrumentation.js');
9
9
 
10
10
  const INTEGRATION_NAME = "Hono";
11
11
  function addHonoSpanAttributes(span) {
12
- const attributes = core.spanToJSON(span).data;
13
- const type = attributes[constants.AttributeNames.HONO_TYPE];
14
- if (attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_OP] || !type) {
12
+ const attributes$1 = core.spanToJSON(span).data;
13
+ const type = attributes$1[constants.AttributeNames.HONO_TYPE];
14
+ if (attributes$1[core.SEMANTIC_ATTRIBUTE_SENTRY_OP] || !type) {
15
15
  return;
16
16
  }
17
17
  span.setAttributes({
18
18
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.otel.hono",
19
19
  [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.hono`
20
20
  });
21
- const name = attributes[constants.AttributeNames.HONO_NAME];
21
+ const name = attributes$1[constants.AttributeNames.HONO_NAME];
22
22
  if (typeof name === "string") {
23
23
  span.updateName(name);
24
24
  }
@@ -26,8 +26,8 @@ function addHonoSpanAttributes(span) {
26
26
  debugBuild.DEBUG_BUILD && core.debug.warn("Isolation scope is default isolation scope - skipping setting transactionName");
27
27
  return;
28
28
  }
29
- const route = attributes[semanticConventions.ATTR_HTTP_ROUTE];
30
- const method = attributes[semanticConventions.ATTR_HTTP_REQUEST_METHOD];
29
+ const route = attributes$1[attributes.HTTP_ROUTE];
30
+ const method = attributes$1[attributes.HTTP_REQUEST_METHOD];
31
31
  if (typeof route === "string" && typeof method === "string") {
32
32
  core.getIsolationScope().setTransactionName(`${method} ${route}`);
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/hono/index.ts"],"sourcesContent":["import { ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n captureException,\n debug,\n defineIntegration,\n getDefaultIsolationScope,\n getIsolationScope,\n httpRequestToRequestData,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} from '@sentry/core';\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { AttributeNames } from './constants';\nimport { HonoInstrumentation } from './instrumentation';\nimport type { Context, MiddlewareHandler, MiddlewareHandlerInterface, Next } from './types';\n\nconst INTEGRATION_NAME = 'Hono';\n\nfunction addHonoSpanAttributes(span: Span): void {\n const attributes = spanToJSON(span).data;\n const type = attributes[AttributeNames.HONO_TYPE];\n if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] || !type) {\n return;\n }\n\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.hono',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.hono`,\n });\n\n const name = attributes[AttributeNames.HONO_NAME];\n if (typeof name === 'string') {\n span.updateName(name);\n }\n\n if (getIsolationScope() === getDefaultIsolationScope()) {\n DEBUG_BUILD && debug.warn('Isolation scope is default isolation scope - skipping setting transactionName');\n return;\n }\n\n const route = attributes[ATTR_HTTP_ROUTE];\n const method = attributes[ATTR_HTTP_REQUEST_METHOD];\n if (typeof route === 'string' && typeof method === 'string') {\n getIsolationScope().setTransactionName(`${method} ${route}`);\n }\n}\n\nexport const instrumentHono = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new HonoInstrumentation({\n responseHook: span => {\n addHonoSpanAttributes(span);\n },\n }),\n);\n\nconst _honoIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentHono();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Hono](https://hono.dev/).\n *\n * If you also want to capture errors, you need to call `setupHonoErrorHandler(app)` after you set up your Hono server.\n *\n * For more information, see the [hono documentation](https://docs.sentry.io/platforms/javascript/guides/hono/).\n *\n * @deprecated Use the `@sentry/hono` package instead. The `sentry()` middleware from `@sentry/hono/node` handles\n * tracing and error capturing automatically without needing this integration or `setupHonoErrorHandler`.\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.honoIntegration()],\n * })\n * ```\n */\nexport const honoIntegration = defineIntegration(_honoIntegration);\n\ninterface HonoHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * @param error Captured Hono error\n */\n shouldHandleError: (context: Context) => boolean;\n}\n\nfunction honoRequestHandler(): MiddlewareHandler {\n return async function sentryRequestMiddleware(context: Context, next: Next): Promise<void> {\n const normalizedRequest = httpRequestToRequestData(context.req);\n getIsolationScope().setSDKProcessingMetadata({ normalizedRequest });\n await next();\n };\n}\n\nfunction defaultShouldHandleError(context: Context): boolean {\n const statusCode = context.res.status;\n return statusCode >= 500;\n}\n\nfunction honoErrorHandler(options?: Partial<HonoHandlerOptions>): MiddlewareHandler {\n return async function sentryErrorMiddleware(context: Context, next: Next): Promise<void> {\n await next();\n\n const shouldHandleError = options?.shouldHandleError || defaultShouldHandleError;\n if (shouldHandleError(context)) {\n (context.res as { sentry?: string }).sentry = captureException(context.error, {\n mechanism: {\n type: 'auto.middleware.hono',\n handled: false,\n },\n });\n }\n };\n}\n\n/**\n * Add a Hono error handler to capture errors to Sentry.\n *\n * @param app The Hono instances\n * @param options Configuration options for the handler\n *\n * @deprecated Use the `@sentry/hono` package instead. The `sentry()` middleware from `@sentry/hono/node` handles\n * error capturing automatically without needing this function or `honoIntegration`.\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const { Hono } = require(\"hono\");\n *\n * const app = new Hono();\n *\n * Sentry.setupHonoErrorHandler(app);\n *\n * // Add your routes, etc.\n * ```\n */\nexport function setupHonoErrorHandler(\n app: { use: MiddlewareHandlerInterface },\n options?: Partial<HonoHandlerOptions>,\n): void {\n app.use(honoRequestHandler());\n app.use(honoErrorHandler(options));\n ensureIsWrapped(app.use, 'hono');\n}\n"],"names":["spanToJSON","AttributeNames","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getIsolationScope","getDefaultIsolationScope","DEBUG_BUILD","debug","ATTR_HTTP_ROUTE","ATTR_HTTP_REQUEST_METHOD","generateInstrumentOnce","HonoInstrumentation","defineIntegration","httpRequestToRequestData","captureException","ensureIsWrapped"],"mappings":";;;;;;;;;AAmBA,MAAM,gBAAA,GAAmB,MAAA;AAEzB,SAAS,sBAAsB,IAAA,EAAkB;AAC/C,EAAA,MAAM,UAAA,GAAaA,eAAA,CAAW,IAAI,CAAA,CAAE,IAAA;AACpC,EAAA,MAAM,IAAA,GAAO,UAAA,CAAWC,wBAAA,CAAe,SAAS,CAAA;AAChD,EAAA,IAAI,UAAA,CAAWC,iCAA4B,CAAA,IAAK,CAAC,IAAA,EAAM;AACrD,IAAA;AAAA,EACF;AAEA,EA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AkB,IAAA,EAA2B;AACzF,IAAA,MAAM,iBAAA,GAAoBC,6BAAA,CAAyB,OAAA,CAAQ,GAAG,CAAA;AAC9D,IAAAT,sBAAA,EAAkB,CAAE,wBAAA,CAAyB,EAAE,iBAAA,EAAmB,CAAA;AAClE,IAAA,MAAM,IAAA,EAAK;AAAA,EACb,CAAA;AACF;AAEA,SAAS,yBAAyB,OAAA,EAA2B;AAC3D,EAAA,MAAM,UAAA,GAAa,QAAQ,GAAA,CAAI,MAAA;AAC/B,EAAA,OAAO,UAAA,IAAc,GAAA;AACvB;AAEA,SAAS,iBAAiB,OAAA,EAA0D;AAClF,EAAA,OAAO,eAAe,qBAAA,CAAsB,OAAA,EAAkB,IAAA,EAA2B;AACvF,IAAA,MAAM,IAAA,EAAK;AAEX,IAAA,MAAM,iBAAA,GAAoB,SAAS,iBAAA,IAAqB,wBAAA;AACxD,IAAA,IAAI,iBAAA,CAAkB,OAAO,CAAA,EAAG;AAC9B,MAAC,OAAA,CAAQ,GAAA,CAA4B,MAAA,GAASU,qBAAA,CAAiB,QAAQ,KAAA,EAAO;AAAA,QAC5E,SAAA,EAAW;AAAA,UACT,IAAA,EAAM,sBAAA;AAAA,UACN,OAAA,EAAS;AAAA;AACX,OACD,CAAA;AAAA,IACH;AAAA,EACF,CAAA;AACF;AAuBO,SAAS,qBAAA,CACd,KACA,OAAA,EACM;AACN,EAAA,GAAA,CAAI,GAAA,CAAI,oBAAoB,CAAA;AAC5B,EAAA,GAAA,CAAI,GAAA,CAAI,gBAAA,CAAiB,OAAO,CAAC,CAAA;AACjC,EAAAC,wBAAA,CAAgB,GAAA,CAAI,KAAK,MAAM,CAAA;AACjC;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/hono/index.ts"],"sourcesContent":["import { HTTP_REQUEST_METHOD, HTTP_ROUTE } from '@sentry/conventions/attributes';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n captureException,\n debug,\n defineIntegration,\n getDefaultIsolationScope,\n getIsolationScope,\n httpRequestToRequestData,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} from '@sentry/core';\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { AttributeNames } from './constants';\nimport { HonoInstrumentation } from './instrumentation';\nimport type { Context, MiddlewareHandler, MiddlewareHandlerInterface, Next } from './types';\n\nconst INTEGRATION_NAME = 'Hono' as const;\n\nfunction addHonoSpanAttributes(span: Span): void {\n const attributes = spanToJSON(span).data;\n const type = attributes[AttributeNames.HONO_TYPE];\n if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] || !type) {\n return;\n }\n\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.hono',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.hono`,\n });\n\n const name = attributes[AttributeNames.HONO_NAME];\n if (typeof name === 'string') {\n span.updateName(name);\n }\n\n if (getIsolationScope() === getDefaultIsolationScope()) {\n DEBUG_BUILD && debug.warn('Isolation scope is default isolation scope - skipping setting transactionName');\n return;\n }\n\n const route = attributes[HTTP_ROUTE];\n const method = attributes[HTTP_REQUEST_METHOD];\n if (typeof route === 'string' && typeof method === 'string') {\n getIsolationScope().setTransactionName(`${method} ${route}`);\n }\n}\n\nexport const instrumentHono = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new HonoInstrumentation({\n responseHook: span => {\n addHonoSpanAttributes(span);\n },\n }),\n);\n\nconst _honoIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentHono();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Hono](https://hono.dev/).\n *\n * If you also want to capture errors, you need to call `setupHonoErrorHandler(app)` after you set up your Hono server.\n *\n * For more information, see the [hono documentation](https://docs.sentry.io/platforms/javascript/guides/hono/).\n *\n * @deprecated Use the `@sentry/hono` package instead. The `sentry()` middleware from `@sentry/hono/node` handles\n * tracing and error capturing automatically without needing this integration or `setupHonoErrorHandler`.\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.honoIntegration()],\n * })\n * ```\n */\nexport const honoIntegration = defineIntegration(_honoIntegration);\n\ninterface HonoHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * @param error Captured Hono error\n */\n shouldHandleError: (context: Context) => boolean;\n}\n\nfunction honoRequestHandler(): MiddlewareHandler {\n return async function sentryRequestMiddleware(context: Context, next: Next): Promise<void> {\n const normalizedRequest = httpRequestToRequestData(context.req);\n getIsolationScope().setSDKProcessingMetadata({ normalizedRequest });\n await next();\n };\n}\n\nfunction defaultShouldHandleError(context: Context): boolean {\n const statusCode = context.res.status;\n return statusCode >= 500;\n}\n\nfunction honoErrorHandler(options?: Partial<HonoHandlerOptions>): MiddlewareHandler {\n return async function sentryErrorMiddleware(context: Context, next: Next): Promise<void> {\n await next();\n\n const shouldHandleError = options?.shouldHandleError || defaultShouldHandleError;\n if (shouldHandleError(context)) {\n (context.res as { sentry?: string }).sentry = captureException(context.error, {\n mechanism: {\n type: 'auto.middleware.hono',\n handled: false,\n },\n });\n }\n };\n}\n\n/**\n * Add a Hono error handler to capture errors to Sentry.\n *\n * @param app The Hono instances\n * @param options Configuration options for the handler\n *\n * @deprecated Use the `@sentry/hono` package instead. The `sentry()` middleware from `@sentry/hono/node` handles\n * error capturing automatically without needing this function or `honoIntegration`.\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const { Hono } = require(\"hono\");\n *\n * const app = new Hono();\n *\n * Sentry.setupHonoErrorHandler(app);\n *\n * // Add your routes, etc.\n * ```\n */\nexport function setupHonoErrorHandler(\n app: { use: MiddlewareHandlerInterface },\n options?: Partial<HonoHandlerOptions>,\n): void {\n app.use(honoRequestHandler());\n app.use(honoErrorHandler(options));\n ensureIsWrapped(app.use, 'hono');\n}\n"],"names":["attributes","spanToJSON","AttributeNames","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getIsolationScope","getDefaultIsolationScope","DEBUG_BUILD","debug","HTTP_ROUTE","HTTP_REQUEST_METHOD","generateInstrumentOnce","HonoInstrumentation","defineIntegration","httpRequestToRequestData","captureException","ensureIsWrapped"],"mappings":";;;;;;;;;AAmBA,MAAM,gBAAA,GAAmB,MAAA;AAEzB,SAAS,sBAAsB,IAAA,EAAkB;AAC/C,EAAA,MAAMA,YAAA,GAAaC,eAAA,CAAW,IAAI,CAAA,CAAE,IAAA;AACpC,EAAA,MAAM,IAAA,GAAOD,YAAA,CAAWE,wBAAA,CAAe,SAAS,CAAA;AAChD,EAAA,IAAIF,YAAA,CAAWG,iCAA4B,CAAA,IAAK,CAAC,IAAA,EAAM;AACrD,IAAA;AAAA,EACF;AAEA,EAAA,IAAA,CAAK,aAAA,CAAc;AAAA,IACjB,CAACC,qCAAgC,GAAG,qBAAA;AAAA,IACpC,CAACD,iCAA4B,GAAG,CAAA,EAAG,IAAI,CAAA,KAAA;AAAA,GACxC,CAAA;AAED,EAAA,MAAM,IAAA,GAAOH,YAAA,CAAWE,wBAAA,CAAe,SAAS,CAAA;AAChD,EAAA,IAAI,OAAO,SAAS,QAAA,EAAU;AAC5B,IAAA,IAAA,CAAK,WAAW,IAAI,CAAA;AAAA,EACtB;AAEA,EAAA,IAAIG,sBAAA,EAAkB,KAAMC,6BAAA,EAAyB,EAAG;AACtD,IAAAC,sBAAA,IAAeC,UAAA,CAAM,KAAK,+EAA+E,CAAA;AACzG,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,KAAA,GAAQR,aAAWS,qBAAU,CAAA;AACnC,EAAA,MAAM,MAAA,GAAST,aAAWU,8BAAmB,CAAA;AAC7C,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,OAAO,WAA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GAAA,CAA4B,MAAA,GAASU,qBAAA,CAAiB,QAAQ,KAAA,EAAO;AAAA,QAC5E,SAAA,EAAW;AAAA,UACT,IAAA,EAAM,sBAAA;AAAA,UACN,OAAA,EAAS;AAAA;AACX,OACD,CAAA;AAAA,IACH;AAAA,EACF,CAAA;AACF;AAuBO,SAAS,qBAAA,CACd,KACA,OAAA,EACM;AACN,EAAA,GAAA,CAAI,GAAA,CAAI,oBAAoB,CAAA;AAC5B,EAAA,GAAA,CAAI,GAAA,CAAI,gBAAA,CAAiB,OAAO,CAAC,CAAA;AACjC,EAAAC,wBAAA,CAAgB,GAAA,CAAI,KAAK,MAAM,CAAA;AACjC;;;;;;"}
@@ -68,7 +68,6 @@ function getOpenTelemetryInstrumentationToPreload() {
68
68
  http.instrumentSentryHttp,
69
69
  express.instrumentExpress,
70
70
  index.instrumentConnect,
71
- index$1.instrumentFastify,
72
71
  index$1.instrumentFastifyV3,
73
72
  index$2.instrumentHapi,
74
73
  index$3.instrumentHono,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/integrations/tracing/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { instrumentSentryHttp } from '../http';\nimport { amqplibIntegration, instrumentAmqplib } from './amqplib';\nimport { anthropicAIIntegration, instrumentAnthropicAi } from './anthropic-ai';\nimport { connectIntegration, instrumentConnect } from './connect';\nimport { expressIntegration, instrumentExpress } from './express';\nimport { fastifyIntegration, instrumentFastify, instrumentFastifyV3 } from './fastify';\nimport { firebaseIntegration, instrumentFirebase } from './firebase';\nimport { genericPoolIntegration, instrumentGenericPool } from './genericPool';\nimport { googleGenAIIntegration, instrumentGoogleGenAI } from './google-genai';\nimport { graphqlIntegration, instrumentGraphql } from './graphql';\nimport { hapiIntegration, instrumentHapi } from './hapi';\nimport { honoIntegration, instrumentHono } from './hono';\nimport { instrumentKafka, kafkaIntegration } from './kafka';\nimport { instrumentKoa, koaIntegration } from './koa';\nimport { instrumentLangChain, langChainIntegration } from './langchain';\nimport { instrumentLangGraph, langGraphIntegration } from './langgraph';\nimport { instrumentLruMemoizer, lruMemoizerIntegration } from './lrumemoizer';\nimport { instrumentMongo, mongoIntegration } from './mongo';\nimport { instrumentMongoose, mongooseIntegration } from './mongoose';\nimport { instrumentMysql, mysqlIntegration } from './mysql';\nimport { instrumentMysql2, mysql2Integration } from './mysql2';\nimport { instrumentOpenAi, openAIIntegration } from './openai';\nimport { instrumentPostgres, postgresIntegration } from './postgres';\nimport { instrumentPostgresJs, postgresJsIntegration } from './postgresjs';\nimport { prismaIntegration } from './prisma';\nimport { instrumentRedis, redisIntegration } from './redis';\nimport { instrumentTedious, tediousIntegration } from './tedious';\nimport { instrumentVercelAi, vercelAIIntegration } from './vercelai';\n\n/**\n * With OTEL, all performance integrations will be added, as OTEL only initializes them when the patched package is actually required.\n */\nexport function getAutoPerformanceIntegrations(): Integration[] {\n return [\n expressIntegration(),\n fastifyIntegration(),\n graphqlIntegration(),\n // eslint-disable-next-line typescript/no-deprecated\n honoIntegration(),\n mongoIntegration(),\n mongooseIntegration(),\n mysqlIntegration(),\n mysql2Integration(),\n redisIntegration(),\n postgresIntegration(),\n prismaIntegration(),\n hapiIntegration(),\n koaIntegration(),\n connectIntegration(),\n tediousIntegration(),\n genericPoolIntegration(),\n kafkaIntegration(),\n amqplibIntegration(),\n lruMemoizerIntegration(),\n // AI providers\n // LangChain must come first to disable AI provider integrations before they instrument\n langChainIntegration(),\n langGraphIntegration(),\n vercelAIIntegration(),\n openAIIntegration(),\n anthropicAIIntegration(),\n googleGenAIIntegration(),\n postgresJsIntegration(),\n firebaseIntegration(),\n ];\n}\n\n/**\n * Get a list of methods to instrument OTEL, when preload instrumentation.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getOpenTelemetryInstrumentationToPreload(): (((options?: any) => void) & { id: string })[] {\n return [\n instrumentSentryHttp,\n instrumentExpress,\n instrumentConnect,\n instrumentFastify,\n instrumentFastifyV3,\n instrumentHapi,\n instrumentHono,\n instrumentKafka,\n instrumentKoa,\n instrumentLruMemoizer,\n instrumentMongo,\n instrumentMongoose,\n instrumentMysql,\n instrumentMysql2,\n instrumentPostgres,\n instrumentHapi,\n instrumentGraphql,\n instrumentRedis,\n instrumentTedious,\n instrumentGenericPool,\n instrumentAmqplib,\n instrumentLangChain,\n instrumentVercelAi,\n instrumentOpenAi,\n instrumentPostgresJs,\n instrumentFirebase,\n instrumentAnthropicAi,\n instrumentGoogleGenAI,\n instrumentLangGraph,\n ];\n}\n"],"names":["expressIntegration","fastifyIntegration","graphqlIntegration","honoIntegration","mongoIntegration","mongooseIntegration","mysqlIntegration","mysql2Integration","redisIntegration","postgresIntegration","prismaIntegration","hapiIntegration","koaIntegration","connectIntegration","tediousIntegration","genericPoolIntegration","kafkaIntegration","amqplibIntegration","lruMemoizerIntegration","langChainIntegration","langGraphIntegration","vercelAIIntegration","openAIIntegration","anthropicAIIntegration","googleGenAIIntegration","postgresJsIntegration","firebaseIntegration","instrumentSentryHttp","instrumentExpress","instrumentConnect","instrumentFastify","instrumentFastifyV3","instrumentHapi","instrumentHono","instrumentKafka","instrumentKoa","instrumentLruMemoizer","instrumentMongo","instrumentMongoose","instrumentMysql","instrumentMysql2","instrumentPostgres","instrumentGraphql","instrumentRedis","instrumentTedious","instrumentGenericPool","instrumentAmqplib","instrumentLangChain","instrumentVercelAi","instrumentOpenAi","instrumentPostgresJs","instrumentFirebase","instrumentAnthropicAi","instrumentGoogleGenAI","instrumentLangGraph"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,SAAS,8BAAA,GAAgD;AAC9D,EAAA,OAAO;AAAA,IACLA,0BAAA,EAAmB;AAAA,IACnBC,0BAAA,EAAmB;AAAA,IACnBC,0BAAA,EAAmB;AAAA;AAAA,IAEnBC,uBAAA,EAAgB;AAAA,IAChBC,wBAAA,EAAiB;AAAA,IACjBC,2BAAA,EAAoB;AAAA,IACpBC,wBAAA,EAAiB;AAAA,IACjBC,yBAAA,EAAkB;AAAA,IAClBC,wBAAA,EAAiB;AAAA,IACjBC,2BAAA,EAAoB;AAAA,IACpBC,yBAAA,EAAkB;AAAA,IAClBC,uBAAA,EAAgB;AAAA,IAChBC,sBAAA,EAAe;AAAA,IACfC,wBAAA,EAAmB;AAAA,IACnBC,0BAAA,EAAmB;AAAA,IACnBC,8BAAA,EAAuB;AAAA,IACvBC,wBAAA,EAAiB;AAAA,IACjBC,0BAAA,EAAmB;AAAA,IACnBC,8BAAA,EAAuB;AAAA;AAAA;AAAA,IAGvBC,4BAAA,EAAqB;AAAA,IACrBC,4BAAA,EAAqB;AAAA,IACrBC,2BAAA,EAAoB;AAAA,IACpBC,yBAAA,EAAkB;AAAA,IAClBC,8BAAA,EAAuB;AAAA,IACvBC,8BAAA,EAAuB;AAAA,IACvBC,gCAAA,EAAsB;AAAA,IACtBC,4BAAA;AAAoB,GACtB;AACF;AAMO,SAAS,wCAAA,GAA2F;AACzG,EAAA,OAAO;AAAA,IACLC,yBAAA;AAAA,IACAC,yBAAA;AAAA,IACAC,uBAAA;AAAA,IACAC,yBAAA;AAAA,IACAC,2BAAA;AAAA,IACAC,sBAAA;AAAA,IACAC,sBAAA;AAAA,IACAC,uBAAA;AAAA,IACAC,qBAAA;AAAA,IACAC,6BAAA;AAAA,IACAC,uBAAA;AAAA,IACAC,0BAAA;AAAA,IACAC,uBAAA;AAAA,IACAC,wBAAA;AAAA,IACAC,0BAAA;AAAA,IACAT,sBAAA;AAAA,IACAU,yBAAA;AAAA,IACAC,uBAAA;AAAA,IACAC,yBAAA;AAAA,IACAC,6BAAA;AAAA,IACAC,yBAAA;AAAA,IACAC,2BAAA;AAAA,IACAC,0BAAA;AAAA,IACAC,wBAAA;AAAA,IACAC,+BAAA;AAAA,IACAC,2BAAA;AAAA,IACAC,6BAAA;AAAA,IACAC,6BAAA;AAAA,IACAC;AAAA,GACF;AACF;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/integrations/tracing/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { instrumentSentryHttp } from '../http';\nimport { amqplibIntegration, instrumentAmqplib } from './amqplib';\nimport { anthropicAIIntegration, instrumentAnthropicAi } from './anthropic-ai';\nimport { connectIntegration, instrumentConnect } from './connect';\nimport { expressIntegration, instrumentExpress } from './express';\nimport { fastifyIntegration, instrumentFastifyV3 } from './fastify';\nimport { firebaseIntegration, instrumentFirebase } from './firebase';\nimport { genericPoolIntegration, instrumentGenericPool } from './genericPool';\nimport { googleGenAIIntegration, instrumentGoogleGenAI } from './google-genai';\nimport { graphqlIntegration, instrumentGraphql } from './graphql';\nimport { hapiIntegration, instrumentHapi } from './hapi';\nimport { honoIntegration, instrumentHono } from './hono';\nimport { instrumentKafka, kafkaIntegration } from './kafka';\nimport { instrumentKoa, koaIntegration } from './koa';\nimport { instrumentLangChain, langChainIntegration } from './langchain';\nimport { instrumentLangGraph, langGraphIntegration } from './langgraph';\nimport { instrumentLruMemoizer, lruMemoizerIntegration } from './lrumemoizer';\nimport { instrumentMongo, mongoIntegration } from './mongo';\nimport { instrumentMongoose, mongooseIntegration } from './mongoose';\nimport { instrumentMysql, mysqlIntegration } from './mysql';\nimport { instrumentMysql2, mysql2Integration } from './mysql2';\nimport { instrumentOpenAi, openAIIntegration } from './openai';\nimport { instrumentPostgres, postgresIntegration } from './postgres';\nimport { instrumentPostgresJs, postgresJsIntegration } from './postgresjs';\nimport { prismaIntegration } from './prisma';\nimport { instrumentRedis, redisIntegration } from './redis';\nimport { instrumentTedious, tediousIntegration } from './tedious';\nimport { instrumentVercelAi, vercelAIIntegration } from './vercelai';\n\n/**\n * With OTEL, all performance integrations will be added, as OTEL only initializes them when the patched package is actually required.\n */\nexport function getAutoPerformanceIntegrations(): Integration[] {\n return [\n expressIntegration(),\n fastifyIntegration(),\n graphqlIntegration(),\n // eslint-disable-next-line typescript/no-deprecated\n honoIntegration(),\n mongoIntegration(),\n mongooseIntegration(),\n mysqlIntegration(),\n mysql2Integration(),\n redisIntegration(),\n postgresIntegration(),\n prismaIntegration(),\n hapiIntegration(),\n koaIntegration(),\n connectIntegration(),\n tediousIntegration(),\n genericPoolIntegration(),\n kafkaIntegration(),\n amqplibIntegration(),\n lruMemoizerIntegration(),\n // AI providers\n // LangChain must come first to disable AI provider integrations before they instrument\n langChainIntegration(),\n langGraphIntegration(),\n vercelAIIntegration(),\n openAIIntegration(),\n anthropicAIIntegration(),\n googleGenAIIntegration(),\n postgresJsIntegration(),\n firebaseIntegration(),\n ];\n}\n\n/**\n * Get a list of methods to instrument OTEL, when preload instrumentation.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getOpenTelemetryInstrumentationToPreload(): (((options?: any) => void) & { id: string })[] {\n return [\n instrumentSentryHttp,\n instrumentExpress,\n instrumentConnect,\n instrumentFastifyV3,\n instrumentHapi,\n instrumentHono,\n instrumentKafka,\n instrumentKoa,\n instrumentLruMemoizer,\n instrumentMongo,\n instrumentMongoose,\n instrumentMysql,\n instrumentMysql2,\n instrumentPostgres,\n instrumentHapi,\n instrumentGraphql,\n instrumentRedis,\n instrumentTedious,\n instrumentGenericPool,\n instrumentAmqplib,\n instrumentLangChain,\n instrumentVercelAi,\n instrumentOpenAi,\n instrumentPostgresJs,\n instrumentFirebase,\n instrumentAnthropicAi,\n instrumentGoogleGenAI,\n instrumentLangGraph,\n ];\n}\n"],"names":["expressIntegration","fastifyIntegration","graphqlIntegration","honoIntegration","mongoIntegration","mongooseIntegration","mysqlIntegration","mysql2Integration","redisIntegration","postgresIntegration","prismaIntegration","hapiIntegration","koaIntegration","connectIntegration","tediousIntegration","genericPoolIntegration","kafkaIntegration","amqplibIntegration","lruMemoizerIntegration","langChainIntegration","langGraphIntegration","vercelAIIntegration","openAIIntegration","anthropicAIIntegration","googleGenAIIntegration","postgresJsIntegration","firebaseIntegration","instrumentSentryHttp","instrumentExpress","instrumentConnect","instrumentFastifyV3","instrumentHapi","instrumentHono","instrumentKafka","instrumentKoa","instrumentLruMemoizer","instrumentMongo","instrumentMongoose","instrumentMysql","instrumentMysql2","instrumentPostgres","instrumentGraphql","instrumentRedis","instrumentTedious","instrumentGenericPool","instrumentAmqplib","instrumentLangChain","instrumentVercelAi","instrumentOpenAi","instrumentPostgresJs","instrumentFirebase","instrumentAnthropicAi","instrumentGoogleGenAI","instrumentLangGraph"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,SAAS,8BAAA,GAAgD;AAC9D,EAAA,OAAO;AAAA,IACLA,0BAAA,EAAmB;AAAA,IACnBC,0BAAA,EAAmB;AAAA,IACnBC,0BAAA,EAAmB;AAAA;AAAA,IAEnBC,uBAAA,EAAgB;AAAA,IAChBC,wBAAA,EAAiB;AAAA,IACjBC,2BAAA,EAAoB;AAAA,IACpBC,wBAAA,EAAiB;AAAA,IACjBC,yBAAA,EAAkB;AAAA,IAClBC,wBAAA,EAAiB;AAAA,IACjBC,2BAAA,EAAoB;AAAA,IACpBC,yBAAA,EAAkB;AAAA,IAClBC,uBAAA,EAAgB;AAAA,IAChBC,sBAAA,EAAe;AAAA,IACfC,wBAAA,EAAmB;AAAA,IACnBC,0BAAA,EAAmB;AAAA,IACnBC,8BAAA,EAAuB;AAAA,IACvBC,wBAAA,EAAiB;AAAA,IACjBC,0BAAA,EAAmB;AAAA,IACnBC,8BAAA,EAAuB;AAAA;AAAA;AAAA,IAGvBC,4BAAA,EAAqB;AAAA,IACrBC,4BAAA,EAAqB;AAAA,IACrBC,2BAAA,EAAoB;AAAA,IACpBC,yBAAA,EAAkB;AAAA,IAClBC,8BAAA,EAAuB;AAAA,IACvBC,8BAAA,EAAuB;AAAA,IACvBC,gCAAA,EAAsB;AAAA,IACtBC,4BAAA;AAAoB,GACtB;AACF;AAMO,SAAS,wCAAA,GAA2F;AACzG,EAAA,OAAO;AAAA,IACLC,yBAAA;AAAA,IACAC,yBAAA;AAAA,IACAC,uBAAA;AAAA,IACAC,2BAAA;AAAA,IACAC,sBAAA;AAAA,IACAC,sBAAA;AAAA,IACAC,uBAAA;AAAA,IACAC,qBAAA;AAAA,IACAC,6BAAA;AAAA,IACAC,uBAAA;AAAA,IACAC,0BAAA;AAAA,IACAC,uBAAA;AAAA,IACAC,wBAAA;AAAA,IACAC,0BAAA;AAAA,IACAT,sBAAA;AAAA,IACAU,yBAAA;AAAA,IACAC,uBAAA;AAAA,IACAC,yBAAA;AAAA,IACAC,6BAAA;AAAA,IACAC,yBAAA;AAAA,IACAC,2BAAA;AAAA,IACAC,0BAAA;AAAA,IACAC,wBAAA;AAAA,IACAC,+BAAA;AAAA,IACAC,2BAAA;AAAA,IACAC,6BAAA;AAAA,IACAC,6BAAA;AAAA,IACAC;AAAA,GACF;AACF;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/kafka/index.ts"],"sourcesContent":["import { KafkaJsInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Kafka';\n\nexport const instrumentKafka = generateInstrumentOnce(INTEGRATION_NAME, () => new KafkaJsInstrumentation());\n\nconst _kafkaIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKafka();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [kafkajs](https://www.npmjs.com/package/kafkajs) library.\n *\n * For more information, see the [`kafkaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/kafka/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.kafkaIntegration()],\n * });\n */\nexport const kafkaIntegration = defineIntegration(_kafkaIntegration);\n"],"names":["generateInstrumentOnce","KafkaJsInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAA;AAElB,MAAM,kBAAkBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,wCAAwB;AAE1G,MAAM,qBAAqB,MAAM;AAC/B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,eAAA,EAAgB;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAeO,MAAM,gBAAA,GAAmBC,uBAAkB,iBAAiB;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/kafka/index.ts"],"sourcesContent":["import { KafkaJsInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Kafka' as const;\n\nexport const instrumentKafka = generateInstrumentOnce(INTEGRATION_NAME, () => new KafkaJsInstrumentation());\n\nconst _kafkaIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKafka();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [kafkajs](https://www.npmjs.com/package/kafkajs) library.\n *\n * For more information, see the [`kafkaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/kafka/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.kafkaIntegration()],\n * });\n */\nexport const kafkaIntegration = defineIntegration(_kafkaIntegration);\n"],"names":["generateInstrumentOnce","KafkaJsInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAA;AAElB,MAAM,kBAAkBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,wCAAwB;AAE1G,MAAM,qBAAqB,MAAM;AAC/B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,eAAA,EAAgB;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAeO,MAAM,gBAAA,GAAmBC,uBAAkB,iBAAiB;;;;;"}
@@ -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 semconv = require('./semconv.js');
6
7
  const utils = require('./utils.js');
@@ -120,7 +121,7 @@ class KafkaJsInstrumentation extends instrumentation.InstrumentationBase {
120
121
  message: void 0,
121
122
  operationType: semconv.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,
122
123
  attributes: {
123
- [semconv.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,
124
+ [attributes.MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,
124
125
  [semconv.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
125
126
  }
126
127
  })
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\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-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Some types vendored from kafkajs with simplifications\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n * - Cross-broker trace propagation uses Sentry's `getTraceData`/`continueTrace` instead of the OTel\n * propagator, so the vendored `bufferTextMapGetter` propagator is gone\n * - Dropped the OTel metrics (no MeterProvider is wired up) and, with them, the `network.request`\n * event listeners they relied on; origin is folded into span creation instead of `index.ts` hooks\n */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport type { Span } from '@sentry/core';\nimport {\n continueTrace,\n SDK_VERSION,\n SPAN_STATUS_ERROR,\n SPAN_STATUS_OK,\n startInactiveSpan,\n startNewTrace,\n withActiveSpan,\n} from '@sentry/core';\nimport type {\n Consumer,\n ConsumerRunConfig,\n EachBatchHandler,\n EachMessageHandler,\n Kafka,\n KafkaMessage,\n Producer,\n RecordMetadata,\n Transaction,\n} from './kafkajs-types';\nimport {\n ATTR_MESSAGING_BATCH_MESSAGE_COUNT,\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n} from './semconv';\nimport {\n endSpansOnPromise,\n getHeaderAsString,\n getLinksFromHeaders,\n startConsumerSpan,\n startProducerSpan,\n} from './utils';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-kafkajs';\n\nexport class KafkaJsInstrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init(): InstrumentationNodeModuleDefinition {\n const unpatch = (moduleExports: any): void => {\n if (isWrapped(moduleExports?.Kafka?.prototype.producer)) {\n this._unwrap(moduleExports.Kafka.prototype, 'producer');\n }\n if (isWrapped(moduleExports?.Kafka?.prototype.consumer)) {\n this._unwrap(moduleExports.Kafka.prototype, 'consumer');\n }\n };\n\n const module = new InstrumentationNodeModuleDefinition(\n 'kafkajs',\n ['>=0.3.0 <3'],\n (moduleExports: any) => {\n unpatch(moduleExports);\n this._wrap(moduleExports?.Kafka?.prototype, 'producer', this._getProducerPatch());\n this._wrap(moduleExports?.Kafka?.prototype, 'consumer', this._getConsumerPatch());\n\n return moduleExports;\n },\n unpatch,\n );\n return module;\n }\n\n private _getConsumerPatch() {\n const instrumentation = this;\n return (original: Kafka['consumer']) => {\n return function consumer(this: Kafka, ...args: Parameters<Kafka['consumer']>) {\n const newConsumer: Consumer = original.apply(this, args);\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newConsumer.run)) {\n instrumentation._unwrap(newConsumer, 'run');\n }\n\n instrumentation._wrap(newConsumer, 'run', instrumentation._getConsumerRunPatch());\n\n return newConsumer;\n };\n };\n }\n\n private _getProducerPatch() {\n const instrumentation = this;\n return (original: Kafka['producer']) => {\n return function consumer(this: Kafka, ...args: Parameters<Kafka['producer']>) {\n const newProducer: Producer = original.apply(this, args);\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.sendBatch)) {\n instrumentation._unwrap(newProducer, 'sendBatch');\n }\n instrumentation._wrap(newProducer, 'sendBatch', instrumentation._getSendBatchPatch());\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.send)) {\n instrumentation._unwrap(newProducer, 'send');\n }\n instrumentation._wrap(newProducer, 'send', instrumentation._getSendPatch());\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.transaction)) {\n instrumentation._unwrap(newProducer, 'transaction');\n }\n instrumentation._wrap(newProducer, 'transaction', instrumentation._getProducerTransactionPatch());\n\n return newProducer;\n };\n };\n }\n\n private _getConsumerRunPatch() {\n const instrumentation = this;\n return (original: Consumer['run']) => {\n return function run(this: Consumer, ...args: Parameters<Consumer['run']>): ReturnType<Consumer['run']> {\n const config = args[0];\n if (config?.eachMessage) {\n if (isWrapped(config.eachMessage)) {\n instrumentation._unwrap(config, 'eachMessage');\n }\n instrumentation._wrap(config, 'eachMessage', instrumentation._getConsumerEachMessagePatch());\n }\n if (config?.eachBatch) {\n if (isWrapped(config.eachBatch)) {\n instrumentation._unwrap(config, 'eachBatch');\n }\n instrumentation._wrap(config, 'eachBatch', instrumentation._getConsumerEachBatchPatch());\n }\n return original.call(this, config);\n };\n };\n }\n\n private _getConsumerEachMessagePatch() {\n return (original: ConsumerRunConfig['eachMessage']) => {\n return function eachMessage(this: unknown, ...args: Parameters<EachMessageHandler>): Promise<void> {\n const payload = args[0];\n const sentryTrace = getHeaderAsString(payload.message.headers, 'sentry-trace');\n const baggage = getHeaderAsString(payload.message.headers, 'baggage');\n\n // Continue the producer's trace so the consumer span is parented to the message's producer.\n return continueTrace({ sentryTrace, baggage }, () => {\n const span = startConsumerSpan({\n topic: payload.topic,\n message: payload.message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n },\n });\n\n const eachMessagePromise = withActiveSpan(span, () => {\n return original!.apply(this, args);\n });\n return endSpansOnPromise([span], eachMessagePromise);\n });\n };\n };\n }\n\n private _getConsumerEachBatchPatch() {\n return (original: ConsumerRunConfig['eachBatch']) => {\n return function eachBatch(this: unknown, ...args: Parameters<EachBatchHandler>): Promise<void> {\n const payload = args[0];\n // https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#topic-with-multiple-consumers\n // A batch pull aggregates messages from many producers, so the receiving span is a fresh root\n // trace and each processed message links back to its own producer span.\n const receivingSpan = startNewTrace(() =>\n startConsumerSpan({\n topic: payload.batch.topic,\n message: undefined,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n attributes: {\n [ATTR_MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n\n return withActiveSpan(receivingSpan, () => {\n const spans: Span[] = [receivingSpan];\n payload.batch.messages.forEach((message: KafkaMessage) => {\n spans.push(\n startConsumerSpan({\n topic: payload.batch.topic,\n message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n links: getLinksFromHeaders(message.headers),\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n });\n const batchMessagePromise: Promise<void> = original!.apply(this, args);\n return endSpansOnPromise(spans, batchMessagePromise);\n });\n };\n };\n }\n\n private _getProducerTransactionPatch() {\n const instrumentation = this;\n return (original: Producer['transaction']) => {\n return function transaction(\n this: Producer,\n ...args: Parameters<Producer['transaction']>\n ): ReturnType<Producer['transaction']> {\n const transactionSpan = startInactiveSpan({ name: 'transaction' });\n\n const transactionPromise = original.apply(this, args);\n\n transactionPromise\n .then((transaction: Transaction) => {\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalSend = transaction.send;\n transaction.send = function send(this: Transaction, ...args) {\n return withActiveSpan(transactionSpan, () => {\n const patched = instrumentation._getSendPatch()(originalSend);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n throw err;\n });\n });\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalSendBatch = transaction.sendBatch;\n transaction.sendBatch = function sendBatch(this: Transaction, ...args) {\n return withActiveSpan(transactionSpan, () => {\n const patched = instrumentation._getSendBatchPatch()(originalSendBatch);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n throw err;\n });\n });\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalCommit = transaction.commit;\n transaction.commit = function commit(this: Transaction, ...args) {\n const originCommitPromise = originalCommit.apply(this, args).then(() => {\n transactionSpan.setStatus({ code: SPAN_STATUS_OK });\n });\n return endSpansOnPromise([transactionSpan], originCommitPromise);\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalAbort = transaction.abort;\n transaction.abort = function abort(this: Transaction, ...args) {\n const originAbortPromise = originalAbort.apply(this, args);\n return endSpansOnPromise([transactionSpan], originAbortPromise);\n };\n })\n .catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n transactionSpan.end();\n });\n\n return transactionPromise;\n };\n };\n }\n\n private _getSendBatchPatch() {\n return (original: Producer['sendBatch'] | Transaction['sendBatch']) => {\n return function sendBatch(\n this: Producer | Transaction,\n ...args: Parameters<Producer['sendBatch']>\n ): ReturnType<Producer['sendBatch']> {\n const batch = args[0];\n const messages = batch.topicMessages || [];\n\n const spans: Span[] = [];\n\n messages.forEach((topicMessage: any) => {\n topicMessage.messages.forEach((message: any) => {\n spans.push(startProducerSpan(topicMessage.topic, message));\n });\n });\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return endSpansOnPromise(spans, origSendResult);\n };\n };\n }\n\n private _getSendPatch() {\n return (original: Producer['send'] | Transaction['send']) => {\n return function send(\n this: Producer | Transaction,\n ...args: Parameters<Producer['send']>\n ): ReturnType<Producer['send']> {\n const record = args[0];\n const spans: Span[] = record.messages.map((message: any) => {\n return startProducerSpan(record.topic, message);\n });\n\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return endSpansOnPromise(spans, origSendResult);\n };\n };\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","isWrapped","InstrumentationNodeModuleDefinition","instrumentation","getHeaderAsString","continueTrace","startConsumerSpan","MESSAGING_OPERATION_TYPE_VALUE_PROCESS","ATTR_MESSAGING_DESTINATION_PARTITION_ID","withActiveSpan","endSpansOnPromise","startNewTrace","MESSAGING_OPERATION_TYPE_VALUE_RECEIVE","ATTR_MESSAGING_BATCH_MESSAGE_COUNT","getLinksFromHeaders","startInactiveSpan","transaction","args","SPAN_STATUS_ERROR","SPAN_STATUS_OK","startProducerSpan"],"mappings":";;;;;;;AAoDA,MAAM,YAAA,GAAe,iCAAA;AAEd,MAAM,+BAA+BA,mCAAA,CAA2C;AAAA,EAC9E,WAAA,CAAY,MAAA,GAAgC,EAAC,EAAG;AACrD,IAAA,KAAA,CAAM,YAAA,EAAcC,kBAAa,MAAM,CAAA;AAAA,EACzC;AAAA,EAEU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,CAAkB,OAAO,cAAc,CAAA;AAAA,MAChD,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AAAA,EAEQ,aAAA,GAAgB;AACtB,IAAA,OAAO,CAAC,QAAA,KAAqD;AAC3D,MAAA,OAAO,SAAS,QAEX,IAAA,EAC2B;AAC9B,QAAA,MAAM,MAAA,GAAS,KAAK,CAAC,CAAA;AACrB,QAAA,MAAM,KAAA,GAAgB,MAAA,CAAO,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,KAAiB;AAC1D,UAAA,OAAOU,uBAAA,CAAkB,MAAA,CAAO,KAAA,EAAO,OAAO,CAAA;AAAA,QAChD,CAAC,CAAA;AAED,QAAA,MAAM,cAAA,GAA4C,QAAA,CAAS,KAAA,CAAM,IAAA,EAAM,IAAI,CAAA;AAC3E,QAAA,OAAOV,uBAAA,CAAkB,OAAO,cAAc,CAAA;AAAA,MAChD,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\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-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Some types vendored from kafkajs with simplifications\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n * - Cross-broker trace propagation uses Sentry's `getTraceData`/`continueTrace` instead of the OTel\n * propagator, so the vendored `bufferTextMapGetter` propagator is gone\n * - Dropped the OTel metrics (no MeterProvider is wired up) and, with them, the `network.request`\n * event listeners they relied on; origin is folded into span creation instead of `index.ts` hooks\n */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport { MESSAGING_BATCH_MESSAGE_COUNT } from '@sentry/conventions/attributes';\nimport type { Span } from '@sentry/core';\nimport {\n continueTrace,\n SDK_VERSION,\n SPAN_STATUS_ERROR,\n SPAN_STATUS_OK,\n startInactiveSpan,\n startNewTrace,\n withActiveSpan,\n} from '@sentry/core';\nimport type {\n Consumer,\n ConsumerRunConfig,\n EachBatchHandler,\n EachMessageHandler,\n Kafka,\n KafkaMessage,\n Producer,\n RecordMetadata,\n Transaction,\n} from './kafkajs-types';\nimport {\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n} from './semconv';\nimport {\n endSpansOnPromise,\n getHeaderAsString,\n getLinksFromHeaders,\n startConsumerSpan,\n startProducerSpan,\n} from './utils';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-kafkajs';\n\nexport class KafkaJsInstrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init(): InstrumentationNodeModuleDefinition {\n const unpatch = (moduleExports: any): void => {\n if (isWrapped(moduleExports?.Kafka?.prototype.producer)) {\n this._unwrap(moduleExports.Kafka.prototype, 'producer');\n }\n if (isWrapped(moduleExports?.Kafka?.prototype.consumer)) {\n this._unwrap(moduleExports.Kafka.prototype, 'consumer');\n }\n };\n\n const module = new InstrumentationNodeModuleDefinition(\n 'kafkajs',\n ['>=0.3.0 <3'],\n (moduleExports: any) => {\n unpatch(moduleExports);\n this._wrap(moduleExports?.Kafka?.prototype, 'producer', this._getProducerPatch());\n this._wrap(moduleExports?.Kafka?.prototype, 'consumer', this._getConsumerPatch());\n\n return moduleExports;\n },\n unpatch,\n );\n return module;\n }\n\n private _getConsumerPatch() {\n const instrumentation = this;\n return (original: Kafka['consumer']) => {\n return function consumer(this: Kafka, ...args: Parameters<Kafka['consumer']>) {\n const newConsumer: Consumer = original.apply(this, args);\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newConsumer.run)) {\n instrumentation._unwrap(newConsumer, 'run');\n }\n\n instrumentation._wrap(newConsumer, 'run', instrumentation._getConsumerRunPatch());\n\n return newConsumer;\n };\n };\n }\n\n private _getProducerPatch() {\n const instrumentation = this;\n return (original: Kafka['producer']) => {\n return function consumer(this: Kafka, ...args: Parameters<Kafka['producer']>) {\n const newProducer: Producer = original.apply(this, args);\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.sendBatch)) {\n instrumentation._unwrap(newProducer, 'sendBatch');\n }\n instrumentation._wrap(newProducer, 'sendBatch', instrumentation._getSendBatchPatch());\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.send)) {\n instrumentation._unwrap(newProducer, 'send');\n }\n instrumentation._wrap(newProducer, 'send', instrumentation._getSendPatch());\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.transaction)) {\n instrumentation._unwrap(newProducer, 'transaction');\n }\n instrumentation._wrap(newProducer, 'transaction', instrumentation._getProducerTransactionPatch());\n\n return newProducer;\n };\n };\n }\n\n private _getConsumerRunPatch() {\n const instrumentation = this;\n return (original: Consumer['run']) => {\n return function run(this: Consumer, ...args: Parameters<Consumer['run']>): ReturnType<Consumer['run']> {\n const config = args[0];\n if (config?.eachMessage) {\n if (isWrapped(config.eachMessage)) {\n instrumentation._unwrap(config, 'eachMessage');\n }\n instrumentation._wrap(config, 'eachMessage', instrumentation._getConsumerEachMessagePatch());\n }\n if (config?.eachBatch) {\n if (isWrapped(config.eachBatch)) {\n instrumentation._unwrap(config, 'eachBatch');\n }\n instrumentation._wrap(config, 'eachBatch', instrumentation._getConsumerEachBatchPatch());\n }\n return original.call(this, config);\n };\n };\n }\n\n private _getConsumerEachMessagePatch() {\n return (original: ConsumerRunConfig['eachMessage']) => {\n return function eachMessage(this: unknown, ...args: Parameters<EachMessageHandler>): Promise<void> {\n const payload = args[0];\n const sentryTrace = getHeaderAsString(payload.message.headers, 'sentry-trace');\n const baggage = getHeaderAsString(payload.message.headers, 'baggage');\n\n // Continue the producer's trace so the consumer span is parented to the message's producer.\n return continueTrace({ sentryTrace, baggage }, () => {\n const span = startConsumerSpan({\n topic: payload.topic,\n message: payload.message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n },\n });\n\n const eachMessagePromise = withActiveSpan(span, () => {\n return original!.apply(this, args);\n });\n return endSpansOnPromise([span], eachMessagePromise);\n });\n };\n };\n }\n\n private _getConsumerEachBatchPatch() {\n return (original: ConsumerRunConfig['eachBatch']) => {\n return function eachBatch(this: unknown, ...args: Parameters<EachBatchHandler>): Promise<void> {\n const payload = args[0];\n // https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#topic-with-multiple-consumers\n // A batch pull aggregates messages from many producers, so the receiving span is a fresh root\n // trace and each processed message links back to its own producer span.\n const receivingSpan = startNewTrace(() =>\n startConsumerSpan({\n topic: payload.batch.topic,\n message: undefined,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n attributes: {\n [MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n\n return withActiveSpan(receivingSpan, () => {\n const spans: Span[] = [receivingSpan];\n payload.batch.messages.forEach((message: KafkaMessage) => {\n spans.push(\n startConsumerSpan({\n topic: payload.batch.topic,\n message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n links: getLinksFromHeaders(message.headers),\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n });\n const batchMessagePromise: Promise<void> = original!.apply(this, args);\n return endSpansOnPromise(spans, batchMessagePromise);\n });\n };\n };\n }\n\n private _getProducerTransactionPatch() {\n const instrumentation = this;\n return (original: Producer['transaction']) => {\n return function transaction(\n this: Producer,\n ...args: Parameters<Producer['transaction']>\n ): ReturnType<Producer['transaction']> {\n const transactionSpan = startInactiveSpan({ name: 'transaction' });\n\n const transactionPromise = original.apply(this, args);\n\n transactionPromise\n .then((transaction: Transaction) => {\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalSend = transaction.send;\n transaction.send = function send(this: Transaction, ...args) {\n return withActiveSpan(transactionSpan, () => {\n const patched = instrumentation._getSendPatch()(originalSend);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n throw err;\n });\n });\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalSendBatch = transaction.sendBatch;\n transaction.sendBatch = function sendBatch(this: Transaction, ...args) {\n return withActiveSpan(transactionSpan, () => {\n const patched = instrumentation._getSendBatchPatch()(originalSendBatch);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n throw err;\n });\n });\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalCommit = transaction.commit;\n transaction.commit = function commit(this: Transaction, ...args) {\n const originCommitPromise = originalCommit.apply(this, args).then(() => {\n transactionSpan.setStatus({ code: SPAN_STATUS_OK });\n });\n return endSpansOnPromise([transactionSpan], originCommitPromise);\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalAbort = transaction.abort;\n transaction.abort = function abort(this: Transaction, ...args) {\n const originAbortPromise = originalAbort.apply(this, args);\n return endSpansOnPromise([transactionSpan], originAbortPromise);\n };\n })\n .catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n transactionSpan.end();\n });\n\n return transactionPromise;\n };\n };\n }\n\n private _getSendBatchPatch() {\n return (original: Producer['sendBatch'] | Transaction['sendBatch']) => {\n return function sendBatch(\n this: Producer | Transaction,\n ...args: Parameters<Producer['sendBatch']>\n ): ReturnType<Producer['sendBatch']> {\n const batch = args[0];\n const messages = batch.topicMessages || [];\n\n const spans: Span[] = [];\n\n messages.forEach((topicMessage: any) => {\n topicMessage.messages.forEach((message: any) => {\n spans.push(startProducerSpan(topicMessage.topic, message));\n });\n });\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return endSpansOnPromise(spans, origSendResult);\n };\n };\n }\n\n private _getSendPatch() {\n return (original: Producer['send'] | Transaction['send']) => {\n return function send(\n this: Producer | Transaction,\n ...args: Parameters<Producer['send']>\n ): ReturnType<Producer['send']> {\n const record = args[0];\n const spans: Span[] = record.messages.map((message: any) => {\n return startProducerSpan(record.topic, message);\n });\n\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return endSpansOnPromise(spans, origSendResult);\n };\n };\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","isWrapped","InstrumentationNodeModuleDefinition","instrumentation","getHeaderAsString","continueTrace","startConsumerSpan","MESSAGING_OPERATION_TYPE_VALUE_PROCESS","ATTR_MESSAGING_DESTINATION_PARTITION_ID","withActiveSpan","endSpansOnPromise","startNewTrace","MESSAGING_OPERATION_TYPE_VALUE_RECEIVE","MESSAGING_BATCH_MESSAGE_COUNT","getLinksFromHeaders","startInactiveSpan","transaction","args","SPAN_STATUS_ERROR","SPAN_STATUS_OK","startProducerSpan"],"mappings":";;;;;;;;AAoDA,MAAM,YAAA,GAAe,iCAAA;AAEd,MAAM,+BAA+BA,mCAAA,CAA2C;AAAA,EAC9E,WAAA,CAAY,MAAA,GAAgC,EAAC,EAAG;AACrD,IAAA,KAAA,CAAM,YAAA,EAAcC,kBAAa,MAAM,CAAA;AAAA,EACzC;AAAA,EAEU,IA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kB,OAAO,cAAc,CAAA;AAAA,MAChD,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AAAA,EAEQ,aAAA,GAAgB;AACtB,IAAA,OAAO,CAAC,QAAA,KAAqD;AAC3D,MAAA,OAAO,SAAS,QAEX,IAAA,EAC2B;AAC9B,QAAA,MAAM,MAAA,GAAS,KAAK,CAAC,CAAA;AACrB,QAAA,MAAM,KAAA,GAAgB,MAAA,CAAO,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,KAAiB;AAC1D,UAAA,OAAOU,uBAAA,CAAkB,MAAA,CAAO,KAAA,EAAO,OAAO,CAAA;AAAA,QAChD,CAAC,CAAA;AAED,QAAA,MAAM,cAAA,GAA4C,QAAA,CAAS,KAAA,CAAM,IAAA,EAAM,IAAI,CAAA;AAC3E,QAAA,OAAOV,uBAAA,CAAkB,OAAO,cAAc,CAAA;AAAA,MAChD,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AACF;;;;"}
@@ -1,31 +1,19 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const ATTR_MESSAGING_BATCH_MESSAGE_COUNT = "messaging.batch.message_count";
4
- const ATTR_MESSAGING_DESTINATION_NAME = "messaging.destination.name";
5
3
  const ATTR_MESSAGING_DESTINATION_PARTITION_ID = "messaging.destination.partition.id";
6
4
  const ATTR_MESSAGING_KAFKA_MESSAGE_KEY = "messaging.kafka.message.key";
7
5
  const ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE = "messaging.kafka.message.tombstone";
8
6
  const ATTR_MESSAGING_KAFKA_OFFSET = "messaging.kafka.offset";
9
- const ATTR_MESSAGING_OPERATION_NAME = "messaging.operation.name";
10
- const ATTR_MESSAGING_OPERATION_TYPE = "messaging.operation.type";
11
- const ATTR_MESSAGING_SYSTEM = "messaging.system";
12
7
  const MESSAGING_OPERATION_TYPE_VALUE_PROCESS = "process";
13
8
  const MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = "receive";
14
9
  const MESSAGING_OPERATION_TYPE_VALUE_SEND = "send";
15
10
  const MESSAGING_SYSTEM_VALUE_KAFKA = "kafka";
16
- const ATTR_ERROR_TYPE = "error.type";
17
11
  const ERROR_TYPE_VALUE_OTHER = "_OTHER";
18
12
 
19
- exports.ATTR_ERROR_TYPE = ATTR_ERROR_TYPE;
20
- exports.ATTR_MESSAGING_BATCH_MESSAGE_COUNT = ATTR_MESSAGING_BATCH_MESSAGE_COUNT;
21
- exports.ATTR_MESSAGING_DESTINATION_NAME = ATTR_MESSAGING_DESTINATION_NAME;
22
13
  exports.ATTR_MESSAGING_DESTINATION_PARTITION_ID = ATTR_MESSAGING_DESTINATION_PARTITION_ID;
23
14
  exports.ATTR_MESSAGING_KAFKA_MESSAGE_KEY = ATTR_MESSAGING_KAFKA_MESSAGE_KEY;
24
15
  exports.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE = ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE;
25
16
  exports.ATTR_MESSAGING_KAFKA_OFFSET = ATTR_MESSAGING_KAFKA_OFFSET;
26
- exports.ATTR_MESSAGING_OPERATION_NAME = ATTR_MESSAGING_OPERATION_NAME;
27
- exports.ATTR_MESSAGING_OPERATION_TYPE = ATTR_MESSAGING_OPERATION_TYPE;
28
- exports.ATTR_MESSAGING_SYSTEM = ATTR_MESSAGING_SYSTEM;
29
17
  exports.ERROR_TYPE_VALUE_OTHER = ERROR_TYPE_VALUE_OTHER;
30
18
  exports.MESSAGING_OPERATION_TYPE_VALUE_PROCESS = MESSAGING_OPERATION_TYPE_VALUE_PROCESS;
31
19
  exports.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = MESSAGING_OPERATION_TYPE_VALUE_RECEIVE;
@@ -1 +1 @@
1
- {"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\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-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Metric semantic conventions dropped; `error.type` inlined from `@opentelemetry/semantic-conventions`\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 * The number of messages sent, received, or processed in the scope of the batching operation.\n *\n * @example 0\n * @example 1\n * @example 2\n *\n * @note Instrumentations **SHOULD NOT** set `messaging.batch.message_count` on spans that operate with a single message. When a messaging client library supports both batch and single-message API for the same operation, instrumentations **SHOULD** use `messaging.batch.message_count` for batching APIs and **SHOULD NOT** use it for single-message APIs.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_BATCH_MESSAGE_COUNT = 'messaging.batch.message_count' as const;\n\n/**\n * The message destination name\n *\n * @example MyQueue\n * @example MyTopic\n *\n * @note Destination name **SHOULD** uniquely identify a specific queue, topic or other entity within the broker. If\n * the broker doesn't have such notion, the destination name **SHOULD** uniquely identify the broker.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_DESTINATION_NAME = 'messaging.destination.name' as const;\n\n/**\n * The identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`.\n *\n * @example \"1\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_DESTINATION_PARTITION_ID = 'messaging.destination.partition.id' as const;\n\n/**\n * Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message.id` in that they're not unique. If the key is `null`, the attribute **MUST NOT** be set.\n *\n * @example \"myKey\"\n *\n * @note If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_KAFKA_MESSAGE_KEY = 'messaging.kafka.message.key' as const;\n\n/**\n * A boolean that is true if the message is a tombstone.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE = 'messaging.kafka.message.tombstone' as const;\n\n/**\n * The offset of a record in the corresponding Kafka partition.\n *\n * @example 42\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_KAFKA_OFFSET = 'messaging.kafka.offset' as const;\n\n/**\n * The system-specific name of the messaging operation.\n *\n * @example ack\n * @example nack\n * @example send\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_OPERATION_NAME = 'messaging.operation.name' as const;\n\n/**\n * A string identifying the type of the messaging operation.\n *\n * @note If a custom value is used, it **MUST** be of low cardinality.\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_OPERATION_TYPE = 'messaging.operation.type' as const;\n\n/**\n * The messaging system as identified by the client instrumentation.\n *\n * @note The actual messaging system may differ from the one known by the client. For example, when using Kafka client libraries to communicate with Azure Event Hubs, the `messaging.system` is set to `kafka` based on the instrumentation's best knowledge.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_SYSTEM = 'messaging.system' as const;\n\n/**\n * Enum value \"process\" for attribute {@link ATTR_MESSAGING_OPERATION_TYPE}.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_PROCESS = 'process' as const;\n\n/**\n * Enum value \"receive\" for attribute {@link ATTR_MESSAGING_OPERATION_TYPE}.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = 'receive' as const;\n\n/**\n * Enum value \"send\" for attribute {@link ATTR_MESSAGING_OPERATION_TYPE}.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_SEND = 'send' as const;\n\n/**\n * Enum value \"kafka\" for attribute {@link ATTR_MESSAGING_SYSTEM}.\n */\nexport const MESSAGING_SYSTEM_VALUE_KAFKA = 'kafka' as const;\n\n/**\n * Describes a class of error the operation ended with.\n *\n * @example timeout\n * @example java.net.UnknownHostException\n * @example server_certificate_invalid\n * @example 500\n */\nexport const ATTR_ERROR_TYPE = 'error.type' as const;\n\n/**\n * Enum value \"_OTHER\" for attribute {@link ATTR_ERROR_TYPE}. A fallback error value to be used when\n * the instrumentation doesn't define a custom value.\n */\nexport const ERROR_TYPE_VALUE_OTHER = '_OTHER' as const;\n"],"names":[],"mappings":";;AA2BO,MAAM,kCAAA,GAAqC;AAa3C,MAAM,+BAAA,GAAkC;AASxC,MAAM,uCAAA,GAA0C;AAWhD,MAAM,gCAAA,GAAmC;AAOzC,MAAM,sCAAA,GAAyC;AAS/C,MAAM,2BAAA,GAA8B;AAWpC,MAAM,6BAAA,GAAgC;AAQtC,MAAM,6BAAA,GAAgC;AAStC,MAAM,qBAAA,GAAwB;AAK9B,MAAM,sCAAA,GAAyC;AAK/C,MAAM,sCAAA,GAAyC;AAK/C,MAAM,mCAAA,GAAsC;AAK5C,MAAM,4BAAA,GAA+B;AAUrC,MAAM,eAAA,GAAkB;AAMxB,MAAM,sBAAA,GAAyB;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\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-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Metric semantic conventions dropped; `error.type` inlined from `@opentelemetry/semantic-conventions`\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 * The identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`.\n *\n * @example \"1\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_DESTINATION_PARTITION_ID = 'messaging.destination.partition.id' as const;\n\n/**\n * Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message.id` in that they're not unique. If the key is `null`, the attribute **MUST NOT** be set.\n *\n * @example \"myKey\"\n *\n * @note If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_KAFKA_MESSAGE_KEY = 'messaging.kafka.message.key' as const;\n\n/**\n * A boolean that is true if the message is a tombstone.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE = 'messaging.kafka.message.tombstone' as const;\n\n/**\n * The offset of a record in the corresponding Kafka partition.\n *\n * @example 42\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_KAFKA_OFFSET = 'messaging.kafka.offset' as const;\n\n/**\n * Enum value \"process\" for attribute `messaging.operation.type`.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_PROCESS = 'process' as const;\n\n/**\n * Enum value \"receive\" for attribute `messaging.operation.type`.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = 'receive' as const;\n\n/**\n * Enum value \"send\" for attribute `messaging.operation.type`.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_SEND = 'send' as const;\n\n/**\n * Enum value \"kafka\" for attribute `messaging.system`.\n */\nexport const MESSAGING_SYSTEM_VALUE_KAFKA = 'kafka' as const;\n\n/**\n * Enum value \"_OTHER\" for attribute `error.type`. A fallback error value to be used when\n * the instrumentation doesn't define a custom value.\n */\nexport const ERROR_TYPE_VALUE_OTHER = '_OTHER' as const;\n"],"names":[],"mappings":";;AAuBO,MAAM,uCAAA,GAA0C;AAWhD,MAAM,gCAAA,GAAmC;AAOzC,MAAM,sCAAA,GAAyC;AAS/C,MAAM,2BAAA,GAA8B;AAKpC,MAAM,sCAAA,GAAyC;AAK/C,MAAM,sCAAA,GAAyC;AAK/C,MAAM,mCAAA,GAAsC;AAK5C,MAAM,4BAAA,GAA+B;AAMrC,MAAM,sBAAA,GAAyB;;;;;;;;;;;;"}
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const api = require('@opentelemetry/api');
4
+ const attributes = require('@sentry/conventions/attributes');
4
5
  const core = require('@sentry/core');
5
6
  const semconv = require('./semconv.js');
6
7
 
@@ -36,18 +37,18 @@ function getLinksFromHeaders(headers) {
36
37
  }
37
38
  ];
38
39
  }
39
- function startConsumerSpan({ topic, message, operationType, links, attributes }) {
40
+ function startConsumerSpan({ topic, message, operationType, links, attributes: attributes$1 }) {
40
41
  const operationName = operationType === semconv.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? "poll" : operationType;
41
42
  return core.startInactiveSpan({
42
43
  name: `${operationName} ${topic}`,
43
44
  kind: operationType === semconv.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? core.SPAN_KIND.CLIENT : core.SPAN_KIND.CONSUMER,
44
45
  links,
45
46
  attributes: {
46
- ...attributes,
47
- [semconv.ATTR_MESSAGING_SYSTEM]: semconv.MESSAGING_SYSTEM_VALUE_KAFKA,
48
- [semconv.ATTR_MESSAGING_DESTINATION_NAME]: topic,
49
- [semconv.ATTR_MESSAGING_OPERATION_TYPE]: operationType,
50
- [semconv.ATTR_MESSAGING_OPERATION_NAME]: operationName,
47
+ ...attributes$1,
48
+ [attributes.MESSAGING_SYSTEM]: semconv.MESSAGING_SYSTEM_VALUE_KAFKA,
49
+ [attributes.MESSAGING_DESTINATION_NAME]: topic,
50
+ [attributes.MESSAGING_OPERATION_TYPE]: operationType,
51
+ [attributes.MESSAGING_OPERATION_NAME]: operationName,
51
52
  [semconv.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message?.key ? String(message.key) : void 0,
52
53
  [semconv.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message?.key && message.value === null ? true : void 0,
53
54
  [semconv.ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset,
@@ -62,13 +63,13 @@ function startProducerSpan(topic, message) {
62
63
  name: `send ${topic}`,
63
64
  kind: core.SPAN_KIND.PRODUCER,
64
65
  attributes: {
65
- [semconv.ATTR_MESSAGING_SYSTEM]: semconv.MESSAGING_SYSTEM_VALUE_KAFKA,
66
- [semconv.ATTR_MESSAGING_DESTINATION_NAME]: topic,
66
+ [attributes.MESSAGING_SYSTEM]: semconv.MESSAGING_SYSTEM_VALUE_KAFKA,
67
+ [attributes.MESSAGING_DESTINATION_NAME]: topic,
67
68
  [semconv.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message.key ? String(message.key) : void 0,
68
69
  [semconv.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message.key && message.value === null ? true : void 0,
69
70
  [semconv.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: message.partition !== void 0 ? String(message.partition) : void 0,
70
- [semconv.ATTR_MESSAGING_OPERATION_NAME]: "send",
71
- [semconv.ATTR_MESSAGING_OPERATION_TYPE]: semconv.MESSAGING_OPERATION_TYPE_VALUE_SEND,
71
+ [attributes.MESSAGING_OPERATION_NAME]: "send",
72
+ [attributes.MESSAGING_OPERATION_TYPE]: semconv.MESSAGING_OPERATION_TYPE_VALUE_SEND,
72
73
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRODUCER_ORIGIN
73
74
  }
74
75
  });
@@ -93,7 +94,7 @@ function endSpansOnPromise(spans, sendPromise) {
93
94
  errorType = reason.constructor.name;
94
95
  }
95
96
  spans.forEach((span) => {
96
- span.setAttribute(semconv.ATTR_ERROR_TYPE, errorType);
97
+ span.setAttribute(attributes.ERROR_TYPE, errorType);
97
98
  span.setStatus({
98
99
  code: core.SPAN_STATUS_ERROR,
99
100
  message: errorMessage
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\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-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Span creation extracted here and migrated to the @sentry/core API; origin folded into span creation\n */\n\nimport { TraceFlags } from '@opentelemetry/api';\nimport type { Span, SpanAttributes, SpanLink } from '@sentry/core';\nimport {\n getTraceData,\n propagationContextFromHeaders,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport type { KafkaMessage, Message } from './kafkajs-types';\nimport {\n ATTR_ERROR_TYPE,\n ATTR_MESSAGING_DESTINATION_NAME,\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n ATTR_MESSAGING_KAFKA_MESSAGE_KEY,\n ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE,\n ATTR_MESSAGING_KAFKA_OFFSET,\n ATTR_MESSAGING_OPERATION_NAME,\n ATTR_MESSAGING_OPERATION_TYPE,\n ATTR_MESSAGING_SYSTEM,\n ERROR_TYPE_VALUE_OTHER,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n MESSAGING_OPERATION_TYPE_VALUE_SEND,\n MESSAGING_SYSTEM_VALUE_KAFKA,\n} from './semconv';\n\nconst PRODUCER_ORIGIN = 'auto.kafkajs.otel.producer';\nconst CONSUMER_ORIGIN = 'auto.kafkajs.otel.consumer';\n\nexport interface ConsumerSpanOptions {\n topic: string;\n message: KafkaMessage | undefined;\n operationType: string;\n attributes: SpanAttributes;\n links?: SpanLink[];\n}\n\n/**\n * Reads a header value off a kafkajs message as a string. kafkajs delivers headers as `Buffer`s (or\n * arrays of them), so we normalize to a string before handing them to Sentry's trace helpers.\n */\nexport function getHeaderAsString(headers: KafkaMessage['headers'], key: string): string | undefined {\n const value = headers?.[key];\n if (value == null) {\n return undefined;\n }\n return Array.isArray(value) ? value[0]?.toString() : value.toString();\n}\n\n/**\n * Builds a span link to the producer span carried in the message headers, mirroring the upstream\n * behavior of linking each batch-processed message to its originating producer span.\n */\nexport function getLinksFromHeaders(headers: KafkaMessage['headers']): SpanLink[] | undefined {\n const sentryTrace = getHeaderAsString(headers, 'sentry-trace');\n if (!sentryTrace) {\n return undefined;\n }\n\n const { traceId, parentSpanId, sampled } = propagationContextFromHeaders(\n sentryTrace,\n getHeaderAsString(headers, 'baggage'),\n );\n if (!parentSpanId) {\n return undefined;\n }\n\n return [\n {\n context: {\n traceId,\n spanId: parentSpanId,\n isRemote: true,\n traceFlags: sampled ? TraceFlags.SAMPLED : TraceFlags.NONE,\n },\n },\n ];\n}\n\n/** Starts an inactive consumer (process/receive) span carrying the kafkajs messaging attributes. */\nexport function startConsumerSpan({ topic, message, operationType, links, attributes }: ConsumerSpanOptions): Span {\n const operationName =\n operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE\n ? 'poll' // for batch processing spans\n : operationType; // for individual message processing spans\n\n return startInactiveSpan({\n name: `${operationName} ${topic}`,\n kind: operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? SPAN_KIND.CLIENT : SPAN_KIND.CONSUMER,\n links,\n attributes: {\n ...attributes,\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_DESTINATION_NAME]: topic,\n [ATTR_MESSAGING_OPERATION_TYPE]: operationType,\n [ATTR_MESSAGING_OPERATION_NAME]: operationName,\n [ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message?.key ? String(message.key) : undefined,\n [ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message?.key && message.value === null ? true : undefined,\n [ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset,\n // Mirror the upstream behavior of only tagging per-message processing spans (not the batch\n // receiving span, which carries no message) with the auto origin.\n ...(message ? { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN } : {}),\n },\n });\n}\n\n/** Starts an inactive producer span and propagates its trace into the message headers. */\nexport function startProducerSpan(topic: string, message: Message): Span {\n const span = startInactiveSpan({\n name: `send ${topic}`,\n kind: SPAN_KIND.PRODUCER,\n attributes: {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_DESTINATION_NAME]: topic,\n [ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message.key ? String(message.key) : undefined,\n [ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message.key && message.value === null ? true : undefined,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]:\n message.partition !== undefined ? String(message.partition) : undefined,\n [ATTR_MESSAGING_OPERATION_NAME]: 'send',\n [ATTR_MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_TYPE_VALUE_SEND,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRODUCER_ORIGIN,\n },\n });\n\n // Propagate the producer span's trace to consumers via the message headers.\n message.headers = message.headers ?? {};\n const traceData = getTraceData({ span });\n if (traceData['sentry-trace']) {\n message.headers['sentry-trace'] = traceData['sentry-trace'];\n }\n if (traceData.baggage) {\n message.headers['baggage'] = traceData.baggage;\n }\n\n return span;\n}\n\n/**\n * Resolves once `sendPromise` settles, ending all `spans` and, on failure, marking them with the\n * error status and `error.type` before re-throwing.\n */\nexport function endSpansOnPromise<T>(spans: Span[], sendPromise: Promise<T>): Promise<T> {\n return Promise.resolve(sendPromise)\n .catch(reason => {\n let errorMessage: string | undefined;\n let errorType: string = ERROR_TYPE_VALUE_OTHER;\n if (typeof reason === 'string' || reason === undefined) {\n errorMessage = reason;\n } else if (typeof reason === 'object' && Object.prototype.hasOwnProperty.call(reason, 'message')) {\n errorMessage = reason.message;\n errorType = reason.constructor.name;\n }\n\n spans.forEach(span => {\n span.setAttribute(ATTR_ERROR_TYPE, errorType);\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n message: errorMessage,\n });\n });\n\n throw reason;\n })\n .finally(() => {\n spans.forEach(span => span.end());\n });\n}\n"],"names":["propagationContextFromHeaders","TraceFlags","MESSAGING_OPERATION_TYPE_VALUE_RECEIVE","startInactiveSpan","SPAN_KIND","ATTR_MESSAGING_SYSTEM","MESSAGING_SYSTEM_VALUE_KAFKA","ATTR_MESSAGING_DESTINATION_NAME","ATTR_MESSAGING_OPERATION_TYPE","ATTR_MESSAGING_OPERATION_NAME","ATTR_MESSAGING_KAFKA_MESSAGE_KEY","ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE","ATTR_MESSAGING_KAFKA_OFFSET","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","ATTR_MESSAGING_DESTINATION_PARTITION_ID","MESSAGING_OPERATION_TYPE_VALUE_SEND","getTraceData","ERROR_TYPE_VALUE_OTHER","ATTR_ERROR_TYPE","SPAN_STATUS_ERROR"],"mappings":";;;;;;AAqCA,MAAM,eAAA,GAAkB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AA;AAC5C,MAAA,IAAA,CAAK,SAAA,CAAU;AAAA,QACb,IAAA,EAAMC,sBAAA;AAAA,QACN,OAAA,EAAS;AAAA,OACV,CAAA;AAAA,IACH,CAAC,CAAA;AAED,IAAA,MAAM,MAAA;AAAA,EACR,CAAC,CAAA,CACA,OAAA,CAAQ,MAAM;AACb,IAAA,KAAA,CAAM,OAAA,CAAQ,CAAA,IAAA,KAAQ,IAAA,CAAK,GAAA,EAAK,CAAA;AAAA,EAClC,CAAC,CAAA;AACL;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\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-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Span creation extracted here and migrated to the @sentry/core API; origin folded into span creation\n */\n\nimport { TraceFlags } from '@opentelemetry/api';\nimport {\n ERROR_TYPE,\n MESSAGING_DESTINATION_NAME,\n MESSAGING_OPERATION_NAME,\n MESSAGING_OPERATION_TYPE,\n MESSAGING_SYSTEM,\n} from '@sentry/conventions/attributes';\nimport type { Span, SpanAttributes, SpanLink } from '@sentry/core';\nimport {\n getTraceData,\n propagationContextFromHeaders,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport type { KafkaMessage, Message } from './kafkajs-types';\nimport {\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n ATTR_MESSAGING_KAFKA_MESSAGE_KEY,\n ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE,\n ATTR_MESSAGING_KAFKA_OFFSET,\n ERROR_TYPE_VALUE_OTHER,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n MESSAGING_OPERATION_TYPE_VALUE_SEND,\n MESSAGING_SYSTEM_VALUE_KAFKA,\n} from './semconv';\n\nconst PRODUCER_ORIGIN = 'auto.kafkajs.otel.producer';\nconst CONSUMER_ORIGIN = 'auto.kafkajs.otel.consumer';\n\nexport interface ConsumerSpanOptions {\n topic: string;\n message: KafkaMessage | undefined;\n operationType: string;\n attributes: SpanAttributes;\n links?: SpanLink[];\n}\n\n/**\n * Reads a header value off a kafkajs message as a string. kafkajs delivers headers as `Buffer`s (or\n * arrays of them), so we normalize to a string before handing them to Sentry's trace helpers.\n */\nexport function getHeaderAsString(headers: KafkaMessage['headers'], key: string): string | undefined {\n const value = headers?.[key];\n if (value == null) {\n return undefined;\n }\n return Array.isArray(value) ? value[0]?.toString() : value.toString();\n}\n\n/**\n * Builds a span link to the producer span carried in the message headers, mirroring the upstream\n * behavior of linking each batch-processed message to its originating producer span.\n */\nexport function getLinksFromHeaders(headers: KafkaMessage['headers']): SpanLink[] | undefined {\n const sentryTrace = getHeaderAsString(headers, 'sentry-trace');\n if (!sentryTrace) {\n return undefined;\n }\n\n const { traceId, parentSpanId, sampled } = propagationContextFromHeaders(\n sentryTrace,\n getHeaderAsString(headers, 'baggage'),\n );\n if (!parentSpanId) {\n return undefined;\n }\n\n return [\n {\n context: {\n traceId,\n spanId: parentSpanId,\n isRemote: true,\n traceFlags: sampled ? TraceFlags.SAMPLED : TraceFlags.NONE,\n },\n },\n ];\n}\n\n/** Starts an inactive consumer (process/receive) span carrying the kafkajs messaging attributes. */\nexport function startConsumerSpan({ topic, message, operationType, links, attributes }: ConsumerSpanOptions): Span {\n const operationName =\n operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE\n ? 'poll' // for batch processing spans\n : operationType; // for individual message processing spans\n\n return startInactiveSpan({\n name: `${operationName} ${topic}`,\n kind: operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? SPAN_KIND.CLIENT : SPAN_KIND.CONSUMER,\n links,\n attributes: {\n ...attributes,\n [MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [MESSAGING_DESTINATION_NAME]: topic,\n [MESSAGING_OPERATION_TYPE]: operationType,\n [MESSAGING_OPERATION_NAME]: operationName,\n [ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message?.key ? String(message.key) : undefined,\n [ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message?.key && message.value === null ? true : undefined,\n [ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset,\n // Mirror the upstream behavior of only tagging per-message processing spans (not the batch\n // receiving span, which carries no message) with the auto origin.\n ...(message ? { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN } : {}),\n },\n });\n}\n\n/** Starts an inactive producer span and propagates its trace into the message headers. */\nexport function startProducerSpan(topic: string, message: Message): Span {\n const span = startInactiveSpan({\n name: `send ${topic}`,\n kind: SPAN_KIND.PRODUCER,\n attributes: {\n [MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [MESSAGING_DESTINATION_NAME]: topic,\n [ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message.key ? String(message.key) : undefined,\n [ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message.key && message.value === null ? true : undefined,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]:\n message.partition !== undefined ? String(message.partition) : undefined,\n [MESSAGING_OPERATION_NAME]: 'send',\n [MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_TYPE_VALUE_SEND,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRODUCER_ORIGIN,\n },\n });\n\n // Propagate the producer span's trace to consumers via the message headers.\n message.headers = message.headers ?? {};\n const traceData = getTraceData({ span });\n if (traceData['sentry-trace']) {\n message.headers['sentry-trace'] = traceData['sentry-trace'];\n }\n if (traceData.baggage) {\n message.headers['baggage'] = traceData.baggage;\n }\n\n return span;\n}\n\n/**\n * Resolves once `sendPromise` settles, ending all `spans` and, on failure, marking them with the\n * error status and `error.type` before re-throwing.\n */\nexport function endSpansOnPromise<T>(spans: Span[], sendPromise: Promise<T>): Promise<T> {\n return Promise.resolve(sendPromise)\n .catch(reason => {\n let errorMessage: string | undefined;\n let errorType: string = ERROR_TYPE_VALUE_OTHER;\n if (typeof reason === 'string' || reason === undefined) {\n errorMessage = reason;\n } else if (typeof reason === 'object' && Object.prototype.hasOwnProperty.call(reason, 'message')) {\n errorMessage = reason.message;\n errorType = reason.constructor.name;\n }\n\n spans.forEach(span => {\n span.setAttribute(ERROR_TYPE, errorType);\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n message: errorMessage,\n });\n });\n\n throw reason;\n })\n .finally(() => {\n spans.forEach(span => span.end());\n });\n}\n"],"names":["propagationContextFromHeaders","TraceFlags","attributes","MESSAGING_OPERATION_TYPE_VALUE_RECEIVE","startInactiveSpan","SPAN_KIND","MESSAGING_SYSTEM","MESSAGING_SYSTEM_VALUE_KAFKA","MESSAGING_DESTINATION_NAME","MESSAGING_OPERATION_TYPE","MESSAGING_OPERATION_NAME","ATTR_MESSAGING_KAFKA_MESSAGE_KEY","ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE","ATTR_MESSAGING_KAFKA_OFFSET","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","ATTR_MESSAGING_DESTINATION_PARTITION_ID","MESSAGING_OPERATION_TYPE_VALUE_SEND","getTraceData","ERROR_TYPE_VALUE_OTHER","ERROR_TYPE","SPAN_STATUS_ERROR"],"mappings":";;;;;;;AAuCA,MAAM,eAAA,GAAkB,4BAAA;AACxB,MAAM,eAAA,GAAkB,4BAAA;AAcjB,SAAS,iBAAA,CAAkB,SAAkC,GAAA,EAAiC;AACnG,EAAA,MAAM,KAAA,GAAQ,UAAU,GAAG,CAAA;AAC3B,EAAA,IAAI,SAAS,IAAA,EAAM;AACjB,IAAA,OAAO,MAAA;AAAA,EACT;AACA,E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IAAA,KAAA,CAAM,OAAA,CAAQ,CAAA,IAAA,KAAQ,IAAA,CAAK,GAAA,EAAK,CAAA;AAAA,EAClC,CAAC,CAAA;AACL;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/knex/index.ts"],"sourcesContent":["import { KnexInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Knex';\n\nexport const instrumentKnex = generateInstrumentOnce(INTEGRATION_NAME, () => new KnexInstrumentation());\n\nconst _knexIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKnex();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Knex integration\n *\n * Capture tracing data for [Knex](https://knexjs.org/).\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n *\n * Sentry.init({\n * integrations: [Sentry.knexIntegration()],\n * });\n * ```\n */\nexport const knexIntegration = defineIntegration(_knexIntegration);\n"],"names":["generateInstrumentOnce","KnexInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,MAAA;AAElB,MAAM,iBAAiBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,qCAAqB;AAEtG,MAAM,oBAAoB,MAAM;AAC9B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,cAAA,EAAe;AAAA,IACjB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,eAAA,GAAkBC,uBAAkB,gBAAgB;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/knex/index.ts"],"sourcesContent":["import { KnexInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Knex' as const;\n\nexport const instrumentKnex = generateInstrumentOnce(INTEGRATION_NAME, () => new KnexInstrumentation());\n\nconst _knexIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKnex();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Knex integration\n *\n * Capture tracing data for [Knex](https://knexjs.org/).\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n *\n * Sentry.init({\n * integrations: [Sentry.knexIntegration()],\n * });\n * ```\n */\nexport const knexIntegration = defineIntegration(_knexIntegration);\n"],"names":["generateInstrumentOnce","KnexInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,MAAA;AAElB,MAAM,iBAAiBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,qCAAqB;AAEtG,MAAM,oBAAoB,MAAM;AAC9B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,cAAA,EAAe;AAAA,IACjB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,eAAA,GAAkBC,uBAAkB,gBAAgB;;;;;"}
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentation = require('@opentelemetry/instrumentation');
4
4
  const core = require('@sentry/core');
5
+ const attributes = require('@sentry/conventions/attributes');
5
6
  const InstrumentationNodeModuleFile = require('../../InstrumentationNodeModuleFile.js');
6
7
  const semconv = require('./semconv.js');
7
8
  const utils = require('./utils.js');
@@ -75,18 +76,18 @@ class KnexInstrumentation extends instrumentation.InstrumentationBase {
75
76
  const operation = query?.method;
76
77
  const connectionString = config?.connection?.connectionString;
77
78
  const name = config?.connection?.filename || config?.connection?.database || utils.extractDatabaseFromConnectionString(connectionString);
78
- const attributes = {
79
+ const attributes$1 = {
79
80
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
80
81
  "knex.version": moduleVersion,
81
- [semconv.ATTR_DB_SYSTEM]: utils.mapSystem(this.client.driverName),
82
+ [attributes.DB_SYSTEM]: utils.mapSystem(this.client.driverName),
82
83
  [semconv.ATTR_DB_SQL_TABLE]: table,
83
- [semconv.ATTR_DB_OPERATION]: operation,
84
- [semconv.ATTR_DB_USER]: config?.connection?.user,
85
- [semconv.ATTR_DB_NAME]: name,
86
- [semconv.ATTR_NET_PEER_NAME]: config?.connection?.host ?? utils.extractHostFromConnectionString(connectionString),
87
- [semconv.ATTR_NET_PEER_PORT]: config?.connection?.port ?? utils.extractPortFromConnectionString(connectionString),
88
- [semconv.ATTR_NET_TRANSPORT]: config?.connection?.filename === ":memory:" ? "inproc" : void 0,
89
- [semconv.ATTR_DB_STATEMENT]: utils.limitLength(query?.sql, MAX_QUERY_LENGTH)
84
+ [attributes.DB_OPERATION]: operation,
85
+ [attributes.DB_USER]: config?.connection?.user,
86
+ [attributes.DB_NAME]: name,
87
+ [attributes.NET_PEER_NAME]: config?.connection?.host ?? utils.extractHostFromConnectionString(connectionString),
88
+ [attributes.NET_PEER_PORT]: config?.connection?.port ?? utils.extractPortFromConnectionString(connectionString),
89
+ [attributes.NET_TRANSPORT]: config?.connection?.filename === ":memory:" ? "inproc" : void 0,
90
+ [attributes.DB_STATEMENT]: utils.limitLength(query?.sql, MAX_QUERY_LENGTH)
90
91
  };
91
92
  const parentSpan = this.builder[parentSpanSymbol] || core.getActiveSpan();
92
93
  const args = arguments;
@@ -94,7 +95,7 @@ class KnexInstrumentation extends instrumentation.InstrumentationBase {
94
95
  {
95
96
  name: utils.getName(name, operation, table),
96
97
  kind: core.SPAN_KIND.CLIENT,
97
- attributes,
98
+ attributes: attributes$1,
98
99
  parentSpan,
99
100
  onlyIfParent: true
100
101
  },