@sentry/node 10.61.0 → 10.63.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 (385) hide show
  1. package/build/cjs/integrations/featureFlagShims/launchDarkly.js.map +1 -1
  2. package/build/cjs/integrations/featureFlagShims/openFeature.js.map +1 -1
  3. package/build/cjs/integrations/featureFlagShims/statsig.js.map +1 -1
  4. package/build/cjs/integrations/featureFlagShims/unleash.js.map +1 -1
  5. package/build/cjs/integrations/fs/index.js.map +1 -1
  6. package/build/cjs/integrations/http.js.map +1 -1
  7. package/build/cjs/integrations/node-fetch/index.js +7 -49
  8. package/build/cjs/integrations/node-fetch/index.js.map +1 -1
  9. package/build/cjs/integrations/node-fetch/undici-instrumentation.js +266 -0
  10. package/build/cjs/integrations/node-fetch/undici-instrumentation.js.map +1 -0
  11. package/build/cjs/integrations/tracing/amqplib/index.js +2 -10
  12. package/build/cjs/integrations/tracing/amqplib/index.js.map +1 -1
  13. package/build/cjs/integrations/tracing/amqplib/vendored/instrumentation.js +117 -0
  14. package/build/cjs/integrations/tracing/amqplib/vendored/instrumentation.js.map +1 -0
  15. package/build/cjs/integrations/tracing/amqplib/vendored/patches.js +185 -0
  16. package/build/cjs/integrations/tracing/amqplib/vendored/patches.js.map +1 -0
  17. package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js +21 -1
  18. package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
  19. package/build/cjs/integrations/tracing/amqplib/vendored/types.js +0 -6
  20. package/build/cjs/integrations/tracing/amqplib/vendored/types.js.map +1 -1
  21. package/build/cjs/integrations/tracing/amqplib/vendored/utils.js +71 -80
  22. package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
  23. package/build/cjs/integrations/tracing/connect/index.js.map +1 -1
  24. package/build/cjs/integrations/tracing/dataloader/index.js.map +1 -1
  25. package/build/cjs/integrations/tracing/express.js.map +1 -1
  26. package/build/cjs/integrations/tracing/fastify/index.js +7 -103
  27. package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
  28. package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +2 -3
  29. package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
  30. package/build/cjs/integrations/tracing/firebase/firebase.js +1 -24
  31. package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -1
  32. package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js +3 -11
  33. package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
  34. package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js +33 -72
  35. package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
  36. package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js +46 -105
  37. package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js.map +1 -1
  38. package/build/cjs/integrations/tracing/genericPool/index.js.map +1 -1
  39. package/build/cjs/integrations/tracing/graphql/index.js.map +1 -1
  40. package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
  41. package/build/cjs/integrations/tracing/hono/index.js.map +1 -1
  42. package/build/cjs/integrations/tracing/index.js +0 -1
  43. package/build/cjs/integrations/tracing/index.js.map +1 -1
  44. package/build/cjs/integrations/tracing/kafka/index.js.map +1 -1
  45. package/build/cjs/integrations/tracing/knex/index.js.map +1 -1
  46. package/build/cjs/integrations/tracing/koa/index.js.map +1 -1
  47. package/build/cjs/integrations/tracing/lrumemoizer/index.js.map +1 -1
  48. package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js +4 -2
  49. package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
  50. package/build/cjs/integrations/tracing/mongo/index.js.map +1 -1
  51. package/build/cjs/integrations/tracing/mongoose/index.js.map +1 -1
  52. package/build/cjs/integrations/tracing/mysql/index.js.map +1 -1
  53. package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js +34 -128
  54. package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
  55. package/build/cjs/integrations/tracing/mysql/vendored/semconv.js +0 -2
  56. package/build/cjs/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
  57. package/build/cjs/integrations/tracing/mysql/vendored/utils.js +2 -27
  58. package/build/cjs/integrations/tracing/mysql/vendored/utils.js.map +1 -1
  59. package/build/cjs/integrations/tracing/mysql2/index.js.map +1 -1
  60. package/build/cjs/integrations/tracing/postgres/index.js.map +1 -1
  61. package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
  62. package/build/cjs/integrations/tracing/prisma/index.js +1 -10
  63. package/build/cjs/integrations/tracing/prisma/index.js.map +1 -1
  64. package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js +83 -57
  65. package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
  66. package/build/cjs/integrations/tracing/prisma/vendored/constants.js.map +1 -1
  67. package/build/cjs/integrations/tracing/prisma/vendored/global.js +2 -2
  68. package/build/cjs/integrations/tracing/prisma/vendored/global.js.map +1 -1
  69. package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js +1 -6
  70. package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
  71. package/build/cjs/integrations/tracing/redis/index.js +5 -3
  72. package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
  73. package/build/cjs/integrations/tracing/tedious/index.js.map +1 -1
  74. package/build/cjs/integrations/tracing/vercelai/constants.js.map +1 -1
  75. package/build/cjs/integrations/tracing/vercelai/index.js +4 -3
  76. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
  77. package/build/cjs/sdk/diagnosticsChannelInjection.js.map +1 -1
  78. package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js +8 -6
  79. package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -1
  80. package/build/esm/integrations/featureFlagShims/launchDarkly.js.map +1 -1
  81. package/build/esm/integrations/featureFlagShims/openFeature.js.map +1 -1
  82. package/build/esm/integrations/featureFlagShims/statsig.js.map +1 -1
  83. package/build/esm/integrations/featureFlagShims/unleash.js.map +1 -1
  84. package/build/esm/integrations/fs/index.js.map +1 -1
  85. package/build/esm/integrations/http.js.map +1 -1
  86. package/build/esm/integrations/node-fetch/index.js +9 -50
  87. package/build/esm/integrations/node-fetch/index.js.map +1 -1
  88. package/build/esm/integrations/node-fetch/undici-instrumentation.js +264 -0
  89. package/build/esm/integrations/node-fetch/undici-instrumentation.js.map +1 -0
  90. package/build/esm/integrations/tracing/amqplib/index.js +3 -11
  91. package/build/esm/integrations/tracing/amqplib/index.js.map +1 -1
  92. package/build/esm/integrations/tracing/amqplib/vendored/instrumentation.js +115 -0
  93. package/build/esm/integrations/tracing/amqplib/vendored/instrumentation.js.map +1 -0
  94. package/build/esm/integrations/tracing/amqplib/vendored/patches.js +177 -0
  95. package/build/esm/integrations/tracing/amqplib/vendored/patches.js.map +1 -0
  96. package/build/esm/integrations/tracing/amqplib/vendored/semconv.js +12 -2
  97. package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
  98. package/build/esm/integrations/tracing/amqplib/vendored/types.js +1 -6
  99. package/build/esm/integrations/tracing/amqplib/vendored/types.js.map +1 -1
  100. package/build/esm/integrations/tracing/amqplib/vendored/utils.js +68 -78
  101. package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
  102. package/build/esm/integrations/tracing/connect/index.js.map +1 -1
  103. package/build/esm/integrations/tracing/dataloader/index.js.map +1 -1
  104. package/build/esm/integrations/tracing/express.js.map +1 -1
  105. package/build/esm/integrations/tracing/fastify/index.js +8 -103
  106. package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
  107. package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +3 -4
  108. package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
  109. package/build/esm/integrations/tracing/firebase/firebase.js +3 -26
  110. package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -1
  111. package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js +3 -11
  112. package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
  113. package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js +34 -73
  114. package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
  115. package/build/esm/integrations/tracing/firebase/otel/patches/functions.js +47 -106
  116. package/build/esm/integrations/tracing/firebase/otel/patches/functions.js.map +1 -1
  117. package/build/esm/integrations/tracing/genericPool/index.js.map +1 -1
  118. package/build/esm/integrations/tracing/graphql/index.js.map +1 -1
  119. package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
  120. package/build/esm/integrations/tracing/hono/index.js.map +1 -1
  121. package/build/esm/integrations/tracing/index.js +1 -2
  122. package/build/esm/integrations/tracing/index.js.map +1 -1
  123. package/build/esm/integrations/tracing/kafka/index.js.map +1 -1
  124. package/build/esm/integrations/tracing/knex/index.js.map +1 -1
  125. package/build/esm/integrations/tracing/koa/index.js.map +1 -1
  126. package/build/esm/integrations/tracing/lrumemoizer/index.js.map +1 -1
  127. package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js +5 -3
  128. package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
  129. package/build/esm/integrations/tracing/mongo/index.js.map +1 -1
  130. package/build/esm/integrations/tracing/mongoose/index.js.map +1 -1
  131. package/build/esm/integrations/tracing/mysql/index.js.map +1 -1
  132. package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js +37 -131
  133. package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
  134. package/build/esm/integrations/tracing/mysql/vendored/semconv.js +1 -2
  135. package/build/esm/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
  136. package/build/esm/integrations/tracing/mysql/vendored/utils.js +3 -25
  137. package/build/esm/integrations/tracing/mysql/vendored/utils.js.map +1 -1
  138. package/build/esm/integrations/tracing/mysql2/index.js.map +1 -1
  139. package/build/esm/integrations/tracing/postgres/index.js.map +1 -1
  140. package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
  141. package/build/esm/integrations/tracing/prisma/index.js +2 -11
  142. package/build/esm/integrations/tracing/prisma/index.js.map +1 -1
  143. package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js +83 -57
  144. package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
  145. package/build/esm/integrations/tracing/prisma/vendored/constants.js.map +1 -1
  146. package/build/esm/integrations/tracing/prisma/vendored/global.js +2 -2
  147. package/build/esm/integrations/tracing/prisma/vendored/global.js.map +1 -1
  148. package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js +1 -6
  149. package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
  150. package/build/esm/integrations/tracing/redis/index.js +7 -5
  151. package/build/esm/integrations/tracing/redis/index.js.map +1 -1
  152. package/build/esm/integrations/tracing/tedious/index.js.map +1 -1
  153. package/build/esm/integrations/tracing/vercelai/constants.js.map +1 -1
  154. package/build/esm/integrations/tracing/vercelai/index.js +5 -4
  155. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
  156. package/build/esm/package.json +1 -1
  157. package/build/esm/sdk/diagnosticsChannelInjection.js.map +1 -1
  158. package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js +9 -7
  159. package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -1
  160. package/build/types/integrations/featureFlagShims/launchDarkly.d.ts +3 -1
  161. package/build/types/integrations/featureFlagShims/launchDarkly.d.ts.map +1 -1
  162. package/build/types/integrations/featureFlagShims/openFeature.d.ts +3 -1
  163. package/build/types/integrations/featureFlagShims/openFeature.d.ts.map +1 -1
  164. package/build/types/integrations/featureFlagShims/statsig.d.ts +3 -1
  165. package/build/types/integrations/featureFlagShims/statsig.d.ts.map +1 -1
  166. package/build/types/integrations/featureFlagShims/unleash.d.ts +3 -1
  167. package/build/types/integrations/featureFlagShims/unleash.d.ts.map +1 -1
  168. package/build/types/integrations/fs/index.d.ts +3 -1
  169. package/build/types/integrations/fs/index.d.ts.map +1 -1
  170. package/build/types/integrations/http.d.ts +3 -1
  171. package/build/types/integrations/http.d.ts.map +1 -1
  172. package/build/types/integrations/node-fetch/index.d.ts +4 -35
  173. package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
  174. package/build/types/integrations/node-fetch/types.d.ts +96 -0
  175. package/build/types/integrations/node-fetch/types.d.ts.map +1 -0
  176. package/build/types/integrations/node-fetch/undici-instrumentation.d.ts +14 -0
  177. package/build/types/integrations/node-fetch/undici-instrumentation.d.ts.map +1 -0
  178. package/build/types/integrations/tracing/amqplib/index.d.ts +4 -2
  179. package/build/types/integrations/tracing/amqplib/index.d.ts.map +1 -1
  180. package/build/types/integrations/tracing/amqplib/vendored/instrumentation.d.ts +11 -0
  181. package/build/types/integrations/tracing/amqplib/vendored/instrumentation.d.ts.map +1 -0
  182. package/build/types/integrations/tracing/amqplib/vendored/patches.d.ts +11 -0
  183. package/build/types/integrations/tracing/amqplib/vendored/patches.d.ts.map +1 -0
  184. package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts +25 -37
  185. package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -1
  186. package/build/types/integrations/tracing/amqplib/vendored/types.d.ts +0 -81
  187. package/build/types/integrations/tracing/amqplib/vendored/types.d.ts.map +1 -1
  188. package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts +16 -9
  189. package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -1
  190. package/build/types/integrations/tracing/anthropic-ai/index.d.ts +3 -1
  191. package/build/types/integrations/tracing/anthropic-ai/index.d.ts.map +1 -1
  192. package/build/types/integrations/tracing/connect/index.d.ts +3 -1
  193. package/build/types/integrations/tracing/connect/index.d.ts.map +1 -1
  194. package/build/types/integrations/tracing/dataloader/index.d.ts +3 -1
  195. package/build/types/integrations/tracing/dataloader/index.d.ts.map +1 -1
  196. package/build/types/integrations/tracing/express.d.ts +3 -1
  197. package/build/types/integrations/tracing/express.d.ts.map +1 -1
  198. package/build/types/integrations/tracing/fastify/index.d.ts +6 -6
  199. package/build/types/integrations/tracing/fastify/index.d.ts.map +1 -1
  200. package/build/types/integrations/tracing/fastify/v3/instrumentation.d.ts.map +1 -1
  201. package/build/types/integrations/tracing/firebase/firebase.d.ts +3 -1
  202. package/build/types/integrations/tracing/firebase/firebase.d.ts.map +1 -1
  203. package/build/types/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts +4 -9
  204. package/build/types/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts.map +1 -1
  205. package/build/types/integrations/tracing/firebase/otel/patches/firestore.d.ts +2 -5
  206. package/build/types/integrations/tracing/firebase/otel/patches/firestore.d.ts.map +1 -1
  207. package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts +3 -8
  208. package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts.map +1 -1
  209. package/build/types/integrations/tracing/firebase/otel/types.d.ts +0 -20
  210. package/build/types/integrations/tracing/firebase/otel/types.d.ts.map +1 -1
  211. package/build/types/integrations/tracing/genericPool/index.d.ts +3 -1
  212. package/build/types/integrations/tracing/genericPool/index.d.ts.map +1 -1
  213. package/build/types/integrations/tracing/google-genai/index.d.ts +3 -1
  214. package/build/types/integrations/tracing/google-genai/index.d.ts.map +1 -1
  215. package/build/types/integrations/tracing/graphql/index.d.ts +3 -1
  216. package/build/types/integrations/tracing/graphql/index.d.ts.map +1 -1
  217. package/build/types/integrations/tracing/hapi/index.d.ts +3 -1
  218. package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
  219. package/build/types/integrations/tracing/hono/index.d.ts +3 -1
  220. package/build/types/integrations/tracing/hono/index.d.ts.map +1 -1
  221. package/build/types/integrations/tracing/index.d.ts.map +1 -1
  222. package/build/types/integrations/tracing/kafka/index.d.ts +3 -1
  223. package/build/types/integrations/tracing/kafka/index.d.ts.map +1 -1
  224. package/build/types/integrations/tracing/knex/index.d.ts +3 -1
  225. package/build/types/integrations/tracing/knex/index.d.ts.map +1 -1
  226. package/build/types/integrations/tracing/koa/index.d.ts +3 -1
  227. package/build/types/integrations/tracing/koa/index.d.ts.map +1 -1
  228. package/build/types/integrations/tracing/langchain/index.d.ts +3 -1
  229. package/build/types/integrations/tracing/langchain/index.d.ts.map +1 -1
  230. package/build/types/integrations/tracing/langgraph/index.d.ts +3 -1
  231. package/build/types/integrations/tracing/langgraph/index.d.ts.map +1 -1
  232. package/build/types/integrations/tracing/lrumemoizer/index.d.ts +3 -1
  233. package/build/types/integrations/tracing/lrumemoizer/index.d.ts.map +1 -1
  234. package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts.map +1 -1
  235. package/build/types/integrations/tracing/mongo/index.d.ts +3 -1
  236. package/build/types/integrations/tracing/mongo/index.d.ts.map +1 -1
  237. package/build/types/integrations/tracing/mongoose/index.d.ts +3 -1
  238. package/build/types/integrations/tracing/mongoose/index.d.ts.map +1 -1
  239. package/build/types/integrations/tracing/mysql/index.d.ts +3 -1
  240. package/build/types/integrations/tracing/mysql/index.d.ts.map +1 -1
  241. package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts +3 -17
  242. package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts.map +1 -1
  243. package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts +16 -16
  244. package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts.map +1 -1
  245. package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts +0 -8
  246. package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts.map +1 -1
  247. package/build/types/integrations/tracing/mysql/vendored/utils.d.ts +6 -9
  248. package/build/types/integrations/tracing/mysql/vendored/utils.d.ts.map +1 -1
  249. package/build/types/integrations/tracing/mysql2/index.d.ts +3 -1
  250. package/build/types/integrations/tracing/mysql2/index.d.ts.map +1 -1
  251. package/build/types/integrations/tracing/openai/index.d.ts +3 -1
  252. package/build/types/integrations/tracing/openai/index.d.ts.map +1 -1
  253. package/build/types/integrations/tracing/postgres/index.d.ts +3 -1
  254. package/build/types/integrations/tracing/postgres/index.d.ts.map +1 -1
  255. package/build/types/integrations/tracing/postgresjs.d.ts +3 -1
  256. package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
  257. package/build/types/integrations/tracing/prisma/index.d.ts +5 -21
  258. package/build/types/integrations/tracing/prisma/index.d.ts.map +1 -1
  259. package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts +5 -7
  260. package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts.map +1 -1
  261. package/build/types/integrations/tracing/prisma/vendored/constants.d.ts.map +1 -1
  262. package/build/types/integrations/tracing/prisma/vendored/global.d.ts.map +1 -1
  263. package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts +2 -4
  264. package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts.map +1 -1
  265. package/build/types/integrations/tracing/prisma/vendored/types.d.ts +5 -23
  266. package/build/types/integrations/tracing/prisma/vendored/types.d.ts.map +1 -1
  267. package/build/types/integrations/tracing/redis/index.d.ts +4 -2
  268. package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
  269. package/build/types/integrations/tracing/tedious/index.d.ts +3 -1
  270. package/build/types/integrations/tracing/tedious/index.d.ts.map +1 -1
  271. package/build/types/integrations/tracing/vercelai/constants.d.ts +1 -1
  272. package/build/types/integrations/tracing/vercelai/constants.d.ts.map +1 -1
  273. package/build/types/integrations/tracing/vercelai/index.d.ts +3 -2
  274. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
  275. package/build/types/sdk/diagnosticsChannelInjection.d.ts +1 -1
  276. package/build/types/sdk/diagnosticsChannelInjection.d.ts.map +1 -1
  277. package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts.map +1 -1
  278. package/build/types-ts3.8/integrations/featureFlagShims/launchDarkly.d.ts +3 -1
  279. package/build/types-ts3.8/integrations/featureFlagShims/openFeature.d.ts +3 -1
  280. package/build/types-ts3.8/integrations/featureFlagShims/statsig.d.ts +3 -1
  281. package/build/types-ts3.8/integrations/featureFlagShims/unleash.d.ts +3 -1
  282. package/build/types-ts3.8/integrations/fs/index.d.ts +3 -1
  283. package/build/types-ts3.8/integrations/http.d.ts +3 -1
  284. package/build/types-ts3.8/integrations/node-fetch/index.d.ts +4 -35
  285. package/build/types-ts3.8/integrations/node-fetch/types.d.ts +96 -0
  286. package/build/types-ts3.8/integrations/node-fetch/undici-instrumentation.d.ts +14 -0
  287. package/build/types-ts3.8/integrations/tracing/amqplib/index.d.ts +4 -2
  288. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/instrumentation.d.ts +11 -0
  289. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/patches.d.ts +11 -0
  290. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/semconv.d.ts +25 -37
  291. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/types.d.ts +0 -81
  292. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/utils.d.ts +16 -9
  293. package/build/types-ts3.8/integrations/tracing/anthropic-ai/index.d.ts +3 -1
  294. package/build/types-ts3.8/integrations/tracing/connect/index.d.ts +3 -1
  295. package/build/types-ts3.8/integrations/tracing/dataloader/index.d.ts +3 -1
  296. package/build/types-ts3.8/integrations/tracing/express.d.ts +3 -1
  297. package/build/types-ts3.8/integrations/tracing/fastify/index.d.ts +6 -6
  298. package/build/types-ts3.8/integrations/tracing/firebase/firebase.d.ts +3 -1
  299. package/build/types-ts3.8/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts +4 -9
  300. package/build/types-ts3.8/integrations/tracing/firebase/otel/patches/firestore.d.ts +2 -5
  301. package/build/types-ts3.8/integrations/tracing/firebase/otel/patches/functions.d.ts +3 -8
  302. package/build/types-ts3.8/integrations/tracing/firebase/otel/types.d.ts +0 -20
  303. package/build/types-ts3.8/integrations/tracing/genericPool/index.d.ts +3 -1
  304. package/build/types-ts3.8/integrations/tracing/google-genai/index.d.ts +3 -1
  305. package/build/types-ts3.8/integrations/tracing/graphql/index.d.ts +3 -1
  306. package/build/types-ts3.8/integrations/tracing/hapi/index.d.ts +3 -1
  307. package/build/types-ts3.8/integrations/tracing/hono/index.d.ts +3 -1
  308. package/build/types-ts3.8/integrations/tracing/kafka/index.d.ts +3 -1
  309. package/build/types-ts3.8/integrations/tracing/knex/index.d.ts +3 -1
  310. package/build/types-ts3.8/integrations/tracing/koa/index.d.ts +3 -1
  311. package/build/types-ts3.8/integrations/tracing/langchain/index.d.ts +3 -1
  312. package/build/types-ts3.8/integrations/tracing/langgraph/index.d.ts +3 -1
  313. package/build/types-ts3.8/integrations/tracing/lrumemoizer/index.d.ts +3 -1
  314. package/build/types-ts3.8/integrations/tracing/mongo/index.d.ts +3 -1
  315. package/build/types-ts3.8/integrations/tracing/mongoose/index.d.ts +3 -1
  316. package/build/types-ts3.8/integrations/tracing/mysql/index.d.ts +3 -1
  317. package/build/types-ts3.8/integrations/tracing/mysql/vendored/instrumentation.d.ts +3 -17
  318. package/build/types-ts3.8/integrations/tracing/mysql/vendored/mysql-types.d.ts +16 -16
  319. package/build/types-ts3.8/integrations/tracing/mysql/vendored/semconv.d.ts +0 -8
  320. package/build/types-ts3.8/integrations/tracing/mysql/vendored/utils.d.ts +6 -9
  321. package/build/types-ts3.8/integrations/tracing/mysql2/index.d.ts +3 -1
  322. package/build/types-ts3.8/integrations/tracing/openai/index.d.ts +3 -1
  323. package/build/types-ts3.8/integrations/tracing/postgres/index.d.ts +3 -1
  324. package/build/types-ts3.8/integrations/tracing/postgresjs.d.ts +3 -1
  325. package/build/types-ts3.8/integrations/tracing/prisma/index.d.ts +5 -21
  326. package/build/types-ts3.8/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts +5 -7
  327. package/build/types-ts3.8/integrations/tracing/prisma/vendored/instrumentation.d.ts +2 -4
  328. package/build/types-ts3.8/integrations/tracing/prisma/vendored/types.d.ts +5 -23
  329. package/build/types-ts3.8/integrations/tracing/redis/index.d.ts +4 -2
  330. package/build/types-ts3.8/integrations/tracing/tedious/index.d.ts +3 -1
  331. package/build/types-ts3.8/integrations/tracing/vercelai/constants.d.ts +1 -1
  332. package/build/types-ts3.8/integrations/tracing/vercelai/index.d.ts +3 -2
  333. package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +1 -1
  334. package/package.json +6 -5
  335. package/build/cjs/integrations/node-fetch/vendored/semconv.js +0 -28
  336. package/build/cjs/integrations/node-fetch/vendored/semconv.js.map +0 -1
  337. package/build/cjs/integrations/node-fetch/vendored/undici.js +0 -302
  338. package/build/cjs/integrations/node-fetch/vendored/undici.js.map +0 -1
  339. package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js +0 -452
  340. package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js.map +0 -1
  341. package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.js +0 -24
  342. package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +0 -1
  343. package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js +0 -387
  344. package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js.map +0 -1
  345. package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js +0 -9
  346. package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js.map +0 -1
  347. package/build/esm/integrations/node-fetch/vendored/semconv.js +0 -15
  348. package/build/esm/integrations/node-fetch/vendored/semconv.js.map +0 -1
  349. package/build/esm/integrations/node-fetch/vendored/undici.js +0 -300
  350. package/build/esm/integrations/node-fetch/vendored/undici.js.map +0 -1
  351. package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js +0 -450
  352. package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js.map +0 -1
  353. package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.js +0 -13
  354. package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +0 -1
  355. package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js +0 -385
  356. package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js.map +0 -1
  357. package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js +0 -7
  358. package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js.map +0 -1
  359. package/build/types/integrations/node-fetch/vendored/internal-types.d.ts +0 -25
  360. package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +0 -1
  361. package/build/types/integrations/node-fetch/vendored/semconv.d.ts +0 -13
  362. package/build/types/integrations/node-fetch/vendored/semconv.d.ts.map +0 -1
  363. package/build/types/integrations/node-fetch/vendored/types.d.ts +0 -60
  364. package/build/types/integrations/node-fetch/vendored/types.d.ts.map +0 -1
  365. package/build/types/integrations/node-fetch/vendored/undici.d.ts +0 -21
  366. package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +0 -1
  367. package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts +0 -26
  368. package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts.map +0 -1
  369. package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts +0 -63
  370. package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts.map +0 -1
  371. package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts +0 -27
  372. package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts.map +0 -1
  373. package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts +0 -4
  374. package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts.map +0 -1
  375. package/build/types/integrations/tracing/mysql/vendored/types.d.ts +0 -9
  376. package/build/types/integrations/tracing/mysql/vendored/types.d.ts.map +0 -1
  377. package/build/types-ts3.8/integrations/node-fetch/vendored/internal-types.d.ts +0 -25
  378. package/build/types-ts3.8/integrations/node-fetch/vendored/semconv.d.ts +0 -13
  379. package/build/types-ts3.8/integrations/node-fetch/vendored/types.d.ts +0 -60
  380. package/build/types-ts3.8/integrations/node-fetch/vendored/undici.d.ts +0 -21
  381. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/amqplib.d.ts +0 -26
  382. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts +0 -63
  383. package/build/types-ts3.8/integrations/tracing/fastify/vendored/instrumentation.d.ts +0 -27
  384. package/build/types-ts3.8/integrations/tracing/mysql/vendored/AttributeNames.d.ts +0 -4
  385. package/build/types-ts3.8/integrations/tracing/mysql/vendored/types.d.ts +0 -9
@@ -1,18 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const api = require('@opentelemetry/api');
4
- const instrumentation = require('@opentelemetry/instrumentation');
5
- const semanticConventions = require('@opentelemetry/semantic-conventions');
4
+ const core = require('@sentry/core');
6
5
  const semconv = require('./semconv.js');
7
- const semconvObsolete = require('./semconv-obsolete.js');
8
6
 
7
+ const PUBLISHER_ORIGIN = "auto.amqplib.otel.publisher";
8
+ const CONSUMER_ORIGIN = "auto.amqplib.otel.consumer";
9
9
  const MESSAGE_STORED_SPAN = /* @__PURE__ */ Symbol("opentelemetry.amqplib.message.stored-span");
10
10
  const CHANNEL_SPANS_NOT_ENDED = /* @__PURE__ */ Symbol("opentelemetry.amqplib.channel.spans-not-ended");
11
11
  const CHANNEL_CONSUME_TIMEOUT_TIMER = /* @__PURE__ */ Symbol(
12
12
  "opentelemetry.amqplib.channel.consumer-timeout-timer"
13
13
  );
14
14
  const CONNECTION_ATTRIBUTES = /* @__PURE__ */ Symbol("opentelemetry.amqplib.connection.attributes");
15
- const IS_CONFIRM_CHANNEL_CONTEXT_KEY = api.createContextKey("opentelemetry.amqplib.channel.is-confirm-channel");
15
+ const CHANNEL_IS_CONFIRM_PUBLISHING = /* @__PURE__ */ Symbol("sentry.amqplib.channel.is-confirm-publishing");
16
16
  const normalizeExchange = (exchangeName) => exchangeName !== "" ? exchangeName : "<default>";
17
17
  const censorPassword = (url) => {
18
18
  return url.replace(/:[^:@/]*@/, ":***@");
@@ -28,16 +28,6 @@ const getProtocol = (protocolFromUrl) => {
28
28
  const getHostname = (hostnameFromUrl) => {
29
29
  return hostnameFromUrl || "localhost";
30
30
  };
31
- const extractConnectionAttributeOrLog = (url, attributeKey, attributeValue, nameForLog) => {
32
- if (attributeValue) {
33
- return { [attributeKey]: attributeValue };
34
- } else {
35
- api.diag.error(`amqplib instrumentation: could not extract connection attribute ${nameForLog} from user supplied url`, {
36
- url
37
- });
38
- return {};
39
- }
40
- };
41
31
  const getConnectionAttributesFromServer = (conn) => {
42
32
  const product = conn.serverProperties.product?.toLowerCase?.();
43
33
  if (product) {
@@ -48,90 +38,91 @@ const getConnectionAttributesFromServer = (conn) => {
48
38
  return {};
49
39
  }
50
40
  };
51
- const getConnectionAttributesFromUrl = (url, netSemconvStability) => {
41
+ const getConnectionAttributesFromUrl = (url) => {
52
42
  const attributes = {
53
- [semconvObsolete.ATTR_MESSAGING_PROTOCOL_VERSION]: "0.9.1"
43
+ [semconv.ATTR_MESSAGING_PROTOCOL_VERSION]: "0.9.1"
54
44
  // this is the only protocol supported by the instrumented library
55
45
  };
56
- url = url || "amqp://localhost";
57
- if (typeof url === "object") {
58
- const connectOptions = url;
46
+ const resolvedUrl = url || "amqp://localhost";
47
+ if (typeof resolvedUrl === "object") {
48
+ const connectOptions = resolvedUrl;
59
49
  const protocol = getProtocol(connectOptions?.protocol);
60
- Object.assign(attributes, {
61
- ...extractConnectionAttributeOrLog(url, semconvObsolete.ATTR_MESSAGING_PROTOCOL, protocol, "protocol")
62
- });
63
- const hostname = getHostname(connectOptions?.hostname);
64
- if (netSemconvStability & instrumentation.SemconvStability.OLD) {
65
- Object.assign(attributes, {
66
- ...extractConnectionAttributeOrLog(url, semconv.ATTR_NET_PEER_NAME, hostname, "hostname")
67
- });
68
- }
69
- if (netSemconvStability & instrumentation.SemconvStability.STABLE) {
70
- Object.assign(attributes, {
71
- ...extractConnectionAttributeOrLog(url, semanticConventions.ATTR_SERVER_ADDRESS, hostname, "hostname")
72
- });
73
- }
74
- const port = getPort(connectOptions.port, protocol);
75
- if (netSemconvStability & instrumentation.SemconvStability.OLD) {
76
- Object.assign(attributes, extractConnectionAttributeOrLog(url, semconv.ATTR_NET_PEER_PORT, port, "port"));
77
- }
78
- if (netSemconvStability & instrumentation.SemconvStability.STABLE) {
79
- Object.assign(attributes, extractConnectionAttributeOrLog(url, semanticConventions.ATTR_SERVER_PORT, port, "port"));
80
- }
50
+ attributes[semconv.ATTR_MESSAGING_PROTOCOL] = protocol;
51
+ attributes[semconv.ATTR_NET_PEER_NAME] = getHostname(connectOptions?.hostname);
52
+ attributes[semconv.ATTR_NET_PEER_PORT] = getPort(connectOptions.port, protocol);
81
53
  } else {
82
- const censoredUrl = censorPassword(url);
83
- attributes[semconvObsolete.ATTR_MESSAGING_URL] = censoredUrl;
54
+ const censoredUrl = censorPassword(resolvedUrl);
55
+ attributes[semconv.ATTR_MESSAGING_URL] = censoredUrl;
84
56
  try {
85
57
  const urlParts = new URL(censoredUrl);
86
58
  const protocol = getProtocol(urlParts.protocol);
87
- Object.assign(attributes, {
88
- ...extractConnectionAttributeOrLog(censoredUrl, semconvObsolete.ATTR_MESSAGING_PROTOCOL, protocol, "protocol")
89
- });
90
- const hostname = getHostname(urlParts.hostname);
91
- if (netSemconvStability & instrumentation.SemconvStability.OLD) {
92
- Object.assign(attributes, {
93
- ...extractConnectionAttributeOrLog(censoredUrl, semconv.ATTR_NET_PEER_NAME, hostname, "hostname")
94
- });
95
- }
96
- if (netSemconvStability & instrumentation.SemconvStability.STABLE) {
97
- Object.assign(attributes, {
98
- ...extractConnectionAttributeOrLog(censoredUrl, semanticConventions.ATTR_SERVER_ADDRESS, hostname, "hostname")
99
- });
100
- }
101
- const port = getPort(urlParts.port ? parseInt(urlParts.port) : void 0, protocol);
102
- if (netSemconvStability & instrumentation.SemconvStability.OLD) {
103
- Object.assign(attributes, extractConnectionAttributeOrLog(censoredUrl, semconv.ATTR_NET_PEER_PORT, port, "port"));
104
- }
105
- if (netSemconvStability & instrumentation.SemconvStability.STABLE) {
106
- Object.assign(attributes, extractConnectionAttributeOrLog(censoredUrl, semanticConventions.ATTR_SERVER_PORT, port, "port"));
107
- }
108
- } catch (err) {
109
- api.diag.error("amqplib instrumentation: error while extracting connection details from connection url", {
110
- censoredUrl,
111
- err
112
- });
59
+ attributes[semconv.ATTR_MESSAGING_PROTOCOL] = protocol;
60
+ attributes[semconv.ATTR_NET_PEER_NAME] = getHostname(urlParts.hostname);
61
+ attributes[semconv.ATTR_NET_PEER_PORT] = getPort(urlParts.port ? parseInt(urlParts.port) : void 0, protocol);
62
+ } catch {
113
63
  }
114
64
  }
115
65
  return attributes;
116
66
  };
117
- const markConfirmChannelTracing = (context) => {
118
- return context.setValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY, true);
119
- };
120
- const unmarkConfirmChannelTracing = (context) => {
121
- return context.deleteValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY);
122
- };
123
- const isConfirmChannelTracing = (context) => {
124
- return context.getValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY) === true;
125
- };
67
+ function getHeaderAsString(headers, key) {
68
+ const value = headers?.[key];
69
+ if (value == null) {
70
+ return void 0;
71
+ }
72
+ return Array.isArray(value) ? String(value[0]) : String(value);
73
+ }
74
+ function startPublishSpan(exchange, routingKey, channel, options) {
75
+ const normalizedExchange = normalizeExchange(exchange);
76
+ const span = core.startInactiveSpan({
77
+ name: `publish ${normalizedExchange}`,
78
+ kind: api.SpanKind.PRODUCER,
79
+ attributes: {
80
+ ...channel.connection[CONNECTION_ATTRIBUTES],
81
+ [semconv.ATTR_MESSAGING_DESTINATION]: exchange,
82
+ [semconv.ATTR_MESSAGING_DESTINATION_KIND]: semconv.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,
83
+ [semconv.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]: routingKey,
84
+ [semconv.OLD_ATTR_MESSAGING_MESSAGE_ID]: options?.messageId,
85
+ [semconv.ATTR_MESSAGING_CONVERSATION_ID]: options?.correlationId,
86
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PUBLISHER_ORIGIN
87
+ }
88
+ });
89
+ const modifiedOptions = options ?? {};
90
+ modifiedOptions.headers = modifiedOptions.headers ?? {};
91
+ const traceData = core.getTraceData({ span });
92
+ if (traceData["sentry-trace"]) {
93
+ modifiedOptions.headers["sentry-trace"] = traceData["sentry-trace"];
94
+ }
95
+ if (traceData.baggage) {
96
+ modifiedOptions.headers["baggage"] = traceData.baggage;
97
+ }
98
+ return { span, modifiedOptions };
99
+ }
100
+ function startConsumeSpan(queue, msg, channel) {
101
+ return core.startInactiveSpan({
102
+ name: `${queue} process`,
103
+ kind: api.SpanKind.CONSUMER,
104
+ attributes: {
105
+ ...channel?.connection?.[CONNECTION_ATTRIBUTES],
106
+ [semconv.ATTR_MESSAGING_DESTINATION]: msg.fields?.exchange,
107
+ [semconv.ATTR_MESSAGING_DESTINATION_KIND]: semconv.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,
108
+ [semconv.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]: msg.fields?.routingKey,
109
+ [semconv.ATTR_MESSAGING_OPERATION]: semconv.MESSAGING_OPERATION_VALUE_PROCESS,
110
+ [semconv.OLD_ATTR_MESSAGING_MESSAGE_ID]: msg?.properties.messageId,
111
+ [semconv.ATTR_MESSAGING_CONVERSATION_ID]: msg?.properties.correlationId,
112
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN
113
+ }
114
+ });
115
+ }
126
116
 
127
117
  exports.CHANNEL_CONSUME_TIMEOUT_TIMER = CHANNEL_CONSUME_TIMEOUT_TIMER;
118
+ exports.CHANNEL_IS_CONFIRM_PUBLISHING = CHANNEL_IS_CONFIRM_PUBLISHING;
128
119
  exports.CHANNEL_SPANS_NOT_ENDED = CHANNEL_SPANS_NOT_ENDED;
129
120
  exports.CONNECTION_ATTRIBUTES = CONNECTION_ATTRIBUTES;
130
121
  exports.MESSAGE_STORED_SPAN = MESSAGE_STORED_SPAN;
131
122
  exports.getConnectionAttributesFromServer = getConnectionAttributesFromServer;
132
123
  exports.getConnectionAttributesFromUrl = getConnectionAttributesFromUrl;
133
- exports.isConfirmChannelTracing = isConfirmChannelTracing;
134
- exports.markConfirmChannelTracing = markConfirmChannelTracing;
124
+ exports.getHeaderAsString = getHeaderAsString;
135
125
  exports.normalizeExchange = normalizeExchange;
136
- exports.unmarkConfirmChannelTracing = unmarkConfirmChannelTracing;
126
+ exports.startConsumeSpan = startConsumeSpan;
127
+ exports.startPublishSpan = startPublishSpan;
137
128
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/amqplib/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-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n * - Some types vendored from @types/amqplib with simplifications\n */\n/* eslint-disable */\n\nimport { Context, createContextKey, diag, Span, Attributes, AttributeValue } from '@opentelemetry/api';\nimport { SemconvStability } from '@opentelemetry/instrumentation';\nimport { ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT } from '@opentelemetry/semantic-conventions';\nimport { ATTR_MESSAGING_SYSTEM, ATTR_NET_PEER_NAME, ATTR_NET_PEER_PORT } from './semconv';\nimport { ATTR_MESSAGING_PROTOCOL, ATTR_MESSAGING_PROTOCOL_VERSION, ATTR_MESSAGING_URL } from './semconv-obsolete';\nimport type { Connection, Channel, ConfirmChannel, Options } from './amqplib-types';\nimport type { ConsumeMessage, Message } from './types';\n\nexport const MESSAGE_STORED_SPAN: unique symbol = Symbol('opentelemetry.amqplib.message.stored-span');\nexport const CHANNEL_SPANS_NOT_ENDED: unique symbol = Symbol('opentelemetry.amqplib.channel.spans-not-ended');\nexport const CHANNEL_CONSUME_TIMEOUT_TIMER: unique symbol = Symbol(\n 'opentelemetry.amqplib.channel.consumer-timeout-timer',\n);\nexport const CONNECTION_ATTRIBUTES: unique symbol = Symbol('opentelemetry.amqplib.connection.attributes');\n\nexport type InstrumentationConnection = Connection & {\n [CONNECTION_ATTRIBUTES]?: Attributes;\n};\nexport type InstrumentationPublishChannel = (Channel | ConfirmChannel) & {\n connection: InstrumentationConnection;\n};\nexport type InstrumentationConsumeChannel = Channel & {\n connection: InstrumentationConnection;\n [CHANNEL_SPANS_NOT_ENDED]?: {\n msg: ConsumeMessage;\n timeOfConsume: number;\n }[];\n [CHANNEL_CONSUME_TIMEOUT_TIMER]?: NodeJS.Timeout;\n};\nexport type InstrumentationMessage = Message & {\n [MESSAGE_STORED_SPAN]?: Span;\n};\nexport type InstrumentationConsumeMessage = ConsumeMessage & {\n [MESSAGE_STORED_SPAN]?: Span;\n};\n\nconst IS_CONFIRM_CHANNEL_CONTEXT_KEY: symbol = createContextKey('opentelemetry.amqplib.channel.is-confirm-channel');\n\nexport const normalizeExchange = (exchangeName: string) => (exchangeName !== '' ? exchangeName : '<default>');\n\nconst censorPassword = (url: string): string => {\n return url.replace(/:[^:@/]*@/, ':***@');\n};\n\nconst getPort = (portFromUrl: number | undefined, resolvedProtocol: string): number => {\n // we are using the resolved protocol which is upper case\n // this code mimic the behavior of the amqplib which is used to set connection params\n return portFromUrl || (resolvedProtocol === 'AMQP' ? 5672 : 5671);\n};\n\nconst getProtocol = (protocolFromUrl: string | undefined): string => {\n const resolvedProtocol = protocolFromUrl || 'amqp';\n // the substring removed the ':' part of the protocol ('amqp:' -> 'amqp')\n const noEndingColon = resolvedProtocol.endsWith(':')\n ? resolvedProtocol.substring(0, resolvedProtocol.length - 1)\n : resolvedProtocol;\n // upper cases to match spec\n return noEndingColon.toUpperCase();\n};\n\nconst getHostname = (hostnameFromUrl: string | undefined): string => {\n // if user supplies empty hostname, it gets forwarded to 'net' package which default it to localhost.\n // https://nodejs.org/docs/latest-v12.x/api/net.html#net_socket_connect_options_connectlistener\n return hostnameFromUrl || 'localhost';\n};\n\nconst extractConnectionAttributeOrLog = (\n url: string | Options.Connect,\n attributeKey: string,\n attributeValue: AttributeValue,\n nameForLog: string,\n): Attributes => {\n if (attributeValue) {\n return { [attributeKey]: attributeValue };\n } else {\n diag.error(`amqplib instrumentation: could not extract connection attribute ${nameForLog} from user supplied url`, {\n url,\n });\n return {};\n }\n};\n\nexport const getConnectionAttributesFromServer = (conn: Connection): Attributes => {\n const product = conn.serverProperties.product?.toLowerCase?.();\n if (product) {\n return {\n [ATTR_MESSAGING_SYSTEM]: product,\n };\n } else {\n return {};\n }\n};\n\nexport const getConnectionAttributesFromUrl = (\n url: string | Options.Connect,\n netSemconvStability: SemconvStability,\n): Attributes => {\n const attributes: Attributes = {\n [ATTR_MESSAGING_PROTOCOL_VERSION]: '0.9.1', // this is the only protocol supported by the instrumented library\n };\n\n url = url || 'amqp://localhost';\n if (typeof url === 'object') {\n const connectOptions = url as Options.Connect;\n\n const protocol = getProtocol(connectOptions?.protocol);\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(url, ATTR_MESSAGING_PROTOCOL, protocol, 'protocol'),\n });\n\n const hostname = getHostname(connectOptions?.hostname);\n if (netSemconvStability & SemconvStability.OLD) {\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(url, ATTR_NET_PEER_NAME, hostname, 'hostname'),\n });\n }\n if (netSemconvStability & SemconvStability.STABLE) {\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(url, ATTR_SERVER_ADDRESS, hostname, 'hostname'),\n });\n }\n\n const port = getPort(connectOptions.port, protocol);\n if (netSemconvStability & SemconvStability.OLD) {\n Object.assign(attributes, extractConnectionAttributeOrLog(url, ATTR_NET_PEER_PORT, port, 'port'));\n }\n if (netSemconvStability & SemconvStability.STABLE) {\n Object.assign(attributes, extractConnectionAttributeOrLog(url, ATTR_SERVER_PORT, port, 'port'));\n }\n } else {\n const censoredUrl = censorPassword(url);\n attributes[ATTR_MESSAGING_URL] = censoredUrl;\n try {\n const urlParts = new URL(censoredUrl);\n\n const protocol = getProtocol(urlParts.protocol);\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(censoredUrl, ATTR_MESSAGING_PROTOCOL, protocol, 'protocol'),\n });\n\n const hostname = getHostname(urlParts.hostname);\n if (netSemconvStability & SemconvStability.OLD) {\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(censoredUrl, ATTR_NET_PEER_NAME, hostname, 'hostname'),\n });\n }\n if (netSemconvStability & SemconvStability.STABLE) {\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(censoredUrl, ATTR_SERVER_ADDRESS, hostname, 'hostname'),\n });\n }\n\n const port = getPort(urlParts.port ? parseInt(urlParts.port) : undefined, protocol);\n if (netSemconvStability & SemconvStability.OLD) {\n Object.assign(attributes, extractConnectionAttributeOrLog(censoredUrl, ATTR_NET_PEER_PORT, port, 'port'));\n }\n if (netSemconvStability & SemconvStability.STABLE) {\n Object.assign(attributes, extractConnectionAttributeOrLog(censoredUrl, ATTR_SERVER_PORT, port, 'port'));\n }\n } catch (err) {\n diag.error('amqplib instrumentation: error while extracting connection details from connection url', {\n censoredUrl,\n err,\n });\n }\n }\n return attributes;\n};\n\nexport const markConfirmChannelTracing = (context: Context) => {\n return context.setValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY, true);\n};\n\nexport const unmarkConfirmChannelTracing = (context: Context) => {\n return context.deleteValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY);\n};\n\nexport const isConfirmChannelTracing = (context: Context) => {\n return context.getValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY) === true;\n};\n"],"names":["createContextKey","diag","ATTR_MESSAGING_SYSTEM","ATTR_MESSAGING_PROTOCOL_VERSION","ATTR_MESSAGING_PROTOCOL","SemconvStability","ATTR_NET_PEER_NAME","ATTR_SERVER_ADDR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3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/amqplib/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-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n * - Some types vendored from @types/amqplib with simplifications\n * - Span creation extracted here and migrated to the @sentry/core API; origin folded into span creation\n * - Cross-service trace propagation uses Sentry's `getTraceData` instead of the OTel propagator\n * - Dropped the env-gated stable-semconv dual emission; only the (default) old semantic conventions are emitted\n * - Replaced the OTel context-key confirm-channel marker with a synchronous flag on the channel instance\n */\n\nimport { SpanKind } from '@opentelemetry/api';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport { getTraceData, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core';\nimport type { Channel, ConfirmChannel, Connection, Options } from './amqplib-types';\nimport {\n ATTR_MESSAGING_CONVERSATION_ID,\n ATTR_MESSAGING_DESTINATION,\n ATTR_MESSAGING_DESTINATION_KIND,\n ATTR_MESSAGING_OPERATION,\n ATTR_MESSAGING_PROTOCOL,\n ATTR_MESSAGING_PROTOCOL_VERSION,\n ATTR_MESSAGING_RABBITMQ_ROUTING_KEY,\n ATTR_MESSAGING_SYSTEM,\n ATTR_MESSAGING_URL,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n MESSAGING_DESTINATION_KIND_VALUE_TOPIC,\n MESSAGING_OPERATION_VALUE_PROCESS,\n OLD_ATTR_MESSAGING_MESSAGE_ID,\n} from './semconv';\nimport type { ConsumeMessage, Message } from './types';\n\nconst PUBLISHER_ORIGIN = 'auto.amqplib.otel.publisher';\nconst CONSUMER_ORIGIN = 'auto.amqplib.otel.consumer';\n\nexport const MESSAGE_STORED_SPAN: unique symbol = Symbol('opentelemetry.amqplib.message.stored-span');\nexport const CHANNEL_SPANS_NOT_ENDED: unique symbol = Symbol('opentelemetry.amqplib.channel.spans-not-ended');\nexport const CHANNEL_CONSUME_TIMEOUT_TIMER: unique symbol = Symbol(\n 'opentelemetry.amqplib.channel.consumer-timeout-timer',\n);\nexport const CONNECTION_ATTRIBUTES: unique symbol = Symbol('opentelemetry.amqplib.connection.attributes');\nexport const CHANNEL_IS_CONFIRM_PUBLISHING: unique symbol = Symbol('sentry.amqplib.channel.is-confirm-publishing');\n\nexport type InstrumentationConnection = Connection & {\n [CONNECTION_ATTRIBUTES]?: SpanAttributes;\n};\nexport type InstrumentationPublishChannel = (Channel | ConfirmChannel) & {\n connection: InstrumentationConnection;\n [CHANNEL_IS_CONFIRM_PUBLISHING]?: boolean;\n};\nexport type InstrumentationConsumeChannel = Channel & {\n connection: InstrumentationConnection;\n [CHANNEL_SPANS_NOT_ENDED]?: {\n msg: ConsumeMessage;\n timeOfConsume: number;\n }[];\n [CHANNEL_CONSUME_TIMEOUT_TIMER]?: NodeJS.Timeout;\n};\nexport type InstrumentationMessage = Message & {\n [MESSAGE_STORED_SPAN]?: Span;\n};\nexport type InstrumentationConsumeMessage = ConsumeMessage & {\n [MESSAGE_STORED_SPAN]?: Span;\n};\n\nexport const normalizeExchange = (exchangeName: string): string => (exchangeName !== '' ? exchangeName : '<default>');\n\nconst censorPassword = (url: string): string => {\n return url.replace(/:[^:@/]*@/, ':***@');\n};\n\nconst getPort = (portFromUrl: number | undefined, resolvedProtocol: string): number => {\n // we are using the resolved protocol which is upper case\n // this code mimics the behavior of amqplib which is used to set connection params\n return portFromUrl || (resolvedProtocol === 'AMQP' ? 5672 : 5671);\n};\n\nconst getProtocol = (protocolFromUrl: string | undefined): string => {\n const resolvedProtocol = protocolFromUrl || 'amqp';\n // the substring removes the ':' part of the protocol ('amqp:' -> 'amqp')\n const noEndingColon = resolvedProtocol.endsWith(':')\n ? resolvedProtocol.substring(0, resolvedProtocol.length - 1)\n : resolvedProtocol;\n // upper case to match spec\n return noEndingColon.toUpperCase();\n};\n\nconst getHostname = (hostnameFromUrl: string | undefined): string => {\n // if user supplies empty hostname, it gets forwarded to 'net' package which defaults it to localhost.\n // https://nodejs.org/docs/latest-v12.x/api/net.html#net_socket_connect_options_connectlistener\n return hostnameFromUrl || 'localhost';\n};\n\nexport const getConnectionAttributesFromServer = (conn: Connection): SpanAttributes => {\n const product = conn.serverProperties.product?.toLowerCase?.();\n if (product) {\n return {\n [ATTR_MESSAGING_SYSTEM]: product,\n };\n } else {\n return {};\n }\n};\n\nexport const getConnectionAttributesFromUrl = (url: string | Options.Connect): SpanAttributes => {\n const attributes: SpanAttributes = {\n [ATTR_MESSAGING_PROTOCOL_VERSION]: '0.9.1', // this is the only protocol supported by the instrumented library\n };\n\n const resolvedUrl = url || 'amqp://localhost';\n if (typeof resolvedUrl === 'object') {\n const connectOptions = resolvedUrl;\n\n const protocol = getProtocol(connectOptions?.protocol);\n attributes[ATTR_MESSAGING_PROTOCOL] = protocol;\n attributes[ATTR_NET_PEER_NAME] = getHostname(connectOptions?.hostname);\n attributes[ATTR_NET_PEER_PORT] = getPort(connectOptions.port, protocol);\n } else {\n const censoredUrl = censorPassword(resolvedUrl);\n attributes[ATTR_MESSAGING_URL] = censoredUrl;\n try {\n const urlParts = new URL(censoredUrl);\n\n const protocol = getProtocol(urlParts.protocol);\n attributes[ATTR_MESSAGING_PROTOCOL] = protocol;\n attributes[ATTR_NET_PEER_NAME] = getHostname(urlParts.hostname);\n attributes[ATTR_NET_PEER_PORT] = getPort(urlParts.port ? parseInt(urlParts.port) : undefined, protocol);\n } catch {\n // best-effort: a malformed url simply yields fewer connection attributes\n }\n }\n return attributes;\n};\n\n/** Reads a propagation header value off an amqplib message as a string. */\nexport function getHeaderAsString(headers: Record<string, unknown> | undefined, key: string): string | undefined {\n const value = headers?.[key];\n if (value == null) {\n return undefined;\n }\n return Array.isArray(value) ? String(value[0]) : String(value);\n}\n\n/** Starts an inactive producer span and propagates its trace into the publish `options.headers`. */\nexport function startPublishSpan(\n exchange: string,\n routingKey: string,\n channel: InstrumentationPublishChannel,\n options?: Options.Publish,\n): { span: Span; modifiedOptions: Options.Publish } {\n const normalizedExchange = normalizeExchange(exchange);\n\n const span = startInactiveSpan({\n name: `publish ${normalizedExchange}`,\n kind: SpanKind.PRODUCER,\n attributes: {\n ...channel.connection[CONNECTION_ATTRIBUTES],\n [ATTR_MESSAGING_DESTINATION]: exchange,\n [ATTR_MESSAGING_DESTINATION_KIND]: MESSAGING_DESTINATION_KIND_VALUE_TOPIC,\n [ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]: routingKey,\n [OLD_ATTR_MESSAGING_MESSAGE_ID]: options?.messageId,\n [ATTR_MESSAGING_CONVERSATION_ID]: options?.correlationId,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PUBLISHER_ORIGIN,\n },\n });\n\n const modifiedOptions = options ?? {};\n modifiedOptions.headers = modifiedOptions.headers ?? {};\n\n const traceData = getTraceData({ span });\n if (traceData['sentry-trace']) {\n modifiedOptions.headers['sentry-trace'] = traceData['sentry-trace'];\n }\n if (traceData.baggage) {\n modifiedOptions.headers['baggage'] = traceData.baggage;\n }\n\n return { span, modifiedOptions };\n}\n\n/** Starts an inactive consumer (process) span carrying the amqplib messaging attributes. */\nexport function startConsumeSpan(\n queue: string,\n msg: InstrumentationConsumeMessage,\n channel: InstrumentationConsumeChannel,\n): Span {\n return startInactiveSpan({\n name: `${queue} process`,\n kind: SpanKind.CONSUMER,\n attributes: {\n ...channel?.connection?.[CONNECTION_ATTRIBUTES],\n [ATTR_MESSAGING_DESTINATION]: msg.fields?.exchange,\n [ATTR_MESSAGING_DESTINATION_KIND]: MESSAGING_DESTINATION_KIND_VALUE_TOPIC,\n [ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]: msg.fields?.routingKey,\n [ATTR_MESSAGING_OPERATION]: MESSAGING_OPERATION_VALUE_PROCESS,\n [OLD_ATTR_MESSAGING_MESSAGE_ID]: msg?.properties.messageId,\n [ATTR_MESSAGING_CONVERSATION_ID]: msg?.properties.correlationId,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN,\n },\n });\n}\n"],"names":["ATTR_MESSAGING_SYSTEM","ATTR_MESSAGING_PROTOCOL_VERSION","ATTR_MESSAGING_PROTOCOL","ATTR_NET_PEER_NAME","ATTR_NET_PEER_PORT","ATTR_MESSAGING_URL","startInactiveSpan","SpanKind","ATTR_MESSAGING_DESTINATION","ATTR_MESSAGING_DESTINATION_KIND","MESSAGING_DESTINATION_KIND_VALUE_TOPIC","ATTR_MESSAGING_RABBITMQ_ROUTING_KEY","OLD_ATTR_MESSAGING_MESSAGE_ID","ATTR_MESSAGING_CONVERSATION_ID","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getTraceData","ATTR_MESSAGING_OPERATION","MESSAGING_OPERATION_VALUE_PROCESS"],"mappings":";;;;;;AAoCA,MAAM,gBAAA,GAAmB,6BAAA;AACzB,MAAM,eAAA,GAAkB,4BAAA;AAEjB,MAAM,mBAAA,0BAA4C,2CAA2C;AAC7F,MAAM,uBAAA,0BAAgD,+CAA+C;AACrG,MAAM,6BAAA,mBAA+C,MAAA;AAAA,EAC1D;AACF;AACO,MAAM,qBAAA,0BAA8C,6CAA6C;AACjG,MAAM,6BAAA,0BAAsD,8CAA8C;AAwB1G,MAAM,iBAAA,GAAoB,CAAC,YAAA,KAAkC,YAAA,KAAiB,KAAK,YAAA,GAAe;AAEzG,MAAM,cAAA,GAAiB,CAAC,GAAA,KAAwB;AAC9C,EAAA,OAAO,GAAA,CAAI,OAAA,CAAQ,WAAA,EAAa,OAAO,CAAA;AACzC,CAAA;AAEA,MAAM,OAAA,GAAU,CAAC,WAAA,EAAiC,gBAAA,KAAqC;AAGrF,EAAA,OAAO,WAAA,KAAgB,gBAAA,KAAqB,MAAA,GAAS,IAAA,GAAO,IAAA,CAAA;AAC9D,CAAA;AAEA,MA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;AAAA,MACnD,CAACK,gCAAwB,GAAGC,yCAAA;AAAA,MAC5B,CAACL,qCAA6B,GAAG,GAAA,EAAK,UAAA,CAAW,SAAA;AAAA,MACjD,CAACC,sCAA8B,GAAG,GAAA,EAAK,UAAA,CAAW,aAAA;AAAA,MAClD,CAACC,qCAAgC,GAAG;AAAA;AACtC,GACD,CAAA;AACH;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/connect/index.ts"],"sourcesContent":["import { ConnectInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { captureException, defineIntegration } from '@sentry/core';\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\n\ntype ConnectApp = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n use: (middleware: any) => void;\n};\n\nconst INTEGRATION_NAME = 'Connect';\n\nexport const instrumentConnect = generateInstrumentOnce(INTEGRATION_NAME, () => new ConnectInstrumentation());\n\nconst _connectIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentConnect();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Connect](https://github.com/senchalabs/connect/).\n *\n * If you also want to capture errors, you need to call `setupConnectErrorHandler(app)` after you initialize your connect app.\n *\n * For more information, see the [connect documentation](https://docs.sentry.io/platforms/javascript/guides/connect/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.connectIntegration()],\n * })\n * ```\n */\nexport const connectIntegration = defineIntegration(_connectIntegration);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction connectErrorMiddleware(err: any, req: any, res: any, next: any): void {\n captureException(err, {\n mechanism: {\n handled: false,\n type: 'auto.middleware.connect',\n },\n });\n next(err);\n}\n\n/**\n * Add a Connect middleware to capture errors to Sentry.\n *\n * @param app The Connect app to attach the error handler to\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const connect = require(\"connect\");\n *\n * const app = connect();\n *\n * Sentry.setupConnectErrorHandler(app);\n *\n * // Add you connect routes here\n *\n * app.listen(3000);\n * ```\n */\nexport const setupConnectErrorHandler = (app: ConnectApp): void => {\n app.use(connectErrorMiddleware);\n ensureIsWrapped(app.use, 'connect');\n};\n"],"names":["generateInstrumentOnce","ConnectInstrumentation","defineIntegration","captureException","ensureIsWrapped"],"mappings":";;;;;;AAUA,MAAM,gBAAA,GAAmB,SAAA;AAElB,MAAM,oBAAoBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,wCAAwB;AAE5G,MAAM,uBAAuB,MAAM;AACjC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,iBAAA,EAAkB;AAAA,IACpB;AAAA,GACF;AACF,CAAA,CAAA;AAkBO,MAAM,kBAAA,GAAqBC,uBAAkB,mBAAmB;AAGvE,SAAS,sBAAA,CAAuB,GAAA,EAAU,GAAA,EAAU,GAAA,EAAU,IAAA,EAAiB;AAC7E,EAAAC,qBAAA,CAAiB,GAAA,EAAK;AAAA,IACpB,SAAA,EAAW;AAAA,MACT,OAAA,EAAS,KAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACR,GACD,CAAA;AACD,EAAA,IAAA,CAAK,GAAG,CAAA;AACV;AAqBO,MAAM,wBAAA,GAA2B,CAAC,GAAA,KAA0B;AACjE,EAAA,GAAA,CAAI,IAAI,sBAAsB,CAAA;AAC9B,EAAAC,wBAAA,CAAgB,GAAA,CAAI,KAAK,SAAS,CAAA;AACpC;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/connect/index.ts"],"sourcesContent":["import { ConnectInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { captureException, defineIntegration } from '@sentry/core';\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\n\ntype ConnectApp = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n use: (middleware: any) => void;\n};\n\nconst INTEGRATION_NAME = 'Connect' as const;\n\nexport const instrumentConnect = generateInstrumentOnce(INTEGRATION_NAME, () => new ConnectInstrumentation());\n\nconst _connectIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentConnect();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Connect](https://github.com/senchalabs/connect/).\n *\n * If you also want to capture errors, you need to call `setupConnectErrorHandler(app)` after you initialize your connect app.\n *\n * For more information, see the [connect documentation](https://docs.sentry.io/platforms/javascript/guides/connect/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.connectIntegration()],\n * })\n * ```\n */\nexport const connectIntegration = defineIntegration(_connectIntegration);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction connectErrorMiddleware(err: any, req: any, res: any, next: any): void {\n captureException(err, {\n mechanism: {\n handled: false,\n type: 'auto.middleware.connect',\n },\n });\n next(err);\n}\n\n/**\n * Add a Connect middleware to capture errors to Sentry.\n *\n * @param app The Connect app to attach the error handler to\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const connect = require(\"connect\");\n *\n * const app = connect();\n *\n * Sentry.setupConnectErrorHandler(app);\n *\n * // Add you connect routes here\n *\n * app.listen(3000);\n * ```\n */\nexport const setupConnectErrorHandler = (app: ConnectApp): void => {\n app.use(connectErrorMiddleware);\n ensureIsWrapped(app.use, 'connect');\n};\n"],"names":["generateInstrumentOnce","ConnectInstrumentation","defineIntegration","captureException","ensureIsWrapped"],"mappings":";;;;;;AAUA,MAAM,gBAAA,GAAmB,SAAA;AAElB,MAAM,oBAAoBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,wCAAwB;AAE5G,MAAM,uBAAuB,MAAM;AACjC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,iBAAA,EAAkB;AAAA,IACpB;AAAA,GACF;AACF,CAAA,CAAA;AAkBO,MAAM,kBAAA,GAAqBC,uBAAkB,mBAAmB;AAGvE,SAAS,sBAAA,CAAuB,GAAA,EAAU,GAAA,EAAU,GAAA,EAAU,IAAA,EAAiB;AAC7E,EAAAC,qBAAA,CAAiB,GAAA,EAAK;AAAA,IACpB,SAAA,EAAW;AAAA,MACT,OAAA,EAAS,KAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACR,GACD,CAAA;AACD,EAAA,IAAA,CAAK,GAAG,CAAA;AACV;AAqBO,MAAM,wBAAA,GAA2B,CAAC,GAAA,KAA0B;AACjE,EAAA,GAAA,CAAI,IAAI,sBAAsB,CAAA;AAC9B,EAAAC,wBAAA,CAAgB,GAAA,CAAI,KAAK,SAAS,CAAA;AACpC;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/dataloader/index.ts"],"sourcesContent":["import { DataloaderInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Dataloader';\n\nexport const instrumentDataloader = generateInstrumentOnce(INTEGRATION_NAME, () => new DataloaderInstrumentation());\n\nconst _dataloaderIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentDataloader();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [dataloader](https://www.npmjs.com/package/dataloader) library.\n *\n * For more information, see the [`dataloaderIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/dataloader/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.dataloaderIntegration()],\n * });\n * ```\n */\nexport const dataloaderIntegration = defineIntegration(_dataloaderIntegration);\n"],"names":["generateInstrumentOnce","DataloaderInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,YAAA;AAElB,MAAM,uBAAuBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,2CAA2B;AAElH,MAAM,0BAA0B,MAAM;AACpC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,oBAAA,EAAqB;AAAA,IACvB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,qBAAA,GAAwBC,uBAAkB,sBAAsB;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/dataloader/index.ts"],"sourcesContent":["import { DataloaderInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Dataloader' as const;\n\nexport const instrumentDataloader = generateInstrumentOnce(INTEGRATION_NAME, () => new DataloaderInstrumentation());\n\nconst _dataloaderIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentDataloader();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [dataloader](https://www.npmjs.com/package/dataloader) library.\n *\n * For more information, see the [`dataloaderIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/dataloader/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.dataloaderIntegration()],\n * });\n * ```\n */\nexport const dataloaderIntegration = defineIntegration(_dataloaderIntegration);\n"],"names":["generateInstrumentOnce","DataloaderInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,YAAA;AAElB,MAAM,uBAAuBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,2CAA2B;AAElH,MAAM,0BAA0B,MAAM;AACpC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,oBAAA,EAAqB;AAAA,IACvB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,qBAAA,GAAwBC,uBAAkB,sBAAsB;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"express.js","sources":["../../../../src/integrations/tracing/express.ts"],"sourcesContent":["// Automatic istrumentation for Express using OTel\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\n\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\nimport {\n type ExpressIntegrationOptions,\n type IntegrationFn,\n debug,\n patchExpressModule,\n SDK_VERSION,\n defineIntegration,\n setupExpressErrorHandler as coreSetupExpressErrorHandler,\n type ExpressHandlerOptions,\n} from '@sentry/core';\nexport { expressErrorHandler } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { setHttpServerSpanRouteAttribute } from '../../utils/setHttpServerSpanRouteAttribute';\n\nconst INTEGRATION_NAME = 'Express';\nconst SUPPORTED_VERSIONS = ['>=4.0.0 <6'];\n\nexport function setupExpressErrorHandler(\n //oxlint-disable-next-line no-explicit-any\n app: { use: (middleware: any) => unknown },\n options?: ExpressHandlerOptions,\n): void {\n coreSetupExpressErrorHandler(app, options);\n ensureIsWrapped(app.use, 'express');\n}\n\nexport type ExpressInstrumentationConfig = InstrumentationConfig &\n Omit<ExpressIntegrationOptions, 'express' | 'onRouteResolved'>;\n\nexport const instrumentExpress = generateInstrumentOnce(\n INTEGRATION_NAME,\n (options?: ExpressInstrumentationConfig) => new ExpressInstrumentation(options),\n);\n\nexport class ExpressInstrumentation extends InstrumentationBase<ExpressInstrumentationConfig> {\n public constructor(config: ExpressInstrumentationConfig = {}) {\n super('sentry-express', SDK_VERSION, config);\n }\n public init(): InstrumentationNodeModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition(\n 'express',\n SUPPORTED_VERSIONS,\n express => {\n try {\n patchExpressModule(express, () => ({\n ...this.getConfig(),\n onRouteResolved(route) {\n if (route) {\n setHttpServerSpanRouteAttribute(route);\n }\n },\n }));\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express module:', e);\n }\n return express;\n },\n // we do not ever actually unpatch in our SDKs\n express => express,\n );\n return module;\n }\n}\nconst _expressIntegration = ((options?: ExpressInstrumentationConfig) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentExpress(options);\n },\n };\n}) satisfies IntegrationFn;\n\nexport const expressIntegration = defineIntegration(_expressIntegration);\n"],"names":["coreSetupExpressErrorHandler","ensureIsWrapped","generateInstrumentOnce","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","patchExpressModule","setHttpServerSpanRouteAttribute","DEBUG_BUILD","debug","defineIntegration"],"mappings":";;;;;;;;AAmBA,MAAM,gBAAA,GAAmB,SAAA;AACzB,MAAM,kBAAA,GAAqB,CAAC,YAAY,CAAA;AAEjC,SAAS,wBAAA,CAEd,KACA,OAAA,EACM;AACN,EAAAA,6BAAA,CAA6B,KAAK,OAAO,CAAA;AACzC,EAAAC,wBAAA,CAAgB,GAAA,CAAI,KAAK,SAAS,CAAA;AACpC;AAKO,MAAM,iBAAA,GAAoBC,+BAAA;AAAA,EAC/B,gBAAA;AAAA,EACA,CAAC,OAAA,KAA2C,IAAI,sBAAA,CAAuB,OAAO;AAChF;AAEO,MAAM,+BAA+BC,mCAAA,CAAkD;AAAA,EACrF,WAAA,CAAY,MAAA,GAAuC,EAAC,EAAG;AAC5D,IAAA,KAAA,CAAM,gBAAA,EAAkBC,kBAAa,MAAM,CAAA;AAAA,EAC7C;AAAA,EACO,IAAA,GAA4C;AACjD,IAAA,MAAM,SAAS,IAAIC,mDAAA;AAAA,MACjB,SAAA;AAAA,MACA,kBAAA;AAAA,MACA,CAAA,OAAA,KAAW;AACT,QAAA,IAAI;AACF,UAAAC,uBAAA,CAAmB,SAAS,OAAO;AAAA,YACjC,GAAG,KAAK,SAAA,EAAU;AAAA,YAClB,gBAAgB,KAAA,EAAO;AACrB,cAAA,IAAI,KAAA,EAAO;AACT,gBAAAC,+DAAA,CAAgC,KAAK,CAAA;AAAA,cACvC;AAAA,YACF;AAAA,WACF,CAAE,CAAA;AAAA,QACJ,SAAS,CAAA,EAAG;AACV,UAAAC,sBAAA,IAAeC,UAAA,CAAM,KAAA,CAAM,iCAAA,EAAmC,CAAC,CAAA;AAAA,QACjE;AACA,QAAA,OAAO,OAAA;AAAA,MACT,CAAA;AAAA;AAAA,MAEA,CAAA,OAAA,KAAW;AAAA,KACb;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AACA,MAAM,mBAAA,IAAuB,CAAC,OAAA,KAA2C;AACvE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,iBAAA,CAAkB,OAAO,CAAA;AAAA,IAC3B;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,kBAAA,GAAqBC,uBAAkB,mBAAmB;;;;;;;;"}
1
+ {"version":3,"file":"express.js","sources":["../../../../src/integrations/tracing/express.ts"],"sourcesContent":["// Automatic istrumentation for Express using OTel\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\n\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\nimport {\n type ExpressIntegrationOptions,\n type IntegrationFn,\n debug,\n patchExpressModule,\n SDK_VERSION,\n defineIntegration,\n setupExpressErrorHandler as coreSetupExpressErrorHandler,\n type ExpressHandlerOptions,\n} from '@sentry/core';\nexport { expressErrorHandler } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { setHttpServerSpanRouteAttribute } from '../../utils/setHttpServerSpanRouteAttribute';\n\nconst INTEGRATION_NAME = 'Express' as const;\nconst SUPPORTED_VERSIONS = ['>=4.0.0 <6'];\n\nexport function setupExpressErrorHandler(\n //oxlint-disable-next-line no-explicit-any\n app: { use: (middleware: any) => unknown },\n options?: ExpressHandlerOptions,\n): void {\n coreSetupExpressErrorHandler(app, options);\n ensureIsWrapped(app.use, 'express');\n}\n\nexport type ExpressInstrumentationConfig = InstrumentationConfig &\n Omit<ExpressIntegrationOptions, 'express' | 'onRouteResolved'>;\n\nexport const instrumentExpress = generateInstrumentOnce(\n INTEGRATION_NAME,\n (options?: ExpressInstrumentationConfig) => new ExpressInstrumentation(options),\n);\n\nexport class ExpressInstrumentation extends InstrumentationBase<ExpressInstrumentationConfig> {\n public constructor(config: ExpressInstrumentationConfig = {}) {\n super('sentry-express', SDK_VERSION, config);\n }\n public init(): InstrumentationNodeModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition(\n 'express',\n SUPPORTED_VERSIONS,\n express => {\n try {\n patchExpressModule(express, () => ({\n ...this.getConfig(),\n onRouteResolved(route) {\n if (route) {\n setHttpServerSpanRouteAttribute(route);\n }\n },\n }));\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express module:', e);\n }\n return express;\n },\n // we do not ever actually unpatch in our SDKs\n express => express,\n );\n return module;\n }\n}\nconst _expressIntegration = ((options?: ExpressInstrumentationConfig) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentExpress(options);\n },\n };\n}) satisfies IntegrationFn;\n\nexport const expressIntegration = defineIntegration(_expressIntegration);\n"],"names":["coreSetupExpressErrorHandler","ensureIsWrapped","generateInstrumentOnce","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","patchExpressModule","setHttpServerSpanRouteAttribute","DEBUG_BUILD","debug","defineIntegration"],"mappings":";;;;;;;;AAmBA,MAAM,gBAAA,GAAmB,SAAA;AACzB,MAAM,kBAAA,GAAqB,CAAC,YAAY,CAAA;AAEjC,SAAS,wBAAA,CAEd,KACA,OAAA,EACM;AAC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;;;;;;;"}
@@ -1,11 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const dc = require('node:diagnostics_channel');
4
- const instrumentation$1 = require('./vendored/instrumentation.js');
5
3
  const core = require('@sentry/core');
6
4
  const nodeCore = require('@sentry/node-core');
7
- const debugBuild = require('../../../debug-build.js');
8
5
  const instrumentation = require('./v3/instrumentation.js');
6
+ const serverUtils = require('@sentry/server-utils');
9
7
 
10
8
  const INTEGRATION_NAME = "Fastify";
11
9
  const instrumentFastifyV3 = nodeCore.generateInstrumentOnce(
@@ -20,68 +18,17 @@ function getFastifyIntegration() {
20
18
  return client.getIntegrationByName(INTEGRATION_NAME);
21
19
  }
22
20
  }
23
- function handleFastifyError(error, request, reply, handlerOrigin) {
24
- const shouldHandleError = getFastifyIntegration()?.getShouldHandleError() || defaultShouldHandleError;
25
- if (handlerOrigin === "diagnostics-channel") {
26
- this.diagnosticsChannelExists = true;
27
- }
28
- if (this.diagnosticsChannelExists && handlerOrigin === "onError-hook") {
29
- debugBuild.DEBUG_BUILD && core.debug.warn(
30
- "Fastify error handler was already registered via diagnostics channel.",
31
- "You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options."
32
- );
33
- return;
34
- }
35
- if (shouldHandleError(error, request, reply)) {
36
- core.captureException(error, { mechanism: { handled: false, type: "auto.function.fastify" } });
37
- }
38
- }
39
- const instrumentFastify = nodeCore.generateInstrumentOnce(`${INTEGRATION_NAME}.v5`, () => {
40
- const fastifyOtelInstrumentationInstance = new instrumentation$1.FastifyOtelInstrumentation();
41
- const plugin = fastifyOtelInstrumentationInstance.plugin();
42
- dc.subscribe("fastify.initialization", (message) => {
43
- const fastifyInstance = message.fastify;
44
- fastifyInstance?.register(plugin).after((err) => {
45
- if (err) {
46
- debugBuild.DEBUG_BUILD && core.debug.error("Failed to setup Fastify instrumentation", err);
47
- } else {
48
- instrumentClient();
49
- if (fastifyInstance) {
50
- instrumentOnRequest(fastifyInstance);
51
- }
52
- }
53
- });
54
- });
55
- dc.subscribe("tracing:fastify.request.handler:error", (message) => {
56
- const { error, request, reply } = message;
57
- handleFastifyError.call(handleFastifyError, error, request, reply, "diagnostics-channel");
58
- });
59
- return fastifyOtelInstrumentationInstance;
60
- });
61
- const _fastifyIntegration = (({ shouldHandleError }) => {
62
- let _shouldHandleError;
63
- return {
64
- name: INTEGRATION_NAME,
21
+ const _fastifyIntegration = ((options) => {
22
+ const parentIntegration = serverUtils.fastifyIntegration(options);
23
+ return core.extendIntegration(parentIntegration, {
65
24
  setupOnce() {
66
- _shouldHandleError = shouldHandleError || defaultShouldHandleError;
67
25
  instrumentFastifyV3();
68
- instrumentFastify();
69
- },
70
- getShouldHandleError() {
71
- return _shouldHandleError;
72
- },
73
- setShouldHandleError(fn) {
74
- _shouldHandleError = fn;
75
26
  }
76
- };
27
+ });
77
28
  });
78
29
  const fastifyIntegration = core.defineIntegration(
79
30
  (options = {}) => _fastifyIntegration(options)
80
31
  );
81
- function defaultShouldHandleError(_error, _request, reply) {
82
- const statusCode = reply.statusCode;
83
- return statusCode >= 500 || statusCode <= 299;
84
- }
85
32
  function setupFastifyErrorHandler(fastify, options) {
86
33
  if (options?.shouldHandleError) {
87
34
  getFastifyIntegration()?.setShouldHandleError(options.shouldHandleError);
@@ -89,7 +36,7 @@ function setupFastifyErrorHandler(fastify, options) {
89
36
  const plugin = Object.assign(
90
37
  function(fastify2, _options, done) {
91
38
  fastify2.addHook("onError", async (request, reply, error) => {
92
- handleFastifyError.call(handleFastifyError, error, request, reply, "onError-hook");
39
+ serverUtils.handleFastifyError.call(serverUtils.handleFastifyError, error, request, reply, "onError-hook");
93
40
  });
94
41
  done();
95
42
  },
@@ -100,52 +47,9 @@ function setupFastifyErrorHandler(fastify, options) {
100
47
  );
101
48
  fastify.register(plugin);
102
49
  }
103
- function addFastifySpanAttributes(span) {
104
- const spanJSON = core.spanToJSON(span);
105
- const spanName = spanJSON.description;
106
- const attributes = spanJSON.data;
107
- const type = attributes["fastify.type"];
108
- const isHook = type === "hook";
109
- const isHandler = type === spanName?.startsWith("handler -");
110
- const isRequestHandler = spanName === "request" || type === "request-handler";
111
- if (attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_OP] || !isHandler && !isRequestHandler && !isHook) {
112
- return;
113
- }
114
- const opPrefix = isHook ? "hook" : isHandler ? "middleware" : isRequestHandler ? "request_handler" : "<unknown>";
115
- span.setAttributes({
116
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.otel.fastify",
117
- [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${opPrefix}.fastify`
118
- });
119
- const attrName = attributes["fastify.name"] || attributes["plugin.name"] || attributes["hook.name"];
120
- if (typeof attrName === "string") {
121
- const updatedName = attrName.replace(/^fastify -> /, "").replace(/^@fastify\/otel -> /, "").replace(/^@sentry\/instrumentation-fastify -> /, "");
122
- span.updateName(updatedName);
123
- }
124
- }
125
- function instrumentClient() {
126
- const client = core.getClient();
127
- if (client) {
128
- client.on("spanStart", (span) => {
129
- addFastifySpanAttributes(span);
130
- });
131
- }
132
- }
133
- function instrumentOnRequest(fastify) {
134
- fastify.addHook("onRequest", async (request, _reply) => {
135
- if (request.opentelemetry) {
136
- const { span } = request.opentelemetry();
137
- if (span) {
138
- addFastifySpanAttributes(span);
139
- }
140
- }
141
- const routeName = request.routeOptions?.url;
142
- const method = request.method || "GET";
143
- core.getIsolationScope().setTransactionName(`${method} ${routeName}`);
144
- });
145
- }
146
50
 
51
+ exports.instrumentFastify = serverUtils.instrumentFastify;
147
52
  exports.fastifyIntegration = fastifyIntegration;
148
- exports.instrumentFastify = instrumentFastify;
149
53
  exports.instrumentFastifyV3 = instrumentFastifyV3;
150
54
  exports.setupFastifyErrorHandler = setupFastifyErrorHandler;
151
55
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport { FastifyOtelInstrumentation } from './vendored/instrumentation';\nimport type { Instrumentation, InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n captureException,\n debug,\n defineIntegration,\n getClient,\n getIsolationScope,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport type { FastifyInstance, FastifyMinimal, FastifyReply, FastifyRequest } from './types';\nimport { FastifyInstrumentationV3 } from './v3/instrumentation';\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * });\n * },\n * });\n * ```\n *\n */\ninterface FastifyIntegrationOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\ninterface FastifyHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n *\n * @example\n *\n *\n * ```javascript\n * setupFastifyErrorHandler(app, {\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 400;\n * },\n * });\n * ```\n *\n *\n * If using TypeScript, you can cast the request and reply to get full type safety.\n *\n * ```typescript\n * import type { FastifyRequest, FastifyReply } from 'fastify';\n *\n * setupFastifyErrorHandler(app, {\n * shouldHandleError(error, minimalRequest, minimalReply) {\n * const request = minimalRequest as FastifyRequest;\n * const reply = minimalReply as FastifyReply;\n * return reply.statusCode >= 500;\n * },\n * });\n * ```\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst INTEGRATION_NAME = 'Fastify';\n\nexport const instrumentFastifyV3 = generateInstrumentOnce(\n `${INTEGRATION_NAME}.v3`,\n () => new FastifyInstrumentationV3(),\n);\n\nfunction getFastifyIntegration(): ReturnType<typeof _fastifyIntegration> | undefined {\n const client = getClient();\n if (!client) {\n return undefined;\n } else {\n return client.getIntegrationByName(INTEGRATION_NAME);\n }\n}\n\nfunction handleFastifyError(\n this: {\n diagnosticsChannelExists?: boolean;\n },\n error: Error,\n request: FastifyRequest & { opentelemetry?: () => { span?: Span } },\n reply: FastifyReply,\n handlerOrigin: 'diagnostics-channel' | 'onError-hook',\n): void {\n const shouldHandleError = getFastifyIntegration()?.getShouldHandleError() || defaultShouldHandleError;\n // Diagnostics channel runs before the onError hook, so we can use it to check if the handler was already registered\n if (handlerOrigin === 'diagnostics-channel') {\n this.diagnosticsChannelExists = true;\n }\n\n if (this.diagnosticsChannelExists && handlerOrigin === 'onError-hook') {\n DEBUG_BUILD &&\n debug.warn(\n 'Fastify error handler was already registered via diagnostics channel.',\n 'You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.',\n );\n\n // If the diagnostics channel already exists, we don't need to handle the error again\n return;\n }\n\n if (shouldHandleError(error, request, reply)) {\n captureException(error, { mechanism: { handled: false, type: 'auto.function.fastify' } });\n }\n}\n\nexport const instrumentFastify = generateInstrumentOnce(`${INTEGRATION_NAME}.v5`, () => {\n const fastifyOtelInstrumentationInstance = new FastifyOtelInstrumentation();\n const plugin = fastifyOtelInstrumentationInstance.plugin();\n\n // This message handler works for Fastify versions 3, 4 and 5\n diagnosticsChannel.subscribe('fastify.initialization', message => {\n const fastifyInstance = (message as { fastify?: FastifyInstance }).fastify;\n\n fastifyInstance?.register(plugin).after(err => {\n if (err) {\n DEBUG_BUILD && debug.error('Failed to setup Fastify instrumentation', err);\n } else {\n instrumentClient();\n\n if (fastifyInstance) {\n instrumentOnRequest(fastifyInstance);\n }\n }\n });\n });\n\n // This diagnostics channel only works on Fastify version 5\n // For versions 3 and 4, we use `setupFastifyErrorHandler` instead\n diagnosticsChannel.subscribe('tracing:fastify.request.handler:error', message => {\n const { error, request, reply } = message as {\n error: Error;\n request: FastifyRequest & { opentelemetry?: () => { span?: Span } };\n reply: FastifyReply;\n };\n\n handleFastifyError.call(handleFastifyError, error, request, reply, 'diagnostics-channel');\n });\n\n // Returning this as Instrumentation to avoid leaking @fastify/otel types into the public API\n return fastifyOtelInstrumentationInstance as unknown as Instrumentation<InstrumentationConfig>;\n});\n\nconst _fastifyIntegration = (({ shouldHandleError }: Partial<FastifyIntegrationOptions>) => {\n let _shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n _shouldHandleError = shouldHandleError || defaultShouldHandleError;\n\n instrumentFastifyV3();\n instrumentFastify();\n },\n getShouldHandleError() {\n return _shouldHandleError;\n },\n setShouldHandleError(fn: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean): void {\n _shouldHandleError = fn;\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n *\n * If you also want to capture errors, you need to call `setupFastifyErrorHandler(app)` after you set up your Fastify server.\n *\n * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.fastifyIntegration()],\n * })\n * ```\n */\nexport const fastifyIntegration = defineIntegration((options: Partial<FastifyIntegrationOptions> = {}) =>\n _fastifyIntegration(options),\n);\n\n/**\n * Default function to determine if an error should be sent to Sentry\n *\n * 3xx and 4xx errors are not sent by default.\n */\nfunction defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean {\n const statusCode = reply.statusCode;\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n\n/**\n * Add an Fastify error handler to capture errors to Sentry.\n *\n * @param fastify The Fastify instance to which to add the error handler\n * @param options Configuration options for the handler\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const Fastify = require(\"fastify\");\n *\n * const app = Fastify();\n *\n * Sentry.setupFastifyErrorHandler(app);\n *\n * // Add your routes, etc.\n *\n * app.listen({ port: 3000 });\n * ```\n */\nexport function setupFastifyErrorHandler(fastify: FastifyMinimal, options?: Partial<FastifyHandlerOptions>): void {\n if (options?.shouldHandleError) {\n getFastifyIntegration()?.setShouldHandleError(options.shouldHandleError);\n }\n\n const plugin = Object.assign(\n function (fastify: FastifyInstance, _options: unknown, done: () => void): void {\n fastify.addHook('onError', async (request, reply, error) => {\n handleFastifyError.call(handleFastifyError, error, request, reply, 'onError-hook');\n });\n done();\n },\n {\n [Symbol.for('skip-override')]: true,\n [Symbol.for('fastify.display-name')]: 'sentry-fastify-error-handler',\n },\n );\n\n fastify.register(plugin);\n}\n\nfunction addFastifySpanAttributes(span: Span): void {\n const spanJSON = spanToJSON(span);\n const spanName = spanJSON.description;\n const attributes = spanJSON.data;\n\n const type = attributes['fastify.type'];\n\n const isHook = type === 'hook';\n const isHandler = type === spanName?.startsWith('handler -');\n // In @fastify/otel `request-handler` is separated by dash, not underscore\n const isRequestHandler = spanName === 'request' || type === 'request-handler';\n\n // If this is already set, or we have no fastify span, no need to process again...\n if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] || (!isHandler && !isRequestHandler && !isHook)) {\n return;\n }\n\n const opPrefix = isHook ? 'hook' : isHandler ? 'middleware' : isRequestHandler ? 'request_handler' : '<unknown>';\n\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.fastify',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${opPrefix}.fastify`,\n });\n\n const attrName = attributes['fastify.name'] || attributes['plugin.name'] || attributes['hook.name'];\n if (typeof attrName === 'string') {\n // Try removing `fastify -> ` and `@fastify/otel -> ` prefixes\n // This is a bit of a hack, and not always working for all spans\n // But it's the best we can do without a proper API\n const updatedName = attrName\n .replace(/^fastify -> /, '')\n .replace(/^@fastify\\/otel -> /, '')\n .replace(/^@sentry\\/instrumentation-fastify -> /, '');\n\n span.updateName(updatedName);\n }\n}\n\nfunction instrumentClient(): void {\n const client = getClient();\n if (client) {\n client.on('spanStart', (span: Span) => {\n addFastifySpanAttributes(span);\n });\n }\n}\n\nfunction instrumentOnRequest(fastify: FastifyInstance): void {\n fastify.addHook('onRequest', async (request: FastifyRequest & { opentelemetry?: () => { span?: Span } }, _reply) => {\n if (request.opentelemetry) {\n const { span } = request.opentelemetry();\n\n if (span) {\n addFastifySpanAttributes(span);\n }\n }\n\n const routeName = request.routeOptions?.url;\n const method = request.method || 'GET';\n\n getIsolationScope().setTransactionName(`${method} ${routeName}`);\n });\n}\n"],"names":["generateInstrumentOnce","FastifyInstrumentationV3","getClient","DEBUG_BUILD","debug","captureException","FastifyOtelInstrumentation","diagnosticsChannel","defineIntegration","fastify","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getIsolationScope"],"mappings":";;;;;;;;;AA2FA,MAAM,gBAAA,GAAmB,SAAA;AAElB,MAAM,mBAAA,GAAsBA,+BAAA;AAAA,EACjC,GAAG,gBAAgB,CAAA,GAAA,CAAA;AAAA,EACnB,MAAM,IAAIC,wCAAA;AACZ;AAEA,SAAS,qBAAA,GAA4E;AAC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A,wBAAA,CAAyB,IAAI,CAAA;AAAA,MAC/B;AAAA,IACF;AAEA,IAAA,MAAM,SAAA,GAAY,QAAQ,YAAA,EAAc,GAAA;AACxC,IAAA,MAAM,MAAA,GAAS,QAAQ,MAAA,IAAU,KAAA;AAEjC,IAAAW,sBAAA,GAAoB,kBAAA,CAAmB,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,SAAS,CAAA,CAAE,CAAA;AAAA,EACjE,CAAC,CAAA;AACH;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"sourcesContent":["import type { Integration, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, extendIntegration, getClient } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport type { FastifyInstance, FastifyMinimal, FastifyReply, FastifyRequest } from './types';\nimport { FastifyInstrumentationV3 } from './v3/instrumentation';\nimport {\n fastifyIntegration as serverUtilsFastifyIntegration,\n instrumentFastify,\n handleFastifyError,\n} from '@sentry/server-utils';\n\ninterface FastifyIntegration extends Integration {\n getShouldHandleError: () => (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n // todo(v11): Remove this\n setShouldHandleError: (\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean,\n ) => void;\n}\n\n// oxlint-disable-next-line typescript/no-deprecated\nexport { instrumentFastify };\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * });\n * },\n * });\n * ```\n *\n */\ninterface FastifyIntegrationOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\ninterface FastifyHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n *\n * @example\n *\n *\n * ```javascript\n * setupFastifyErrorHandler(app, {\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 400;\n * },\n * });\n * ```\n *\n *\n * If using TypeScript, you can cast the request and reply to get full type safety.\n *\n * ```typescript\n * import type { FastifyRequest, FastifyReply } from 'fastify';\n *\n * setupFastifyErrorHandler(app, {\n * shouldHandleError(error, minimalRequest, minimalReply) {\n * const request = minimalRequest as FastifyRequest;\n * const reply = minimalReply as FastifyReply;\n * return reply.statusCode >= 500;\n * },\n * });\n * ```\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst INTEGRATION_NAME = 'Fastify' as const;\n\nexport const instrumentFastifyV3 = generateInstrumentOnce(\n `${INTEGRATION_NAME}.v3`,\n () => new FastifyInstrumentationV3(),\n);\n\nfunction getFastifyIntegration(): FastifyIntegration | undefined {\n const client = getClient();\n if (!client) {\n return undefined;\n } else {\n return client.getIntegrationByName(INTEGRATION_NAME);\n }\n}\n\nconst _fastifyIntegration = ((options: Partial<FastifyIntegrationOptions>) => {\n const parentIntegration = serverUtilsFastifyIntegration(options) as FastifyIntegration;\n\n return extendIntegration(parentIntegration, {\n setupOnce() {\n instrumentFastifyV3();\n },\n });\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n *\n * If you also want to capture errors, you need to call `setupFastifyErrorHandler(app)` after you set up your Fastify server.\n *\n * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.fastifyIntegration()],\n * })\n * ```\n */\nexport const fastifyIntegration = defineIntegration((options: Partial<FastifyIntegrationOptions> = {}) =>\n _fastifyIntegration(options),\n);\n\n/**\n * Add an Fastify error handler to capture errors to Sentry.\n *\n * @param fastify The Fastify instance to which to add the error handler\n * @param options Configuration options for the handler\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const Fastify = require(\"fastify\");\n *\n * const app = Fastify();\n *\n * Sentry.setupFastifyErrorHandler(app);\n *\n * // Add your routes, etc.\n *\n * app.listen({ port: 3000 });\n * ```\n */\nexport function setupFastifyErrorHandler(fastify: FastifyMinimal, options?: Partial<FastifyHandlerOptions>): void {\n if (options?.shouldHandleError) {\n getFastifyIntegration()?.setShouldHandleError(options.shouldHandleError);\n }\n\n const plugin = Object.assign(\n function (fastify: FastifyInstance, _options: unknown, done: () => void): void {\n fastify.addHook('onError', async (request, reply, error) => {\n // oxlint-disable-next-line typescript/no-deprecated\n handleFastifyError.call(handleFastifyError, error, request, reply, 'onError-hook');\n });\n done();\n },\n {\n [Symbol.for('skip-override')]: true,\n [Symbol.for('fastify.display-name')]: 'sentry-fastify-error-handler',\n },\n );\n\n fastify.register(plugin);\n}\n"],"names":["generateInstrumentOnce","FastifyInstrumentationV3","getClient","serverUtilsFastifyIntegration","extendIntegration","defineIntegration","fastify","handleFastifyError"],"mappings":";;;;;;;AA8FA,MAAM,gBAAA,GAAmB,SAAA;AAElB,MAAM,mBAAA,GAAsBA,+BAAA;AAAA,EACjC,GAAG,gBAAgB,CAAA,GAAA,CAAA;AAAA,EACnB,MAAM,IAAIC,wCAAA;AACZ;AAEA,SAAS,qBAAA,GAAwD;AAC/D,EAAA,MAAM,SAASC,cAAA,EAAU;AACzB,EAAA,IAA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,6 @@ const setHttpServerSpanRouteAttribute = require('../../../../utils/setHttpServer
8
8
  const AttributeNames = require('./enums/AttributeNames.js');
9
9
  const utils = require('./utils.js');
10
10
 
11
- const PACKAGE_VERSION = "0.1.0";
12
11
  const PACKAGE_NAME = "@sentry/instrumentation-fastify-v3";
13
12
  const ANONYMOUS_NAME = "anonymous";
14
13
  const hooksNamesToWrap = /* @__PURE__ */ new Set([
@@ -24,11 +23,11 @@ const hooksNamesToWrap = /* @__PURE__ */ new Set([
24
23
  ]);
25
24
  class FastifyInstrumentationV3 extends instrumentation.InstrumentationBase {
26
25
  constructor(config = {}) {
27
- super(PACKAGE_NAME, PACKAGE_VERSION, config);
26
+ super(PACKAGE_NAME, core.SDK_VERSION, config);
28
27
  }
29
28
  init() {
30
29
  return [
31
- new instrumentation.InstrumentationNodeModuleDefinition("fastify", [">=3.0.0 <4"], (moduleExports) => {
30
+ new instrumentation.InstrumentationNodeModuleDefinition("fastify", [">=3.0.0 <3.21.0"], (moduleExports) => {
32
31
  return this._patchConstructor(moduleExports);
33
32
  })
34
33
  ];