@sentry/node 9.34.0 → 9.36.0-alpha.1

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 (505) hide show
  1. package/build/cjs/index.js +48 -56
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/featureFlagShims/launchDarkly.js +43 -0
  4. package/build/cjs/integrations/featureFlagShims/launchDarkly.js.map +1 -0
  5. package/build/cjs/integrations/featureFlagShims/openFeature.js +55 -0
  6. package/build/cjs/integrations/featureFlagShims/openFeature.js.map +1 -0
  7. package/build/cjs/integrations/featureFlagShims/statsig.js +23 -0
  8. package/build/cjs/integrations/featureFlagShims/statsig.js.map +1 -0
  9. package/build/cjs/integrations/featureFlagShims/unleash.js +23 -0
  10. package/build/cjs/integrations/featureFlagShims/unleash.js.map +1 -0
  11. package/build/cjs/integrations/fs.js +2 -2
  12. package/build/cjs/integrations/fs.js.map +1 -1
  13. package/build/cjs/integrations/http/index.js +7 -11
  14. package/build/cjs/integrations/http/index.js.map +1 -1
  15. package/build/cjs/integrations/node-fetch/index.js +4 -5
  16. package/build/cjs/integrations/node-fetch/index.js.map +1 -1
  17. package/build/cjs/integrations/tracing/amqplib.js +4 -5
  18. package/build/cjs/integrations/tracing/amqplib.js.map +1 -1
  19. package/build/cjs/integrations/tracing/connect.js +3 -4
  20. package/build/cjs/integrations/tracing/connect.js.map +1 -1
  21. package/build/cjs/integrations/tracing/dataloader.js +3 -3
  22. package/build/cjs/integrations/tracing/dataloader.js.map +1 -1
  23. package/build/cjs/integrations/tracing/express.js +5 -7
  24. package/build/cjs/integrations/tracing/express.js.map +1 -1
  25. package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js +5 -10
  26. package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
  27. package/build/cjs/integrations/tracing/fastify/index.js +6 -6
  28. package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
  29. package/build/cjs/integrations/tracing/genericPool.js +3 -3
  30. package/build/cjs/integrations/tracing/genericPool.js.map +1 -1
  31. package/build/cjs/integrations/tracing/graphql.js +3 -4
  32. package/build/cjs/integrations/tracing/graphql.js.map +1 -1
  33. package/build/cjs/integrations/tracing/hapi/index.js +3 -4
  34. package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
  35. package/build/cjs/integrations/tracing/kafka.js +4 -5
  36. package/build/cjs/integrations/tracing/kafka.js.map +1 -1
  37. package/build/cjs/integrations/tracing/knex.js +3 -3
  38. package/build/cjs/integrations/tracing/knex.js.map +1 -1
  39. package/build/cjs/integrations/tracing/koa.js +4 -6
  40. package/build/cjs/integrations/tracing/koa.js.map +1 -1
  41. package/build/cjs/integrations/tracing/lrumemoizer.js +2 -2
  42. package/build/cjs/integrations/tracing/lrumemoizer.js.map +1 -1
  43. package/build/cjs/integrations/tracing/mongo.js +3 -4
  44. package/build/cjs/integrations/tracing/mongo.js.map +1 -1
  45. package/build/cjs/integrations/tracing/mongoose.js +3 -4
  46. package/build/cjs/integrations/tracing/mongoose.js.map +1 -1
  47. package/build/cjs/integrations/tracing/mysql.js +2 -2
  48. package/build/cjs/integrations/tracing/mysql.js.map +1 -1
  49. package/build/cjs/integrations/tracing/mysql2.js +3 -4
  50. package/build/cjs/integrations/tracing/mysql2.js.map +1 -1
  51. package/build/cjs/integrations/tracing/postgres.js +3 -4
  52. package/build/cjs/integrations/tracing/postgres.js.map +1 -1
  53. package/build/cjs/integrations/tracing/postgresjs.js +3 -4
  54. package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
  55. package/build/cjs/integrations/tracing/prisma.js +2 -2
  56. package/build/cjs/integrations/tracing/prisma.js.map +1 -1
  57. package/build/cjs/integrations/tracing/redis.js +3 -3
  58. package/build/cjs/integrations/tracing/redis.js.map +1 -1
  59. package/build/cjs/integrations/tracing/tedious.js +3 -3
  60. package/build/cjs/integrations/tracing/tedious.js.map +1 -1
  61. package/build/cjs/integrations/tracing/vercelai/index.js +2 -2
  62. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
  63. package/build/cjs/preload.js +2 -2
  64. package/build/cjs/preload.js.map +1 -1
  65. package/build/cjs/sdk/index.js +22 -203
  66. package/build/cjs/sdk/index.js.map +1 -1
  67. package/build/cjs/sdk/initOtel.js +4 -22
  68. package/build/cjs/sdk/initOtel.js.map +1 -1
  69. package/build/esm/index.js +6 -21
  70. package/build/esm/index.js.map +1 -1
  71. package/build/esm/integrations/featureFlagShims/launchDarkly.js +40 -0
  72. package/build/esm/integrations/featureFlagShims/launchDarkly.js.map +1 -0
  73. package/build/esm/integrations/featureFlagShims/openFeature.js +52 -0
  74. package/build/esm/integrations/featureFlagShims/openFeature.js.map +1 -0
  75. package/build/esm/integrations/featureFlagShims/statsig.js +21 -0
  76. package/build/esm/integrations/featureFlagShims/statsig.js.map +1 -0
  77. package/build/esm/integrations/featureFlagShims/unleash.js +21 -0
  78. package/build/esm/integrations/featureFlagShims/unleash.js.map +1 -0
  79. package/build/esm/integrations/fs.js +1 -1
  80. package/build/esm/integrations/fs.js.map +1 -1
  81. package/build/esm/integrations/http/index.js +1 -5
  82. package/build/esm/integrations/http/index.js.map +1 -1
  83. package/build/esm/integrations/node-fetch/index.js +2 -3
  84. package/build/esm/integrations/node-fetch/index.js.map +1 -1
  85. package/build/esm/integrations/tracing/amqplib.js +1 -2
  86. package/build/esm/integrations/tracing/amqplib.js.map +1 -1
  87. package/build/esm/integrations/tracing/connect.js +1 -2
  88. package/build/esm/integrations/tracing/connect.js.map +1 -1
  89. package/build/esm/integrations/tracing/dataloader.js +1 -1
  90. package/build/esm/integrations/tracing/dataloader.js.map +1 -1
  91. package/build/esm/integrations/tracing/express.js +2 -4
  92. package/build/esm/integrations/tracing/express.js.map +1 -1
  93. package/build/esm/integrations/tracing/fastify/fastify-otel/index.js +5 -10
  94. package/build/esm/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
  95. package/build/esm/integrations/tracing/fastify/index.js +5 -5
  96. package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
  97. package/build/esm/integrations/tracing/genericPool.js +1 -1
  98. package/build/esm/integrations/tracing/genericPool.js.map +1 -1
  99. package/build/esm/integrations/tracing/graphql.js +2 -3
  100. package/build/esm/integrations/tracing/graphql.js.map +1 -1
  101. package/build/esm/integrations/tracing/hapi/index.js +1 -2
  102. package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
  103. package/build/esm/integrations/tracing/kafka.js +1 -2
  104. package/build/esm/integrations/tracing/kafka.js.map +1 -1
  105. package/build/esm/integrations/tracing/knex.js +1 -1
  106. package/build/esm/integrations/tracing/knex.js.map +1 -1
  107. package/build/esm/integrations/tracing/koa.js +2 -4
  108. package/build/esm/integrations/tracing/koa.js.map +1 -1
  109. package/build/esm/integrations/tracing/lrumemoizer.js +1 -1
  110. package/build/esm/integrations/tracing/lrumemoizer.js.map +1 -1
  111. package/build/esm/integrations/tracing/mongo.js +1 -2
  112. package/build/esm/integrations/tracing/mongo.js.map +1 -1
  113. package/build/esm/integrations/tracing/mongoose.js +1 -2
  114. package/build/esm/integrations/tracing/mongoose.js.map +1 -1
  115. package/build/esm/integrations/tracing/mysql.js +1 -1
  116. package/build/esm/integrations/tracing/mysql.js.map +1 -1
  117. package/build/esm/integrations/tracing/mysql2.js +1 -2
  118. package/build/esm/integrations/tracing/mysql2.js.map +1 -1
  119. package/build/esm/integrations/tracing/postgres.js +1 -2
  120. package/build/esm/integrations/tracing/postgres.js.map +1 -1
  121. package/build/esm/integrations/tracing/postgresjs.js +2 -3
  122. package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
  123. package/build/esm/integrations/tracing/prisma.js +1 -1
  124. package/build/esm/integrations/tracing/prisma.js.map +1 -1
  125. package/build/esm/integrations/tracing/redis.js +1 -1
  126. package/build/esm/integrations/tracing/redis.js.map +1 -1
  127. package/build/esm/integrations/tracing/tedious.js +1 -1
  128. package/build/esm/integrations/tracing/tedious.js.map +1 -1
  129. package/build/esm/integrations/tracing/vercelai/index.js +1 -1
  130. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
  131. package/build/esm/package.json +1 -1
  132. package/build/esm/preload.js +1 -1
  133. package/build/esm/preload.js.map +1 -1
  134. package/build/esm/sdk/index.js +22 -202
  135. package/build/esm/sdk/index.js.map +1 -1
  136. package/build/esm/sdk/initOtel.js +3 -21
  137. package/build/esm/sdk/initOtel.js.map +1 -1
  138. package/build/types/index.d.ts +3 -21
  139. package/build/types/index.d.ts.map +1 -1
  140. package/build/types/integrations/featureFlagShims/index.d.ts +5 -0
  141. package/build/types/integrations/featureFlagShims/index.d.ts.map +1 -0
  142. package/build/types/integrations/featureFlagShims/launchDarkly.d.ts +10 -0
  143. package/build/types/integrations/featureFlagShims/launchDarkly.d.ts.map +1 -0
  144. package/build/types/integrations/featureFlagShims/openFeature.d.ts +23 -0
  145. package/build/types/integrations/featureFlagShims/openFeature.d.ts.map +1 -0
  146. package/build/types/integrations/featureFlagShims/statsig.d.ts +6 -0
  147. package/build/types/integrations/featureFlagShims/statsig.d.ts.map +1 -0
  148. package/build/types/integrations/featureFlagShims/unleash.d.ts +6 -0
  149. package/build/types/integrations/featureFlagShims/unleash.d.ts.map +1 -0
  150. package/build/types/integrations/http/index.d.ts +1 -1
  151. package/build/types/integrations/http/index.d.ts.map +1 -1
  152. package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
  153. package/build/types/integrations/tracing/amqplib.d.ts.map +1 -1
  154. package/build/types/integrations/tracing/connect.d.ts.map +1 -1
  155. package/build/types/integrations/tracing/express.d.ts.map +1 -1
  156. package/build/types/integrations/tracing/graphql.d.ts.map +1 -1
  157. package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
  158. package/build/types/integrations/tracing/kafka.d.ts.map +1 -1
  159. package/build/types/integrations/tracing/koa.d.ts.map +1 -1
  160. package/build/types/integrations/tracing/mongo.d.ts.map +1 -1
  161. package/build/types/integrations/tracing/mongoose.d.ts.map +1 -1
  162. package/build/types/integrations/tracing/mysql2.d.ts.map +1 -1
  163. package/build/types/integrations/tracing/postgres.d.ts.map +1 -1
  164. package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
  165. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
  166. package/build/types/sdk/index.d.ts +2 -6
  167. package/build/types/sdk/index.d.ts.map +1 -1
  168. package/build/types/sdk/initOtel.d.ts +1 -1
  169. package/build/types/sdk/initOtel.d.ts.map +1 -1
  170. package/build/types/types.d.ts +1 -1
  171. package/build/types/types.d.ts.map +1 -1
  172. package/build/types-ts3.8/index.d.ts +3 -21
  173. package/build/types-ts3.8/integrations/featureFlagShims/index.d.ts +5 -0
  174. package/build/types-ts3.8/integrations/featureFlagShims/launchDarkly.d.ts +10 -0
  175. package/build/types-ts3.8/integrations/featureFlagShims/openFeature.d.ts +23 -0
  176. package/build/types-ts3.8/integrations/featureFlagShims/statsig.d.ts +6 -0
  177. package/build/types-ts3.8/integrations/featureFlagShims/unleash.d.ts +6 -0
  178. package/build/types-ts3.8/integrations/http/index.d.ts +1 -1
  179. package/build/types-ts3.8/sdk/index.d.ts +2 -6
  180. package/build/types-ts3.8/sdk/initOtel.d.ts +1 -1
  181. package/build/types-ts3.8/types.d.ts +1 -1
  182. package/package.json +4 -3
  183. package/build/cjs/cron/common.js +0 -56
  184. package/build/cjs/cron/common.js.map +0 -1
  185. package/build/cjs/cron/cron.js +0 -112
  186. package/build/cjs/cron/cron.js.map +0 -1
  187. package/build/cjs/cron/index.js +0 -15
  188. package/build/cjs/cron/index.js.map +0 -1
  189. package/build/cjs/cron/node-cron.js +0 -71
  190. package/build/cjs/cron/node-cron.js.map +0 -1
  191. package/build/cjs/cron/node-schedule.js +0 -65
  192. package/build/cjs/cron/node-schedule.js.map +0 -1
  193. package/build/cjs/integrations/anr/index.js +0 -238
  194. package/build/cjs/integrations/anr/index.js.map +0 -1
  195. package/build/cjs/integrations/childProcess.js +0 -100
  196. package/build/cjs/integrations/childProcess.js.map +0 -1
  197. package/build/cjs/integrations/context.js +0 -457
  198. package/build/cjs/integrations/context.js.map +0 -1
  199. package/build/cjs/integrations/contextlines.js +0 -405
  200. package/build/cjs/integrations/contextlines.js.map +0 -1
  201. package/build/cjs/integrations/http/SentryHttpInstrumentation.js +0 -558
  202. package/build/cjs/integrations/http/SentryHttpInstrumentation.js.map +0 -1
  203. package/build/cjs/integrations/local-variables/common.js +0 -69
  204. package/build/cjs/integrations/local-variables/common.js.map +0 -1
  205. package/build/cjs/integrations/local-variables/index.js +0 -12
  206. package/build/cjs/integrations/local-variables/index.js.map +0 -1
  207. package/build/cjs/integrations/local-variables/local-variables-async.js +0 -143
  208. package/build/cjs/integrations/local-variables/local-variables-async.js.map +0 -1
  209. package/build/cjs/integrations/local-variables/local-variables-sync.js +0 -410
  210. package/build/cjs/integrations/local-variables/local-variables-sync.js.map +0 -1
  211. package/build/cjs/integrations/modules.js +0 -135
  212. package/build/cjs/integrations/modules.js.map +0 -1
  213. package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js +0 -291
  214. package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +0 -1
  215. package/build/cjs/integrations/onuncaughtexception.js +0 -134
  216. package/build/cjs/integrations/onuncaughtexception.js.map +0 -1
  217. package/build/cjs/integrations/onunhandledrejection.js +0 -89
  218. package/build/cjs/integrations/onunhandledrejection.js.map +0 -1
  219. package/build/cjs/integrations/processSession.js +0 -36
  220. package/build/cjs/integrations/processSession.js.map +0 -1
  221. package/build/cjs/integrations/spotlight.js +0 -101
  222. package/build/cjs/integrations/spotlight.js.map +0 -1
  223. package/build/cjs/integrations/winston.js +0 -151
  224. package/build/cjs/integrations/winston.js.map +0 -1
  225. package/build/cjs/logs/capture.js +0 -29
  226. package/build/cjs/logs/capture.js.map +0 -1
  227. package/build/cjs/logs/exports.js +0 -178
  228. package/build/cjs/logs/exports.js.map +0 -1
  229. package/build/cjs/nodeVersion.js +0 -12
  230. package/build/cjs/nodeVersion.js.map +0 -1
  231. package/build/cjs/otel/contextManager.js +0 -16
  232. package/build/cjs/otel/contextManager.js.map +0 -1
  233. package/build/cjs/otel/instrument.js +0 -139
  234. package/build/cjs/otel/instrument.js.map +0 -1
  235. package/build/cjs/proxy/base.js +0 -122
  236. package/build/cjs/proxy/base.js.map +0 -1
  237. package/build/cjs/proxy/index.js +0 -173
  238. package/build/cjs/proxy/index.js.map +0 -1
  239. package/build/cjs/proxy/parse-proxy-response.js +0 -104
  240. package/build/cjs/proxy/parse-proxy-response.js.map +0 -1
  241. package/build/cjs/sdk/api.js +0 -117
  242. package/build/cjs/sdk/api.js.map +0 -1
  243. package/build/cjs/sdk/client.js +0 -156
  244. package/build/cjs/sdk/client.js.map +0 -1
  245. package/build/cjs/transports/http.js +0 -158
  246. package/build/cjs/transports/http.js.map +0 -1
  247. package/build/cjs/utils/addOriginToSpan.js +0 -11
  248. package/build/cjs/utils/addOriginToSpan.js.map +0 -1
  249. package/build/cjs/utils/baggage.js +0 -36
  250. package/build/cjs/utils/baggage.js.map +0 -1
  251. package/build/cjs/utils/commonjs.js +0 -13
  252. package/build/cjs/utils/commonjs.js.map +0 -1
  253. package/build/cjs/utils/createMissingInstrumentationContext.js +0 -11
  254. package/build/cjs/utils/createMissingInstrumentationContext.js.map +0 -1
  255. package/build/cjs/utils/debug.js +0 -23
  256. package/build/cjs/utils/debug.js.map +0 -1
  257. package/build/cjs/utils/ensureIsWrapped.js +0 -41
  258. package/build/cjs/utils/ensureIsWrapped.js.map +0 -1
  259. package/build/cjs/utils/envToBool.js +0 -32
  260. package/build/cjs/utils/envToBool.js.map +0 -1
  261. package/build/cjs/utils/errorhandling.js +0 -42
  262. package/build/cjs/utils/errorhandling.js.map +0 -1
  263. package/build/cjs/utils/getRequestUrl.js +0 -18
  264. package/build/cjs/utils/getRequestUrl.js.map +0 -1
  265. package/build/cjs/utils/module.js +0 -60
  266. package/build/cjs/utils/module.js.map +0 -1
  267. package/build/esm/cron/common.js +0 -54
  268. package/build/esm/cron/common.js.map +0 -1
  269. package/build/esm/cron/cron.js +0 -110
  270. package/build/esm/cron/cron.js.map +0 -1
  271. package/build/esm/cron/index.js +0 -13
  272. package/build/esm/cron/index.js.map +0 -1
  273. package/build/esm/cron/node-cron.js +0 -69
  274. package/build/esm/cron/node-cron.js.map +0 -1
  275. package/build/esm/cron/node-schedule.js +0 -63
  276. package/build/esm/cron/node-schedule.js.map +0 -1
  277. package/build/esm/integrations/anr/index.js +0 -234
  278. package/build/esm/integrations/anr/index.js.map +0 -1
  279. package/build/esm/integrations/anr/worker-script.js +0 -2
  280. package/build/esm/integrations/childProcess.js +0 -98
  281. package/build/esm/integrations/childProcess.js.map +0 -1
  282. package/build/esm/integrations/context.js +0 -451
  283. package/build/esm/integrations/context.js.map +0 -1
  284. package/build/esm/integrations/contextlines.js +0 -399
  285. package/build/esm/integrations/contextlines.js.map +0 -1
  286. package/build/esm/integrations/http/SentryHttpInstrumentation.js +0 -555
  287. package/build/esm/integrations/http/SentryHttpInstrumentation.js.map +0 -1
  288. package/build/esm/integrations/local-variables/common.js +0 -64
  289. package/build/esm/integrations/local-variables/common.js.map +0 -1
  290. package/build/esm/integrations/local-variables/index.js +0 -10
  291. package/build/esm/integrations/local-variables/index.js.map +0 -1
  292. package/build/esm/integrations/local-variables/local-variables-async.js +0 -140
  293. package/build/esm/integrations/local-variables/local-variables-async.js.map +0 -1
  294. package/build/esm/integrations/local-variables/local-variables-sync.js +0 -405
  295. package/build/esm/integrations/local-variables/local-variables-sync.js.map +0 -1
  296. package/build/esm/integrations/local-variables/worker-script.js +0 -2
  297. package/build/esm/integrations/modules.js +0 -133
  298. package/build/esm/integrations/modules.js.map +0 -1
  299. package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js +0 -289
  300. package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +0 -1
  301. package/build/esm/integrations/onuncaughtexception.js +0 -131
  302. package/build/esm/integrations/onuncaughtexception.js.map +0 -1
  303. package/build/esm/integrations/onunhandledrejection.js +0 -86
  304. package/build/esm/integrations/onunhandledrejection.js.map +0 -1
  305. package/build/esm/integrations/processSession.js +0 -34
  306. package/build/esm/integrations/processSession.js.map +0 -1
  307. package/build/esm/integrations/spotlight.js +0 -98
  308. package/build/esm/integrations/spotlight.js.map +0 -1
  309. package/build/esm/integrations/winston.js +0 -149
  310. package/build/esm/integrations/winston.js.map +0 -1
  311. package/build/esm/logs/capture.js +0 -27
  312. package/build/esm/logs/capture.js.map +0 -1
  313. package/build/esm/logs/exports.js +0 -170
  314. package/build/esm/logs/exports.js.map +0 -1
  315. package/build/esm/nodeVersion.js +0 -8
  316. package/build/esm/nodeVersion.js.map +0 -1
  317. package/build/esm/otel/contextManager.js +0 -14
  318. package/build/esm/otel/contextManager.js.map +0 -1
  319. package/build/esm/otel/instrument.js +0 -135
  320. package/build/esm/otel/instrument.js.map +0 -1
  321. package/build/esm/proxy/base.js +0 -120
  322. package/build/esm/proxy/base.js.map +0 -1
  323. package/build/esm/proxy/index.js +0 -171
  324. package/build/esm/proxy/index.js.map +0 -1
  325. package/build/esm/proxy/parse-proxy-response.js +0 -102
  326. package/build/esm/proxy/parse-proxy-response.js.map +0 -1
  327. package/build/esm/sdk/api.js +0 -114
  328. package/build/esm/sdk/api.js.map +0 -1
  329. package/build/esm/sdk/client.js +0 -154
  330. package/build/esm/sdk/client.js.map +0 -1
  331. package/build/esm/transports/http.js +0 -156
  332. package/build/esm/transports/http.js.map +0 -1
  333. package/build/esm/utils/addOriginToSpan.js +0 -9
  334. package/build/esm/utils/addOriginToSpan.js.map +0 -1
  335. package/build/esm/utils/baggage.js +0 -34
  336. package/build/esm/utils/baggage.js.map +0 -1
  337. package/build/esm/utils/commonjs.js +0 -11
  338. package/build/esm/utils/commonjs.js.map +0 -1
  339. package/build/esm/utils/createMissingInstrumentationContext.js +0 -9
  340. package/build/esm/utils/createMissingInstrumentationContext.js.map +0 -1
  341. package/build/esm/utils/debug.js +0 -21
  342. package/build/esm/utils/debug.js.map +0 -1
  343. package/build/esm/utils/ensureIsWrapped.js +0 -39
  344. package/build/esm/utils/ensureIsWrapped.js.map +0 -1
  345. package/build/esm/utils/envToBool.js +0 -28
  346. package/build/esm/utils/envToBool.js.map +0 -1
  347. package/build/esm/utils/errorhandling.js +0 -40
  348. package/build/esm/utils/errorhandling.js.map +0 -1
  349. package/build/esm/utils/getRequestUrl.js +0 -16
  350. package/build/esm/utils/getRequestUrl.js.map +0 -1
  351. package/build/esm/utils/module.js +0 -58
  352. package/build/esm/utils/module.js.map +0 -1
  353. package/build/types/cron/common.d.ts +0 -5
  354. package/build/types/cron/common.d.ts.map +0 -1
  355. package/build/types/cron/cron.d.ts +0 -43
  356. package/build/types/cron/cron.d.ts.map +0 -1
  357. package/build/types/cron/index.d.ts +0 -10
  358. package/build/types/cron/index.d.ts.map +0 -1
  359. package/build/types/cron/node-cron.d.ts +0 -27
  360. package/build/types/cron/node-cron.d.ts.map +0 -1
  361. package/build/types/cron/node-schedule.d.ts +0 -19
  362. package/build/types/cron/node-schedule.d.ts.map +0 -1
  363. package/build/types/integrations/anr/common.d.ts +0 -52
  364. package/build/types/integrations/anr/common.d.ts.map +0 -1
  365. package/build/types/integrations/anr/index.d.ts +0 -13
  366. package/build/types/integrations/anr/index.d.ts.map +0 -1
  367. package/build/types/integrations/anr/worker.d.ts +0 -2
  368. package/build/types/integrations/anr/worker.d.ts.map +0 -1
  369. package/build/types/integrations/childProcess.d.ts +0 -20
  370. package/build/types/integrations/childProcess.d.ts.map +0 -1
  371. package/build/types/integrations/context.d.ts +0 -30
  372. package/build/types/integrations/context.d.ts.map +0 -1
  373. package/build/types/integrations/contextlines.d.ts +0 -31
  374. package/build/types/integrations/contextlines.d.ts.map +0 -1
  375. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts +0 -131
  376. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts.map +0 -1
  377. package/build/types/integrations/local-variables/common.d.ts +0 -66
  378. package/build/types/integrations/local-variables/common.d.ts.map +0 -1
  379. package/build/types/integrations/local-variables/index.d.ts +0 -4
  380. package/build/types/integrations/local-variables/index.d.ts.map +0 -1
  381. package/build/types/integrations/local-variables/local-variables-async.d.ts +0 -7
  382. package/build/types/integrations/local-variables/local-variables-async.d.ts.map +0 -1
  383. package/build/types/integrations/local-variables/local-variables-sync.d.ts +0 -34
  384. package/build/types/integrations/local-variables/local-variables-sync.d.ts.map +0 -1
  385. package/build/types/integrations/local-variables/worker.d.ts +0 -2
  386. package/build/types/integrations/local-variables/worker.d.ts.map +0 -1
  387. package/build/types/integrations/modules.d.ts +0 -17
  388. package/build/types/integrations/modules.d.ts.map +0 -1
  389. package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +0 -56
  390. package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts.map +0 -1
  391. package/build/types/integrations/onuncaughtexception.d.ts +0 -31
  392. package/build/types/integrations/onuncaughtexception.d.ts.map +0 -1
  393. package/build/types/integrations/onunhandledrejection.d.ts +0 -23
  394. package/build/types/integrations/onunhandledrejection.d.ts.map +0 -1
  395. package/build/types/integrations/processSession.d.ts +0 -5
  396. package/build/types/integrations/processSession.d.ts.map +0 -1
  397. package/build/types/integrations/spotlight.d.ts +0 -18
  398. package/build/types/integrations/spotlight.d.ts.map +0 -1
  399. package/build/types/integrations/winston.d.ts +0 -44
  400. package/build/types/integrations/winston.d.ts.map +0 -1
  401. package/build/types/logs/capture.d.ts +0 -11
  402. package/build/types/logs/capture.d.ts.map +0 -1
  403. package/build/types/logs/exports.d.ts +0 -150
  404. package/build/types/logs/exports.d.ts.map +0 -1
  405. package/build/types/nodeVersion.d.ts +0 -8
  406. package/build/types/nodeVersion.d.ts.map +0 -1
  407. package/build/types/otel/contextManager.d.ts +0 -10
  408. package/build/types/otel/contextManager.d.ts.map +0 -1
  409. package/build/types/otel/instrument.d.ts +0 -23
  410. package/build/types/otel/instrument.d.ts.map +0 -1
  411. package/build/types/proxy/base.d.ts +0 -65
  412. package/build/types/proxy/base.d.ts.map +0 -1
  413. package/build/types/proxy/helpers.d.ts +0 -42
  414. package/build/types/proxy/helpers.d.ts.map +0 -1
  415. package/build/types/proxy/index.d.ts +0 -73
  416. package/build/types/proxy/index.d.ts.map +0 -1
  417. package/build/types/proxy/parse-proxy-response.d.ts +0 -43
  418. package/build/types/proxy/parse-proxy-response.d.ts.map +0 -1
  419. package/build/types/sdk/api.d.ts +0 -8
  420. package/build/types/sdk/api.d.ts.map +0 -1
  421. package/build/types/sdk/client.d.ts +0 -29
  422. package/build/types/sdk/client.d.ts.map +0 -1
  423. package/build/types/sdk/scope.d.ts +0 -7
  424. package/build/types/sdk/scope.d.ts.map +0 -1
  425. package/build/types/transports/http-module.d.ts +0 -31
  426. package/build/types/transports/http-module.d.ts.map +0 -1
  427. package/build/types/transports/http.d.ts +0 -21
  428. package/build/types/transports/http.d.ts.map +0 -1
  429. package/build/types/transports/index.d.ts +0 -3
  430. package/build/types/transports/index.d.ts.map +0 -1
  431. package/build/types/utils/addOriginToSpan.d.ts +0 -5
  432. package/build/types/utils/addOriginToSpan.d.ts.map +0 -1
  433. package/build/types/utils/baggage.d.ts +0 -6
  434. package/build/types/utils/baggage.d.ts.map +0 -1
  435. package/build/types/utils/commonjs.d.ts +0 -3
  436. package/build/types/utils/commonjs.d.ts.map +0 -1
  437. package/build/types/utils/createMissingInstrumentationContext.d.ts +0 -3
  438. package/build/types/utils/createMissingInstrumentationContext.d.ts.map +0 -1
  439. package/build/types/utils/debug.d.ts +0 -5
  440. package/build/types/utils/debug.d.ts.map +0 -1
  441. package/build/types/utils/ensureIsWrapped.d.ts +0 -5
  442. package/build/types/utils/ensureIsWrapped.d.ts.map +0 -1
  443. package/build/types/utils/entry-point.d.ts +0 -24
  444. package/build/types/utils/entry-point.d.ts.map +0 -1
  445. package/build/types/utils/envToBool.d.ts +0 -13
  446. package/build/types/utils/envToBool.d.ts.map +0 -1
  447. package/build/types/utils/errorhandling.d.ts +0 -5
  448. package/build/types/utils/errorhandling.d.ts.map +0 -1
  449. package/build/types/utils/getRequestUrl.d.ts +0 -5
  450. package/build/types/utils/getRequestUrl.d.ts.map +0 -1
  451. package/build/types/utils/module.d.ts +0 -3
  452. package/build/types/utils/module.d.ts.map +0 -1
  453. package/build/types/utils/prepareEvent.d.ts +0 -17
  454. package/build/types/utils/prepareEvent.d.ts.map +0 -1
  455. package/build/types-ts3.8/cron/common.d.ts +0 -5
  456. package/build/types-ts3.8/cron/cron.d.ts +0 -43
  457. package/build/types-ts3.8/cron/index.d.ts +0 -10
  458. package/build/types-ts3.8/cron/node-cron.d.ts +0 -27
  459. package/build/types-ts3.8/cron/node-schedule.d.ts +0 -19
  460. package/build/types-ts3.8/integrations/anr/common.d.ts +0 -52
  461. package/build/types-ts3.8/integrations/anr/index.d.ts +0 -13
  462. package/build/types-ts3.8/integrations/anr/worker.d.ts +0 -2
  463. package/build/types-ts3.8/integrations/childProcess.d.ts +0 -20
  464. package/build/types-ts3.8/integrations/context.d.ts +0 -30
  465. package/build/types-ts3.8/integrations/contextlines.d.ts +0 -31
  466. package/build/types-ts3.8/integrations/http/SentryHttpInstrumentation.d.ts +0 -133
  467. package/build/types-ts3.8/integrations/local-variables/common.d.ts +0 -66
  468. package/build/types-ts3.8/integrations/local-variables/index.d.ts +0 -4
  469. package/build/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +0 -7
  470. package/build/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +0 -34
  471. package/build/types-ts3.8/integrations/local-variables/worker.d.ts +0 -2
  472. package/build/types-ts3.8/integrations/modules.d.ts +0 -17
  473. package/build/types-ts3.8/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +0 -56
  474. package/build/types-ts3.8/integrations/onuncaughtexception.d.ts +0 -31
  475. package/build/types-ts3.8/integrations/onunhandledrejection.d.ts +0 -23
  476. package/build/types-ts3.8/integrations/processSession.d.ts +0 -5
  477. package/build/types-ts3.8/integrations/spotlight.d.ts +0 -18
  478. package/build/types-ts3.8/integrations/winston.d.ts +0 -44
  479. package/build/types-ts3.8/logs/capture.d.ts +0 -18
  480. package/build/types-ts3.8/logs/exports.d.ts +0 -150
  481. package/build/types-ts3.8/nodeVersion.d.ts +0 -8
  482. package/build/types-ts3.8/otel/contextManager.d.ts +0 -10
  483. package/build/types-ts3.8/otel/instrument.d.ts +0 -23
  484. package/build/types-ts3.8/proxy/base.d.ts +0 -60
  485. package/build/types-ts3.8/proxy/helpers.d.ts +0 -38
  486. package/build/types-ts3.8/proxy/index.d.ts +0 -74
  487. package/build/types-ts3.8/proxy/parse-proxy-response.d.ts +0 -40
  488. package/build/types-ts3.8/sdk/api.d.ts +0 -8
  489. package/build/types-ts3.8/sdk/client.d.ts +0 -32
  490. package/build/types-ts3.8/sdk/scope.d.ts +0 -7
  491. package/build/types-ts3.8/transports/http-module.d.ts +0 -28
  492. package/build/types-ts3.8/transports/http.d.ts +0 -20
  493. package/build/types-ts3.8/transports/index.d.ts +0 -3
  494. package/build/types-ts3.8/utils/addOriginToSpan.d.ts +0 -5
  495. package/build/types-ts3.8/utils/baggage.d.ts +0 -6
  496. package/build/types-ts3.8/utils/commonjs.d.ts +0 -3
  497. package/build/types-ts3.8/utils/createMissingInstrumentationContext.d.ts +0 -3
  498. package/build/types-ts3.8/utils/debug.d.ts +0 -5
  499. package/build/types-ts3.8/utils/ensureIsWrapped.d.ts +0 -5
  500. package/build/types-ts3.8/utils/entry-point.d.ts +0 -24
  501. package/build/types-ts3.8/utils/envToBool.d.ts +0 -13
  502. package/build/types-ts3.8/utils/errorhandling.d.ts +0 -5
  503. package/build/types-ts3.8/utils/getRequestUrl.d.ts +0 -5
  504. package/build/types-ts3.8/utils/module.d.ts +0 -3
  505. package/build/types-ts3.8/utils/prepareEvent.d.ts +0 -17
@@ -2,21 +2,20 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationAmqplib = require('@opentelemetry/instrumentation-amqplib');
4
4
  const core = require('@sentry/core');
5
- const instrument = require('../../otel/instrument.js');
6
- const addOriginToSpan = require('../../utils/addOriginToSpan.js');
5
+ const nodeCore = require('@sentry/node-core');
7
6
 
8
7
  const INTEGRATION_NAME = 'Amqplib';
9
8
 
10
9
  const config = {
11
10
  consumeEndHook: (span) => {
12
- addOriginToSpan.addOriginToSpan(span, 'auto.amqplib.otel.consumer');
11
+ nodeCore.addOriginToSpan(span, 'auto.amqplib.otel.consumer');
13
12
  },
14
13
  publishHook: (span) => {
15
- addOriginToSpan.addOriginToSpan(span, 'auto.amqplib.otel.publisher');
14
+ nodeCore.addOriginToSpan(span, 'auto.amqplib.otel.publisher');
16
15
  },
17
16
  };
18
17
 
19
- const instrumentAmqplib = instrument.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentationAmqplib.AmqplibInstrumentation(config));
18
+ const instrumentAmqplib = nodeCore.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentationAmqplib.AmqplibInstrumentation(config));
20
19
 
21
20
  const _amqplibIntegration = (() => {
22
21
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"amqplib.js","sources":["../../../../src/integrations/tracing/amqplib.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport { type AmqplibInstrumentationConfig, AmqplibInstrumentation } from '@opentelemetry/instrumentation-amqplib';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../otel/instrument';\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\n\nconst INTEGRATION_NAME = 'Amqplib';\n\nconst config: AmqplibInstrumentationConfig = {\n consumeEndHook: (span: Span) => {\n addOriginToSpan(span, 'auto.amqplib.otel.consumer');\n },\n publishHook: (span: Span) => {\n addOriginToSpan(span, 'auto.amqplib.otel.publisher');\n },\n};\n\nexport const instrumentAmqplib = generateInstrumentOnce(INTEGRATION_NAME, () => new AmqplibInstrumentation(config));\n\nconst _amqplibIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentAmqplib();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [amqplib](https://www.npmjs.com/package/amqplib) library.\n *\n * For more information, see the [`amqplibIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/amqplib/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.amqplibIntegration()],\n * });\n * ```\n */\nexport const amqplibIntegration = defineIntegration(_amqplibIntegration);\n"],"names":["addOriginToSpan","generateInstrumentOnce","AmqplibInstrumentation","defineIntegration"],"mappings":";;;;;;;AAOA,MAAM,gBAAA,GAAmB,SAAS;;AAElC,MAAM,MAAM,GAAiC;AAC7C,EAAE,cAAc,EAAE,CAAC,IAAI,KAAW;AAClC,IAAIA,+BAAe,CAAC,IAAI,EAAE,4BAA4B,CAAC;AACvD,GAAG;AACH,EAAE,WAAW,EAAE,CAAC,IAAI,KAAW;AAC/B,IAAIA,+BAAe,CAAC,IAAI,EAAE,6BAA6B,CAAC;AACxD,GAAG;AACH,CAAC;;AAEY,MAAA,iBAAA,GAAoBC,iCAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,6CAAsB,CAAC,MAAM,CAAC;;AAElH,MAAM,mBAAoB,IAAG,MAAM;AACnC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,iBAAiB,EAAE;AACzB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,kBAAmB,GAAEC,sBAAiB,CAAC,mBAAmB;;;;;"}
1
+ {"version":3,"file":"amqplib.js","sources":["../../../../src/integrations/tracing/amqplib.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport { type AmqplibInstrumentationConfig, AmqplibInstrumentation } from '@opentelemetry/instrumentation-amqplib';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Amqplib';\n\nconst config: AmqplibInstrumentationConfig = {\n consumeEndHook: (span: Span) => {\n addOriginToSpan(span, 'auto.amqplib.otel.consumer');\n },\n publishHook: (span: Span) => {\n addOriginToSpan(span, 'auto.amqplib.otel.publisher');\n },\n};\n\nexport const instrumentAmqplib = generateInstrumentOnce(INTEGRATION_NAME, () => new AmqplibInstrumentation(config));\n\nconst _amqplibIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentAmqplib();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [amqplib](https://www.npmjs.com/package/amqplib) library.\n *\n * For more information, see the [`amqplibIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/amqplib/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.amqplibIntegration()],\n * });\n * ```\n */\nexport const amqplibIntegration = defineIntegration(_amqplibIntegration);\n"],"names":["addOriginToSpan","generateInstrumentOnce","AmqplibInstrumentation","defineIntegration"],"mappings":";;;;;;AAMA,MAAM,gBAAA,GAAmB,SAAS;;AAElC,MAAM,MAAM,GAAiC;AAC7C,EAAE,cAAc,EAAE,CAAC,IAAI,KAAW;AAClC,IAAIA,wBAAe,CAAC,IAAI,EAAE,4BAA4B,CAAC;AACvD,GAAG;AACH,EAAE,WAAW,EAAE,CAAC,IAAI,KAAW;AAC/B,IAAIA,wBAAe,CAAC,IAAI,EAAE,6BAA6B,CAAC;AACxD,GAAG;AACH,CAAC;;AAEY,MAAA,iBAAA,GAAoBC,+BAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,6CAAsB,CAAC,MAAM,CAAC;;AAElH,MAAM,mBAAoB,IAAG,MAAM;AACnC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,iBAAiB,EAAE;AACzB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,kBAAmB,GAAEC,sBAAiB,CAAC,mBAAmB;;;;;"}
@@ -2,12 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationConnect = require('@opentelemetry/instrumentation-connect');
4
4
  const core = require('@sentry/core');
5
- const instrument = require('../../otel/instrument.js');
6
- const ensureIsWrapped = require('../../utils/ensureIsWrapped.js');
5
+ const nodeCore = require('@sentry/node-core');
7
6
 
8
7
  const INTEGRATION_NAME = 'Connect';
9
8
 
10
- const instrumentConnect = instrument.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentationConnect.ConnectInstrumentation());
9
+ const instrumentConnect = nodeCore.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentationConnect.ConnectInstrumentation());
11
10
 
12
11
  const _connectIntegration = (() => {
13
12
  return {
@@ -74,7 +73,7 @@ const setupConnectErrorHandler = (app) => {
74
73
  });
75
74
  }
76
75
 
77
- ensureIsWrapped.ensureIsWrapped(app.use, 'connect');
76
+ nodeCore.ensureIsWrapped(app.use, 'connect');
78
77
  };
79
78
 
80
79
  function addConnectSpanAttributes(span) {
@@ -1 +1 @@
1
- {"version":3,"file":"connect.js","sources":["../../../../src/integrations/tracing/connect.ts"],"sourcesContent":["import { ConnectInstrumentation } from '@opentelemetry/instrumentation-connect';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n captureException,\n defineIntegration,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} from '@sentry/core';\nimport { generateInstrumentOnce } from '../../otel/instrument';\nimport { ensureIsWrapped } from '../../utils/ensureIsWrapped';\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 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\n // Sadly, ConnectInstrumentation has no requestHook, so we need to add the attributes here\n // We register this hook in this method, because if we register it in the integration `setup`,\n // it would always run even for users that are not even using connect\n const client = getClient();\n if (client) {\n client.on('spanStart', span => {\n addConnectSpanAttributes(span);\n });\n }\n\n ensureIsWrapped(app.use, 'connect');\n};\n\nfunction addConnectSpanAttributes(span: Span): void {\n const attributes = spanToJSON(span).data;\n\n // this is one of: middleware, request_handler\n const type = attributes['connect.type'];\n\n // If this is already set, or we have no connect span, no need to process again...\n if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] || !type) {\n return;\n }\n\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.connect',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.connect`,\n });\n\n // Also update the name, we don't need the \"middleware - \" prefix\n const name = attributes['connect.name'];\n if (typeof name === 'string') {\n span.updateName(name);\n }\n}\n"],"names":["generateInstrumentOnce","ConnectInstrumentation","defineIntegration","captureException","getClient","ensureIsWrapped","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN"],"mappings":";;;;;;;AAkBA,MAAM,gBAAA,GAAmB,SAAS;;AAErB,MAAA,iBAAA,GAAoBA,iCAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,6CAAsB,EAAE;;AAE5G,MAAM,mBAAoB,IAAG,MAAM;AACnC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,iBAAiB,EAAE;AACzB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,kBAAmB,GAAEC,sBAAiB,CAAC,mBAAmB;;AAEvE;AACA,SAAS,sBAAsB,CAAC,GAAG,EAAO,GAAG,EAAO,GAAG,EAAO,IAAI,EAAa;AAC/E,EAAEC,qBAAgB,CAAC,GAAG,CAAC;AACvB,EAAE,IAAI,CAAC,GAAG,CAAC;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACa,MAAA,wBAAA,GAA2B,CAAC,GAAG,KAAuB;AACnE,EAAE,GAAG,CAAC,GAAG,CAAC,sBAAsB,CAAC;;AAEjC;AACA;AACA;AACA,EAAE,MAAM,MAAA,GAASC,cAAS,EAAE;AAC5B,EAAE,IAAI,MAAM,EAAE;AACd,IAAI,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ;AACnC,MAAM,wBAAwB,CAAC,IAAI,CAAC;AACpC,KAAK,CAAC;AACN;;AAEA,EAAEC,+BAAe,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC;AACrC;;AAEA,SAAS,wBAAwB,CAAC,IAAI,EAAc;AACpD,EAAE,MAAM,aAAaC,eAAU,CAAC,IAAI,CAAC,CAAC,IAAI;;AAE1C;AACA,EAAE,MAAM,IAAK,GAAE,UAAU,CAAC,cAAc,CAAC;;AAEzC;AACA,EAAE,IAAI,UAAU,CAACC,iCAA4B,CAAE,IAAG,CAAC,IAAI,EAAE;AACzD,IAAI;AACJ;;AAEA,EAAE,IAAI,CAAC,aAAa,CAAC;AACrB,IAAI,CAACC,qCAAgC,GAAG,wBAAwB;AAChE,IAAI,CAACD,iCAA4B,GAAG,CAAC,EAAA,IAAA,CAAA,QAAA,CAAA;AACA,GAAA,CAAA;;AAEA;AACA,EAAA,MAAA,IAAA,GAAA,UAAA,CAAA,cAAA,CAAA;AACA,EAAA,IAAA,OAAA,IAAA,KAAA,QAAA,EAAA;AACA,IAAA,IAAA,CAAA,UAAA,CAAA,IAAA,CAAA;AACA;AACA;;;;;;"}
1
+ {"version":3,"file":"connect.js","sources":["../../../../src/integrations/tracing/connect.ts"],"sourcesContent":["import { ConnectInstrumentation } from '@opentelemetry/instrumentation-connect';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n captureException,\n defineIntegration,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} 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 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\n // Sadly, ConnectInstrumentation has no requestHook, so we need to add the attributes here\n // We register this hook in this method, because if we register it in the integration `setup`,\n // it would always run even for users that are not even using connect\n const client = getClient();\n if (client) {\n client.on('spanStart', span => {\n addConnectSpanAttributes(span);\n });\n }\n\n ensureIsWrapped(app.use, 'connect');\n};\n\nfunction addConnectSpanAttributes(span: Span): void {\n const attributes = spanToJSON(span).data;\n\n // this is one of: middleware, request_handler\n const type = attributes['connect.type'];\n\n // If this is already set, or we have no connect span, no need to process again...\n if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] || !type) {\n return;\n }\n\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.connect',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.connect`,\n });\n\n // Also update the name, we don't need the \"middleware - \" prefix\n const name = attributes['connect.name'];\n if (typeof name === 'string') {\n span.updateName(name);\n }\n}\n"],"names":["generateInstrumentOnce","ConnectInstrumentation","defineIntegration","captureException","getClient","ensureIsWrapped","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN"],"mappings":";;;;;;AAiBA,MAAM,gBAAA,GAAmB,SAAS;;AAErB,MAAA,iBAAA,GAAoBA,+BAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,6CAAsB,EAAE;;AAE5G,MAAM,mBAAoB,IAAG,MAAM;AACnC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,iBAAiB,EAAE;AACzB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,kBAAmB,GAAEC,sBAAiB,CAAC,mBAAmB;;AAEvE;AACA,SAAS,sBAAsB,CAAC,GAAG,EAAO,GAAG,EAAO,GAAG,EAAO,IAAI,EAAa;AAC/E,EAAEC,qBAAgB,CAAC,GAAG,CAAC;AACvB,EAAE,IAAI,CAAC,GAAG,CAAC;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACa,MAAA,wBAAA,GAA2B,CAAC,GAAG,KAAuB;AACnE,EAAE,GAAG,CAAC,GAAG,CAAC,sBAAsB,CAAC;;AAEjC;AACA;AACA;AACA,EAAE,MAAM,MAAA,GAASC,cAAS,EAAE;AAC5B,EAAE,IAAI,MAAM,EAAE;AACd,IAAI,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ;AACnC,MAAM,wBAAwB,CAAC,IAAI,CAAC;AACpC,KAAK,CAAC;AACN;;AAEA,EAAEC,wBAAe,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC;AACrC;;AAEA,SAAS,wBAAwB,CAAC,IAAI,EAAc;AACpD,EAAE,MAAM,aAAaC,eAAU,CAAC,IAAI,CAAC,CAAC,IAAI;;AAE1C;AACA,EAAE,MAAM,IAAK,GAAE,UAAU,CAAC,cAAc,CAAC;;AAEzC;AACA,EAAE,IAAI,UAAU,CAACC,iCAA4B,CAAE,IAAG,CAAC,IAAI,EAAE;AACzD,IAAI;AACJ;;AAEA,EAAE,IAAI,CAAC,aAAa,CAAC;AACrB,IAAI,CAACC,qCAAgC,GAAG,wBAAwB;AAChE,IAAI,CAACD,iCAA4B,GAAG,CAAC,EAAA,IAAA,CAAA,QAAA,CAAA;AACA,GAAA,CAAA;;AAEA;AACA,EAAA,MAAA,IAAA,GAAA,UAAA,CAAA,cAAA,CAAA;AACA,EAAA,IAAA,OAAA,IAAA,KAAA,QAAA,EAAA;AACA,IAAA,IAAA,CAAA,UAAA,CAAA,IAAA,CAAA;AACA;AACA;;;;;;"}
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationDataloader = require('@opentelemetry/instrumentation-dataloader');
4
4
  const core = require('@sentry/core');
5
- const instrument = require('../../otel/instrument.js');
5
+ const nodeCore = require('@sentry/node-core');
6
6
 
7
7
  const INTEGRATION_NAME = 'Dataloader';
8
8
 
9
- const instrumentDataloader = instrument.generateInstrumentOnce(
9
+ const instrumentDataloader = nodeCore.generateInstrumentOnce(
10
10
  INTEGRATION_NAME,
11
11
  () =>
12
12
  new instrumentationDataloader.DataloaderInstrumentation({
@@ -21,7 +21,7 @@ const _dataloaderIntegration = (() => {
21
21
  name: INTEGRATION_NAME,
22
22
  setupOnce() {
23
23
  const instrumentation = instrumentDataloader();
24
- instrumentationWrappedCallback = instrument.instrumentWhenWrapped(instrumentation);
24
+ instrumentationWrappedCallback = nodeCore.instrumentWhenWrapped(instrumentation);
25
25
  },
26
26
 
27
27
  setup(client) {
@@ -1 +1 @@
1
- {"version":3,"file":"dataloader.js","sources":["../../../../src/integrations/tracing/dataloader.ts"],"sourcesContent":["import { DataloaderInstrumentation } from '@opentelemetry/instrumentation-dataloader';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} from '@sentry/core';\nimport { generateInstrumentOnce, instrumentWhenWrapped } from '../../otel/instrument';\n\nconst INTEGRATION_NAME = 'Dataloader';\n\nexport const instrumentDataloader = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new DataloaderInstrumentation({\n requireParentSpan: true,\n }),\n);\n\nconst _dataloaderIntegration = (() => {\n let instrumentationWrappedCallback: undefined | ((callback: () => void) => void);\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n const instrumentation = instrumentDataloader();\n instrumentationWrappedCallback = instrumentWhenWrapped(instrumentation);\n },\n\n setup(client) {\n // This is called either immediately or when the instrumentation is wrapped\n instrumentationWrappedCallback?.(() => {\n client.on('spanStart', span => {\n const spanJSON = spanToJSON(span);\n if (spanJSON.description?.startsWith('dataloader')) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.dataloader');\n }\n\n // These are all possible dataloader span descriptions\n // Still checking for the future versions\n // in case they add support for `clear` and `prime`\n if (\n spanJSON.description === 'dataloader.load' ||\n spanJSON.description === 'dataloader.loadMany' ||\n spanJSON.description === 'dataloader.batch'\n ) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'cache.get');\n // TODO: We can try adding `key` to the `data` attribute upstream.\n // Or alternatively, we can add `requestHook` to the dataloader instrumentation.\n }\n });\n });\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","instrumentWhenWrapped","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","defineIntegration"],"mappings":";;;;;;AAUA,MAAM,gBAAA,GAAmB,YAAY;;AAE9B,MAAM,oBAAqB,GAAEA,iCAAsB;AAC1D,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,mDAAyB,CAAC;AAClC,MAAM,iBAAiB,EAAE,IAAI;AAC7B,KAAK,CAAC;AACN;;AAEA,MAAM,sBAAuB,IAAG,MAAM;AACtC,EAAE,IAAI,8BAA8B;;AAEpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,MAAM,eAAA,GAAkB,oBAAoB,EAAE;AACpD,MAAM,8BAA+B,GAAEC,gCAAqB,CAAC,eAAe,CAAC;AAC7E,KAAK;;AAEL,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB;AACA,MAAM,8BAA8B,GAAG,MAAM;AAC7C,QAAQ,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ;AACvC,UAAU,MAAM,QAAS,GAAEC,eAAU,CAAC,IAAI,CAAC;AAC3C,UAAU,IAAI,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE;AAC9D,YAAY,IAAI,CAAC,YAAY,CAACC,qCAAgC,EAAE,yBAAyB,CAAC;AAC1F;;AAEA;AACA;AACA;AACA,UAAU;AACV,YAAY,QAAQ,CAAC,WAAY,KAAI,iBAAkB;AACvD,YAAY,QAAQ,CAAC,WAAY,KAAI,qBAAsB;AAC3D,YAAY,QAAQ,CAAC,WAAA,KAAgB;AACrC,YAAY;AACZ,YAAY,IAAI,CAAC,YAAY,CAACC,iCAA4B,EAAE,WAAW,CAAC;AACxE;AACA;AACA;AACA,SAAS,CAAC;AACV,OAAO,CAAC;AACR,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,qBAAsB,GAAEC,sBAAiB,CAAC,sBAAsB;;;;;"}
1
+ {"version":3,"file":"dataloader.js","sources":["../../../../src/integrations/tracing/dataloader.ts"],"sourcesContent":["import { DataloaderInstrumentation } from '@opentelemetry/instrumentation-dataloader';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} from '@sentry/core';\nimport { generateInstrumentOnce, instrumentWhenWrapped } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Dataloader';\n\nexport const instrumentDataloader = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new DataloaderInstrumentation({\n requireParentSpan: true,\n }),\n);\n\nconst _dataloaderIntegration = (() => {\n let instrumentationWrappedCallback: undefined | ((callback: () => void) => void);\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n const instrumentation = instrumentDataloader();\n instrumentationWrappedCallback = instrumentWhenWrapped(instrumentation);\n },\n\n setup(client) {\n // This is called either immediately or when the instrumentation is wrapped\n instrumentationWrappedCallback?.(() => {\n client.on('spanStart', span => {\n const spanJSON = spanToJSON(span);\n if (spanJSON.description?.startsWith('dataloader')) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.dataloader');\n }\n\n // These are all possible dataloader span descriptions\n // Still checking for the future versions\n // in case they add support for `clear` and `prime`\n if (\n spanJSON.description === 'dataloader.load' ||\n spanJSON.description === 'dataloader.loadMany' ||\n spanJSON.description === 'dataloader.batch'\n ) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'cache.get');\n // TODO: We can try adding `key` to the `data` attribute upstream.\n // Or alternatively, we can add `requestHook` to the dataloader instrumentation.\n }\n });\n });\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","instrumentWhenWrapped","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","defineIntegration"],"mappings":";;;;;;AAUA,MAAM,gBAAA,GAAmB,YAAY;;AAE9B,MAAM,oBAAqB,GAAEA,+BAAsB;AAC1D,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,mDAAyB,CAAC;AAClC,MAAM,iBAAiB,EAAE,IAAI;AAC7B,KAAK,CAAC;AACN;;AAEA,MAAM,sBAAuB,IAAG,MAAM;AACtC,EAAE,IAAI,8BAA8B;;AAEpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,MAAM,eAAA,GAAkB,oBAAoB,EAAE;AACpD,MAAM,8BAA+B,GAAEC,8BAAqB,CAAC,eAAe,CAAC;AAC7E,KAAK;;AAEL,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB;AACA,MAAM,8BAA8B,GAAG,MAAM;AAC7C,QAAQ,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ;AACvC,UAAU,MAAM,QAAS,GAAEC,eAAU,CAAC,IAAI,CAAC;AAC3C,UAAU,IAAI,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE;AAC9D,YAAY,IAAI,CAAC,YAAY,CAACC,qCAAgC,EAAE,yBAAyB,CAAC;AAC1F;;AAEA;AACA;AACA;AACA,UAAU;AACV,YAAY,QAAQ,CAAC,WAAY,KAAI,iBAAkB;AACvD,YAAY,QAAQ,CAAC,WAAY,KAAI,qBAAsB;AAC3D,YAAY,QAAQ,CAAC,WAAA,KAAgB;AACrC,YAAY;AACZ,YAAY,IAAI,CAAC,YAAY,CAACC,iCAA4B,EAAE,WAAW,CAAC;AACxE;AACA;AACA;AACA,SAAS,CAAC;AACV,OAAO,CAAC;AACR,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,qBAAsB,GAAEC,sBAAiB,CAAC,sBAAsB;;;;;"}
@@ -2,17 +2,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationExpress = require('@opentelemetry/instrumentation-express');
4
4
  const core = require('@sentry/core');
5
+ const nodeCore = require('@sentry/node-core');
5
6
  const debugBuild = require('../../debug-build.js');
6
- const instrument = require('../../otel/instrument.js');
7
- const addOriginToSpan = require('../../utils/addOriginToSpan.js');
8
- const ensureIsWrapped = require('../../utils/ensureIsWrapped.js');
9
7
  const instrumentation = require('./express-v5/instrumentation.js');
10
8
 
11
9
  const INTEGRATION_NAME = 'Express';
12
10
  const INTEGRATION_NAME_V5 = 'Express-V5';
13
11
 
14
12
  function requestHook(span) {
15
- addOriginToSpan.addOriginToSpan(span, 'auto.http.otel.express');
13
+ nodeCore.addOriginToSpan(span, 'auto.http.otel.express');
16
14
 
17
15
  const attributes = core.spanToJSON(span).data;
18
16
  // this is one of: middleware, request_handler, router
@@ -43,7 +41,7 @@ function spanNameHook(info, defaultName) {
43
41
  return defaultName;
44
42
  }
45
43
 
46
- const instrumentExpress = instrument.generateInstrumentOnce(
44
+ const instrumentExpress = nodeCore.generateInstrumentOnce(
47
45
  INTEGRATION_NAME,
48
46
  () =>
49
47
  new instrumentationExpress.ExpressInstrumentation({
@@ -52,7 +50,7 @@ const instrumentExpress = instrument.generateInstrumentOnce(
52
50
  }),
53
51
  );
54
52
 
55
- const instrumentExpressV5 = instrument.generateInstrumentOnce(
53
+ const instrumentExpressV5 = nodeCore.generateInstrumentOnce(
56
54
  INTEGRATION_NAME_V5,
57
55
  () =>
58
56
  new instrumentation.ExpressInstrumentationV5({
@@ -159,7 +157,7 @@ function setupExpressErrorHandler(
159
157
  ) {
160
158
  app.use(expressRequestHandler());
161
159
  app.use(expressErrorHandler(options));
162
- ensureIsWrapped.ensureIsWrapped(app.use, 'express');
160
+ nodeCore.ensureIsWrapped(app.use, 'express');
163
161
  }
164
162
 
165
163
  function getStatusCodeFromResponse(error) {
@@ -1 +1 @@
1
- {"version":3,"file":"express.js","sources":["../../../../src/integrations/tracing/express.ts"],"sourcesContent":["import type * as http from 'node:http';\nimport type { Span } from '@opentelemetry/api';\nimport type { ExpressRequestInfo } from '@opentelemetry/instrumentation-express';\nimport { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n captureException,\n defineIntegration,\n getDefaultIsolationScope,\n getIsolationScope,\n httpRequestToRequestData,\n logger,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n spanToJSON,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { generateInstrumentOnce } from '../../otel/instrument';\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\nimport { ensureIsWrapped } from '../../utils/ensureIsWrapped';\nimport { ExpressInstrumentationV5 } from './express-v5/instrumentation';\n\nconst INTEGRATION_NAME = 'Express';\nconst INTEGRATION_NAME_V5 = 'Express-V5';\n\nfunction requestHook(span: Span): void {\n addOriginToSpan(span, 'auto.http.otel.express');\n\n const attributes = spanToJSON(span).data;\n // this is one of: middleware, request_handler, router\n const type = attributes['express.type'];\n\n if (type) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, `${type}.express`);\n }\n\n // Also update the name, we don't need to \"middleware - \" prefix\n const name = attributes['express.name'];\n if (typeof name === 'string') {\n span.updateName(name);\n }\n}\n\nfunction spanNameHook(info: ExpressRequestInfo<unknown>, defaultName: string): string {\n if (getIsolationScope() === getDefaultIsolationScope()) {\n DEBUG_BUILD && logger.warn('Isolation scope is still default isolation scope - skipping setting transactionName');\n return defaultName;\n }\n if (info.layerType === 'request_handler') {\n // type cast b/c Otel unfortunately types info.request as any :(\n const req = info.request as { method?: string };\n const method = req.method ? req.method.toUpperCase() : 'GET';\n getIsolationScope().setTransactionName(`${method} ${info.route}`);\n }\n return defaultName;\n}\n\nexport const instrumentExpress = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new ExpressInstrumentation({\n requestHook: span => requestHook(span),\n spanNameHook: (info, defaultName) => spanNameHook(info, defaultName),\n }),\n);\n\nexport const instrumentExpressV5 = generateInstrumentOnce(\n INTEGRATION_NAME_V5,\n () =>\n new ExpressInstrumentationV5({\n requestHook: span => requestHook(span),\n spanNameHook: (info, defaultName) => spanNameHook(info, defaultName),\n }),\n);\n\nconst _expressIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentExpress();\n instrumentExpressV5();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Express](https://expressjs.com/).\n *\n * If you also want to capture errors, you need to call `setupExpressErrorHandler(app)` after you set up your Express server.\n *\n * For more information, see the [express documentation](https://docs.sentry.io/platforms/javascript/guides/express/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.expressIntegration()],\n * })\n * ```\n */\nexport const expressIntegration = defineIntegration(_expressIntegration);\n\ninterface MiddlewareError extends Error {\n status?: number | string;\n statusCode?: number | string;\n status_code?: number | string;\n output?: {\n statusCode?: number | string;\n };\n}\n\ntype ExpressMiddleware = (req: http.IncomingMessage, res: http.ServerResponse, next: () => void) => void;\n\ntype ExpressErrorMiddleware = (\n error: MiddlewareError,\n req: http.IncomingMessage,\n res: http.ServerResponse,\n next: (error: MiddlewareError) => void,\n) => void;\n\ninterface ExpressHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * @param error Captured middleware error\n */\n shouldHandleError?(this: void, error: MiddlewareError): boolean;\n}\n\n/**\n * An Express-compatible error handler.\n */\nexport function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErrorMiddleware {\n return function sentryErrorMiddleware(\n error: MiddlewareError,\n request: http.IncomingMessage,\n res: http.ServerResponse,\n next: (error: MiddlewareError) => void,\n ): void {\n const normalizedRequest = httpRequestToRequestData(request);\n // Ensure we use the express-enhanced request here, instead of the plain HTTP one\n // When an error happens, the `expressRequestHandler` middleware does not run, so we set it here too\n getIsolationScope().setSDKProcessingMetadata({ normalizedRequest });\n\n const shouldHandleError = options?.shouldHandleError || defaultShouldHandleError;\n\n if (shouldHandleError(error)) {\n const eventId = captureException(error, { mechanism: { type: 'middleware', handled: false } });\n (res as { sentry?: string }).sentry = eventId;\n }\n\n next(error);\n };\n}\n\nfunction expressRequestHandler(): ExpressMiddleware {\n return function sentryRequestMiddleware(\n request: http.IncomingMessage,\n _res: http.ServerResponse,\n next: () => void,\n ): void {\n const normalizedRequest = httpRequestToRequestData(request);\n // Ensure we use the express-enhanced request here, instead of the plain HTTP one\n getIsolationScope().setSDKProcessingMetadata({ normalizedRequest });\n\n next();\n };\n}\n\n/**\n * Add an Express error handler to capture errors to Sentry.\n *\n * The error handler must be before any other middleware and after all controllers.\n *\n * @param app The Express instances\n * @param options {ExpressHandlerOptions} Configuration options for the handler\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const express = require(\"express\");\n *\n * const app = express();\n *\n * // Add your routes, etc.\n *\n * // Add this after all routes,\n * // but before any and other error-handling middlewares are defined\n * Sentry.setupExpressErrorHandler(app);\n *\n * app.listen(3000);\n * ```\n */\nexport function setupExpressErrorHandler(\n app: { use: (middleware: ExpressMiddleware | ExpressErrorMiddleware) => unknown },\n options?: ExpressHandlerOptions,\n): void {\n app.use(expressRequestHandler());\n app.use(expressErrorHandler(options));\n ensureIsWrapped(app.use, 'express');\n}\n\nfunction getStatusCodeFromResponse(error: MiddlewareError): number {\n const statusCode = error.status || error.statusCode || error.status_code || error.output?.statusCode;\n return statusCode ? parseInt(statusCode as string, 10) : 500;\n}\n\n/** Returns true if response code is internal server error */\nfunction defaultShouldHandleError(error: MiddlewareError): boolean {\n const status = getStatusCodeFromResponse(error);\n return status >= 500;\n}\n"],"names":["addOriginToSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","getIsolationScope","getDefaultIsolationScope","DEBUG_BUILD","logger","generateInstrumentOnce","ExpressInstrumentation","ExpressInstrumentationV5","defineIntegration","httpRequestToRequestData","captureException","ensureIsWrapped"],"mappings":";;;;;;;;;;AAqBA,MAAM,gBAAA,GAAmB,SAAS;AAClC,MAAM,mBAAA,GAAsB,YAAY;;AAExC,SAAS,WAAW,CAAC,IAAI,EAAc;AACvC,EAAEA,+BAAe,CAAC,IAAI,EAAE,wBAAwB,CAAC;;AAEjD,EAAE,MAAM,aAAaC,eAAU,CAAC,IAAI,CAAC,CAAC,IAAI;AAC1C;AACA,EAAE,MAAM,IAAK,GAAE,UAAU,CAAC,cAAc,CAAC;;AAEzC,EAAE,IAAI,IAAI,EAAE;AACZ,IAAI,IAAI,CAAC,YAAY,CAACC,iCAA4B,EAAE,CAAC,EAAA,IAAA,CAAA,QAAA,CAAA,CAAA;AACA;;AAEA;AACA,EAAA,MAAA,IAAA,GAAA,UAAA,CAAA,cAAA,CAAA;AACA,EAAA,IAAA,O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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,wBAAA;AACA,EAAA,GAAA;AACA,EAAA,OAAA;AACA,EAAA;AACA,EAAA,GAAA,CAAA,GAAA,CAAA,qBAAA,EAAA,CAAA;AACA,EAAA,GAAA,CAAA,GAAA,CAAA,mBAAA,CAAA,OAAA,CAAA,CAAA;AACA,EAAAU,+BAAA,CAAA,GAAA,CAAA,GAAA,EAAA,SAAA,CAAA;AACA;;AAEA,SAAA,yBAAA,CAAA,KAAA,EAAA;AACA,EAAA,MAAA,UAAA,GAAA,KAAA,CAAA,MAAA,IAAA,KAAA,CAAA,UAAA,IAAA,KAAA,CAAA,WAAA,IAAA,KAAA,CAAA,MAAA,EAAA,UAAA;AACA,EAAA,OAAA,UAAA,GAAA,QAAA,CAAA,UAAA,GAAA,EAAA,CAAA,GAAA,GAAA;AACA;;AAEA;AACA,SAAA,wBAAA,CAAA,KAAA,EAAA;AACA,EAAA,MAAA,MAAA,GAAA,yBAAA,CAAA,KAAA,CAAA;AACA,EAAA,OAAA,MAAA,IAAA,GAAA;AACA;;;;;;;;"}
1
+ {"version":3,"file":"express.js","sources":["../../../../src/integrations/tracing/express.ts"],"sourcesContent":["import type * as http from 'node:http';\nimport type { Span } from '@opentelemetry/api';\nimport type { ExpressRequestInfo } from '@opentelemetry/instrumentation-express';\nimport { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n captureException,\n defineIntegration,\n getDefaultIsolationScope,\n getIsolationScope,\n httpRequestToRequestData,\n logger,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n spanToJSON,\n} from '@sentry/core';\nimport { addOriginToSpan, ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { ExpressInstrumentationV5 } from './express-v5/instrumentation';\n\nconst INTEGRATION_NAME = 'Express';\nconst INTEGRATION_NAME_V5 = 'Express-V5';\n\nfunction requestHook(span: Span): void {\n addOriginToSpan(span, 'auto.http.otel.express');\n\n const attributes = spanToJSON(span).data;\n // this is one of: middleware, request_handler, router\n const type = attributes['express.type'];\n\n if (type) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, `${type}.express`);\n }\n\n // Also update the name, we don't need to \"middleware - \" prefix\n const name = attributes['express.name'];\n if (typeof name === 'string') {\n span.updateName(name);\n }\n}\n\nfunction spanNameHook(info: ExpressRequestInfo<unknown>, defaultName: string): string {\n if (getIsolationScope() === getDefaultIsolationScope()) {\n DEBUG_BUILD && logger.warn('Isolation scope is still default isolation scope - skipping setting transactionName');\n return defaultName;\n }\n if (info.layerType === 'request_handler') {\n // type cast b/c Otel unfortunately types info.request as any :(\n const req = info.request as { method?: string };\n const method = req.method ? req.method.toUpperCase() : 'GET';\n getIsolationScope().setTransactionName(`${method} ${info.route}`);\n }\n return defaultName;\n}\n\nexport const instrumentExpress = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new ExpressInstrumentation({\n requestHook: span => requestHook(span),\n spanNameHook: (info, defaultName) => spanNameHook(info, defaultName),\n }),\n);\n\nexport const instrumentExpressV5 = generateInstrumentOnce(\n INTEGRATION_NAME_V5,\n () =>\n new ExpressInstrumentationV5({\n requestHook: span => requestHook(span),\n spanNameHook: (info, defaultName) => spanNameHook(info, defaultName),\n }),\n);\n\nconst _expressIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentExpress();\n instrumentExpressV5();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Express](https://expressjs.com/).\n *\n * If you also want to capture errors, you need to call `setupExpressErrorHandler(app)` after you set up your Express server.\n *\n * For more information, see the [express documentation](https://docs.sentry.io/platforms/javascript/guides/express/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.expressIntegration()],\n * })\n * ```\n */\nexport const expressIntegration = defineIntegration(_expressIntegration);\n\ninterface MiddlewareError extends Error {\n status?: number | string;\n statusCode?: number | string;\n status_code?: number | string;\n output?: {\n statusCode?: number | string;\n };\n}\n\ntype ExpressMiddleware = (req: http.IncomingMessage, res: http.ServerResponse, next: () => void) => void;\n\ntype ExpressErrorMiddleware = (\n error: MiddlewareError,\n req: http.IncomingMessage,\n res: http.ServerResponse,\n next: (error: MiddlewareError) => void,\n) => void;\n\ninterface ExpressHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * @param error Captured middleware error\n */\n shouldHandleError?(this: void, error: MiddlewareError): boolean;\n}\n\n/**\n * An Express-compatible error handler.\n */\nexport function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErrorMiddleware {\n return function sentryErrorMiddleware(\n error: MiddlewareError,\n request: http.IncomingMessage,\n res: http.ServerResponse,\n next: (error: MiddlewareError) => void,\n ): void {\n const normalizedRequest = httpRequestToRequestData(request);\n // Ensure we use the express-enhanced request here, instead of the plain HTTP one\n // When an error happens, the `expressRequestHandler` middleware does not run, so we set it here too\n getIsolationScope().setSDKProcessingMetadata({ normalizedRequest });\n\n const shouldHandleError = options?.shouldHandleError || defaultShouldHandleError;\n\n if (shouldHandleError(error)) {\n const eventId = captureException(error, { mechanism: { type: 'middleware', handled: false } });\n (res as { sentry?: string }).sentry = eventId;\n }\n\n next(error);\n };\n}\n\nfunction expressRequestHandler(): ExpressMiddleware {\n return function sentryRequestMiddleware(\n request: http.IncomingMessage,\n _res: http.ServerResponse,\n next: () => void,\n ): void {\n const normalizedRequest = httpRequestToRequestData(request);\n // Ensure we use the express-enhanced request here, instead of the plain HTTP one\n getIsolationScope().setSDKProcessingMetadata({ normalizedRequest });\n\n next();\n };\n}\n\n/**\n * Add an Express error handler to capture errors to Sentry.\n *\n * The error handler must be before any other middleware and after all controllers.\n *\n * @param app The Express instances\n * @param options {ExpressHandlerOptions} Configuration options for the handler\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const express = require(\"express\");\n *\n * const app = express();\n *\n * // Add your routes, etc.\n *\n * // Add this after all routes,\n * // but before any and other error-handling middlewares are defined\n * Sentry.setupExpressErrorHandler(app);\n *\n * app.listen(3000);\n * ```\n */\nexport function setupExpressErrorHandler(\n app: { use: (middleware: ExpressMiddleware | ExpressErrorMiddleware) => unknown },\n options?: ExpressHandlerOptions,\n): void {\n app.use(expressRequestHandler());\n app.use(expressErrorHandler(options));\n ensureIsWrapped(app.use, 'express');\n}\n\nfunction getStatusCodeFromResponse(error: MiddlewareError): number {\n const statusCode = error.status || error.statusCode || error.status_code || error.output?.statusCode;\n return statusCode ? parseInt(statusCode as string, 10) : 500;\n}\n\n/** Returns true if response code is internal server error */\nfunction defaultShouldHandleError(error: MiddlewareError): boolean {\n const status = getStatusCodeFromResponse(error);\n return status >= 500;\n}\n"],"names":["addOriginToSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","getIsolationScope","getDefaultIsolationScope","DEBUG_BUILD","logger","generateInstrumentOnce","ExpressInstrumentation","ExpressInstrumentationV5","defineIntegration","httpRequestToRequestData","captureException","ensureIsWrapped"],"mappings":";;;;;;;;AAmBA,MAAM,gBAAA,GAAmB,SAAS;AAClC,MAAM,mBAAA,GAAsB,YAAY;;AAExC,SAAS,WAAW,CAAC,IAAI,EAAc;AACvC,EAAEA,wBAAe,CAAC,IAAI,EAAE,wBAAwB,CAAC;;AAEjD,EAAE,MAAM,aAAaC,eAAU,CAAC,IAAI,CAAC,CAAC,IAAI;AAC1C;AACA,EAAE,MAAM,IAAK,GAAE,UAAU,CAAC,cAAc,CAAC;;AAEzC,EAAE,IAAI,IAAI,EAAE;AACZ,IAAI,IAAI,CAAC,YAAY,CAACC,iCAA4B,EAAE,CAAC,EAAA,IAAA,CAAA,QAAA,CAAA,CAAA;AACA;;AAEA;AACA,EAAA,MAAA,IAAA,GAAA,UAAA,CAAA,cAAA,CAAA;AACA,EAAA,IAAA,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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,wBAAA;AACA,EAAA,GAAA;AACA,EAAA,OAAA;AACA,EAAA;AACA,EAAA,GAAA,CAAA,GAAA,CAAA,qBAAA,EAAA,CAAA;AACA,EAAA,GAAA,CAAA,GAAA,CAAA,mBAAA,CAAA,OAAA,CAAA,CAAA;AACA,EAAAU,wBAAA,CAAA,GAAA,CAAA,GAAA,EAAA,SAAA,CAAA;AACA;;AAEA,SAAA,yBAAA,CAAA,KAAA,EAAA;AACA,EAAA,MAAA,UAAA,GAAA,KAAA,CAAA,MAAA,IAAA,KAAA,CAAA,UAAA,IAAA,KAAA,CAAA,WAAA,IAAA,KAAA,CAAA,MAAA,EAAA,UAAA;AACA,EAAA,OAAA,UAAA,GAAA,QAAA,CAAA,UAAA,GAAA,EAAA,CAAA,GAAA,GAAA;AACA;;AAEA;AACA,SAAA,wBAAA,CAAA,KAAA,EAAA;AACA,EAAA,MAAA,MAAA,GAAA,yBAAA,CAAA,KAAA,CAAA;AACA,EAAA,OAAA,MAAA,IAAA,GAAA;AACA;;;;;;;;"}
@@ -1,10 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const diagnosticsChannel = require('node:diagnostics_channel');
3
+ const dc = require('node:diagnostics_channel');
4
4
  const api = require('@opentelemetry/api');
5
5
  const core = require('@opentelemetry/core');
6
6
  const instrumentation = require('@opentelemetry/instrumentation');
7
7
  const semanticConventions = require('@opentelemetry/semantic-conventions');
8
+ const minimatch = require('minimatch');
8
9
 
9
10
  /*
10
11
  Vendored in and modified from @fastify/otel version 0.8.0
@@ -91,18 +92,12 @@ class FastifyOtelInstrumentation extends instrumentation.InstrumentationBase {
91
92
  throw new TypeError('ignorePaths must be a string or a function');
92
93
  }
93
94
 
94
- let globMatcher = null;
95
+ const globMatcher = minimatch.minimatch;
95
96
 
96
97
  this[kIgnorePaths] = routeOptions => {
97
98
  if (typeof ignorePaths === 'function') {
98
99
  return ignorePaths(routeOptions);
99
100
  } else {
100
- // Using minimatch to match the path until path.matchesGlob is out of experimental
101
- // path.matchesGlob uses minimatch internally
102
- if (globMatcher == null) {
103
- globMatcher = require('minimatch').minimatch;
104
- }
105
-
106
101
  return globMatcher(routeOptions.url, ignorePaths);
107
102
  }
108
103
  };
@@ -115,14 +110,14 @@ class FastifyOtelInstrumentation extends instrumentation.InstrumentationBase {
115
110
  this._handleInitialization = message => {
116
111
  message.fastify.register(FastifyInstrumentationPlugin);
117
112
  };
118
- diagnosticsChannel.default.subscribe('fastify.initialization', this._handleInitialization);
113
+ dc.default.subscribe('fastify.initialization', this._handleInitialization);
119
114
  }
120
115
  return super.enable();
121
116
  }
122
117
 
123
118
  disable() {
124
119
  if (this._handleInitialization) {
125
- diagnosticsChannel.default.unsubscribe('fastify.initialization', this._handleInitialization);
120
+ dc.default.unsubscribe('fastify.initialization', this._handleInitialization);
126
121
  this._handleInitialization = undefined;
127
122
  }
128
123
  return super.disable();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../src/integrations/tracing/fastify/fastify-otel/index.js"],"sourcesContent":["/*\nVendored in and modified from @fastify/otel version 0.8.0\nhttps://github.com/fastify/otel/releases/tag/v0.8.0\n\nTried not to modify the original code too much keeping it as a JavaScript CJS module to make it easier to update when required\n\nModifications include:\n- Removed reading of package.json to get the version and package name\n\nMIT License\n\nCopyright (c) 2024 Fastify\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\n/* eslint-disable @typescript-eslint/explicit-member-accessibility */\n/* eslint-disable jsdoc/require-jsdoc */\n/* eslint-disable max-lines */\n/* eslint-disable no-param-reassign */\nimport dc from 'node:diagnostics_channel';\nimport { context, diag, propagation, SpanStatusCode, trace } from '@opentelemetry/api';\nimport { getRPCMetadata, RPCType } from '@opentelemetry/core';\nimport { InstrumentationBase } from '@opentelemetry/instrumentation';\nimport {\n ATTR_HTTP_REQUEST_METHOD,\n ATTR_HTTP_RESPONSE_STATUS_CODE,\n ATTR_HTTP_ROUTE,\n ATTR_SERVICE_NAME,\n} from '@opentelemetry/semantic-conventions';\n\n// SENTRY VENDOR NOTE\n// Instead of using the package.json file, we hard code the package name and version here.\nconst PACKAGE_NAME = '@fastify/otel';\nconst PACKAGE_VERSION = '0.8.0';\n\n// Constants\nconst SUPPORTED_VERSIONS = '>=4.0.0 <6';\nconst FASTIFY_HOOKS = [\n 'onRequest',\n 'preParsing',\n 'preValidation',\n 'preHandler',\n 'preSerialization',\n 'onSend',\n 'onResponse',\n 'onError',\n];\nconst ATTRIBUTE_NAMES = {\n HOOK_NAME: 'hook.name',\n FASTIFY_TYPE: 'fastify.type',\n HOOK_CALLBACK_NAME: 'hook.callback.name',\n ROOT: 'fastify.root',\n};\nconst HOOK_TYPES = {\n ROUTE: 'route-hook',\n INSTANCE: 'hook',\n HANDLER: 'request-handler',\n};\nconst ANONYMOUS_FUNCTION_NAME = 'anonymous';\n\n// Symbols\nconst kInstrumentation = Symbol('fastify otel instance');\nconst kRequestSpan = Symbol('fastify otel request spans');\nconst kRequestContext = Symbol('fastify otel request context');\nconst kAddHookOriginal = Symbol('fastify otel addhook original');\nconst kSetNotFoundOriginal = Symbol('fastify otel setnotfound original');\nconst kIgnorePaths = Symbol('fastify otel ignore path');\n\nexport class FastifyOtelInstrumentation extends InstrumentationBase {\n constructor(config) {\n super(PACKAGE_NAME, PACKAGE_VERSION, config);\n this.servername = config?.servername ?? process.env.OTEL_SERVICE_NAME ?? 'fastify';\n this[kIgnorePaths] = null;\n this._logger = diag.createComponentLogger({ namespace: PACKAGE_NAME });\n\n if (config?.ignorePaths != null || process.env.OTEL_FASTIFY_IGNORE_PATHS != null) {\n const ignorePaths = config?.ignorePaths ?? process.env.OTEL_FASTIFY_IGNORE_PATHS;\n\n if ((typeof ignorePaths !== 'string' || ignorePaths.length === 0) && typeof ignorePaths !== 'function') {\n throw new TypeError('ignorePaths must be a string or a function');\n }\n\n let globMatcher = null;\n\n this[kIgnorePaths] = routeOptions => {\n if (typeof ignorePaths === 'function') {\n return ignorePaths(routeOptions);\n } else {\n // Using minimatch to match the path until path.matchesGlob is out of experimental\n // path.matchesGlob uses minimatch internally\n if (globMatcher == null) {\n globMatcher = require('minimatch').minimatch;\n }\n\n return globMatcher(routeOptions.url, ignorePaths);\n }\n };\n }\n }\n\n enable() {\n if (this._handleInitialization === undefined && this.getConfig().registerOnInitialization) {\n const FastifyInstrumentationPlugin = this.plugin();\n this._handleInitialization = message => {\n message.fastify.register(FastifyInstrumentationPlugin);\n };\n dc.subscribe('fastify.initialization', this._handleInitialization);\n }\n return super.enable();\n }\n\n disable() {\n if (this._handleInitialization) {\n dc.unsubscribe('fastify.initialization', this._handleInitialization);\n this._handleInitialization = undefined;\n }\n return super.disable();\n }\n\n // We do not do patching in this instrumentation\n init() {\n return [];\n }\n\n plugin() {\n const instrumentation = this;\n\n FastifyInstrumentationPlugin[Symbol.for('skip-override')] = true;\n FastifyInstrumentationPlugin[Symbol.for('fastify.display-name')] = '@fastify/otel';\n FastifyInstrumentationPlugin[Symbol.for('plugin-meta')] = {\n fastify: SUPPORTED_VERSIONS,\n name: '@fastify/otel',\n };\n\n return FastifyInstrumentationPlugin;\n\n function FastifyInstrumentationPlugin(instance, opts, done) {\n instance.decorate(kInstrumentation, instrumentation);\n // addHook and notfoundHandler are essentially inherited from the prototype\n // what is important is to bound it to the right instance\n instance.decorate(kAddHookOriginal, instance.addHook);\n instance.decorate(kSetNotFoundOriginal, instance.setNotFoundHandler);\n instance.decorateRequest('opentelemetry', function openetelemetry() {\n const ctx = this[kRequestContext];\n const span = this[kRequestSpan];\n return {\n span,\n tracer: instrumentation.tracer,\n context: ctx,\n inject: (carrier, setter) => {\n return propagation.inject(ctx, carrier, setter);\n },\n extract: (carrier, getter) => {\n return propagation.extract(ctx, carrier, getter);\n },\n };\n });\n instance.decorateRequest(kRequestSpan, null);\n instance.decorateRequest(kRequestContext, null);\n\n instance.addHook('onRoute', function (routeOptions) {\n if (instrumentation[kIgnorePaths]?.(routeOptions) === true) {\n instrumentation._logger.debug(\n `Ignoring route instrumentation ${routeOptions.method} ${routeOptions.url} because it matches the ignore path`,\n );\n return;\n }\n\n for (const hook of FASTIFY_HOOKS) {\n if (routeOptions[hook] != null) {\n const handlerLike = routeOptions[hook];\n\n if (typeof handlerLike === 'function') {\n routeOptions[hook] = handlerWrapper(handlerLike, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - route -> ${hook}`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.ROUTE,\n [ATTR_HTTP_ROUTE]: routeOptions.url,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n handlerLike.name?.length > 0 ? handlerLike.name : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n });\n } else if (Array.isArray(handlerLike)) {\n const wrappedHandlers = [];\n\n for (const handler of handlerLike) {\n wrappedHandlers.push(\n handlerWrapper(handler, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - route -> ${hook}`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.ROUTE,\n [ATTR_HTTP_ROUTE]: routeOptions.url,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n }\n\n routeOptions[hook] = wrappedHandlers;\n }\n }\n }\n\n // We always want to add the onSend hook to the route to be executed last\n if (routeOptions.onSend != null) {\n routeOptions.onSend = Array.isArray(routeOptions.onSend)\n ? [...routeOptions.onSend, onSendHook]\n : [routeOptions.onSend, onSendHook];\n } else {\n routeOptions.onSend = onSendHook;\n }\n\n // We always want to add the onError hook to the route to be executed last\n if (routeOptions.onError != null) {\n routeOptions.onError = Array.isArray(routeOptions.onError)\n ? [...routeOptions.onError, onErrorHook]\n : [routeOptions.onError, onErrorHook];\n } else {\n routeOptions.onError = onErrorHook;\n }\n\n routeOptions.handler = handlerWrapper(routeOptions.handler, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - route-handler`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.HANDLER,\n [ATTR_HTTP_ROUTE]: routeOptions.url,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n routeOptions.handler.name.length > 0 ? routeOptions.handler.name : ANONYMOUS_FUNCTION_NAME,\n });\n });\n\n instance.addHook('onRequest', function (request, _reply, hookDone) {\n if (this[kInstrumentation].isEnabled() === false) {\n return hookDone();\n } else if (\n this[kInstrumentation][kIgnorePaths]?.({\n url: request.url,\n method: request.method,\n }) === true\n ) {\n this[kInstrumentation]._logger.debug(\n `Ignoring request ${request.method} ${request.url} because it matches the ignore path`,\n );\n return hookDone();\n }\n\n let ctx = context.active();\n\n if (trace.getSpan(ctx) == null) {\n ctx = propagation.extract(ctx, request.headers);\n }\n\n const rpcMetadata = getRPCMetadata(ctx);\n\n if (request.routeOptions.url != null && rpcMetadata?.type === RPCType.HTTP) {\n rpcMetadata.route = request.routeOptions.url;\n }\n\n /** @type {import('@opentelemetry/api').Span} */\n const span = this[kInstrumentation].tracer.startSpan(\n 'request',\n {\n attributes: {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.ROOT]: '@fastify/otel',\n [ATTR_HTTP_ROUTE]: request.url,\n [ATTR_HTTP_REQUEST_METHOD]: request.method,\n },\n },\n ctx,\n );\n\n request[kRequestContext] = trace.setSpan(ctx, span);\n request[kRequestSpan] = span;\n\n context.with(request[kRequestContext], () => {\n hookDone();\n });\n });\n\n // onResponse is the last hook to be executed, only added for 404 handlers\n instance.addHook('onResponse', function (request, reply, hookDone) {\n const span = request[kRequestSpan];\n\n if (span != null) {\n span.setStatus({\n code: SpanStatusCode.OK,\n message: 'OK',\n });\n span.setAttributes({\n [ATTR_HTTP_RESPONSE_STATUS_CODE]: 404,\n });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone();\n });\n\n instance.addHook = addHookPatched;\n instance.setNotFoundHandler = setNotFoundHandlerPatched;\n\n done();\n\n function onSendHook(request, reply, payload, hookDone) {\n /** @type {import('@opentelemetry/api').Span} */\n const span = request[kRequestSpan];\n\n if (span != null) {\n if (reply.statusCode < 500) {\n span.setStatus({\n code: SpanStatusCode.OK,\n message: 'OK',\n });\n }\n\n span.setAttributes({\n [ATTR_HTTP_RESPONSE_STATUS_CODE]: reply.statusCode,\n });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone(null, payload);\n }\n\n function onErrorHook(request, reply, error, hookDone) {\n /** @type {Span} */\n const span = request[kRequestSpan];\n\n if (span != null) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n });\n span.recordException(error);\n }\n\n hookDone();\n }\n\n function addHookPatched(name, hook) {\n const addHookOriginal = this[kAddHookOriginal];\n\n if (FASTIFY_HOOKS.includes(name)) {\n return addHookOriginal.call(\n this,\n name,\n handlerWrapper(hook, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - ${name}`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.INSTANCE,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n hook.name?.length > 0 ? hook.name : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n }),\n );\n } else {\n return addHookOriginal.call(this, name, hook);\n }\n }\n\n function setNotFoundHandlerPatched(hooks, handler) {\n const setNotFoundHandlerOriginal = this[kSetNotFoundOriginal];\n if (typeof hooks === 'function') {\n handler = handlerWrapper(hooks, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.INSTANCE,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n hooks.name?.length > 0 ? hooks.name : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n });\n setNotFoundHandlerOriginal.call(this, handler);\n } else {\n if (hooks.preValidation != null) {\n hooks.preValidation = handlerWrapper(hooks.preValidation, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - not-found-handler - preValidation`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.INSTANCE,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n hooks.preValidation.name?.length > 0\n ? hooks.preValidation.name\n : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n });\n }\n\n if (hooks.preHandler != null) {\n hooks.preHandler = handlerWrapper(hooks.preHandler, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - not-found-handler - preHandler`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.INSTANCE,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n hooks.preHandler.name?.length > 0\n ? hooks.preHandler.name\n : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n });\n }\n\n handler = handlerWrapper(handler, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.INSTANCE,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n });\n setNotFoundHandlerOriginal.call(this, hooks, handler);\n }\n }\n\n function handlerWrapper(handler, spanAttributes = {}) {\n return function handlerWrapped(...args) {\n /** @type {FastifyOtelInstrumentation} */\n const instrumentation = this[kInstrumentation];\n const [request] = args;\n\n if (instrumentation.isEnabled() === false) {\n return handler.call(this, ...args);\n }\n\n const ctx = request[kRequestContext] ?? context.active();\n const span = instrumentation.tracer.startSpan(\n `handler - ${\n handler.name?.length > 0\n ? handler.name\n : this.pluginName /* c8 ignore next */ ?? ANONYMOUS_FUNCTION_NAME /* c8 ignore next */\n }`,\n {\n attributes: spanAttributes,\n },\n ctx,\n );\n\n return context.with(\n trace.setSpan(ctx, span),\n function () {\n try {\n const res = handler.call(this, ...args);\n\n if (typeof res?.then === 'function') {\n return res.then(\n result => {\n span.end();\n return result;\n },\n error => {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n });\n span.recordException(error);\n span.end();\n return Promise.reject(error);\n },\n );\n }\n\n span.end();\n return res;\n } catch (error) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n });\n span.recordException(error);\n span.end();\n throw error;\n }\n },\n this,\n );\n };\n }\n }\n }\n}\n"],"names":["InstrumentationBase","diag","dc","propagation","ATTR_SERVICE_NAME","ATTR_HTTP_ROUTE","context","trace","getRPCMetadata","RPCType","ATTR_HTTP_REQUEST_METHOD","SpanStatusCode","ATTR_HTTP_RESPONSE_STATUS_CODE"],"mappings":";;;;;;;;AAAA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAiBA;AACA;AACA,MAAM,YAAA,GAAe,eAAe;AACpC,MAAM,eAAA,GAAkB,OAAO;;AAE/B;AACA,MAAM,kBAAA,GAAqB,YAAY;AACvC,MAAM,gBAAgB;AACtB,EAAE,WAAW;AACb,EAAE,YAAY;AACd,EAAE,eAAe;AACjB,EAAE,YAAY;AACd,EAAE,kBAAkB;AACpB,EAAE,QAAQ;AACV,EAAE,YAAY;AACd,EAAE,SAAS;AACX,CAAC;AACD,MAAM,kBAAkB;AACxB,EAAE,SAAS,EAAE,WAAW;AACxB,EAAE,YAAY,EAAE,cAAc;AAC9B,EAAE,kBAAkB,EAAE,oBAAoB;AAC1C,EAAE,IAAI,EAAE,cAAc;AACtB,CAAC;AACD,MAAM,aAAa;AACnB,EAAE,KAAK,EAAE,YAAY;AACrB,EAAE,QAAQ,EAAE,MAAM;AAClB,EAAE,OAAO,EAAE,iBAAiB;AAC5B,CAAC;AACD,MAAM,uBAAA,GAA0B,WAAW;;AAE3C;AACA,MAAM,gBAAiB,GAAE,MAAM,CAAC,uBAAuB,CAAC;AACxD,MAAM,YAAa,GAAE,MAAM,CAAC,4BAA4B,CAAC;AACzD,MAAM,eAAgB,GAAE,MAAM,CAAC,8BAA8B,CAAC;AAC9D,MAAM,gBAAiB,GAAE,MAAM,CAAC,+BAA+B,CAAC;AAChE,MAAM,oBAAqB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;AACA,gBAAA,MAAA,GAAA,GAAA,OAAA,CAAA,IAAA,CAAA,IAAA,EAAA,GAAA,IAAA,CAAA;;AAEA,gBAAA,IAAA,OAAA,GAAA,EAAA,IAAA,KAAA,UAAA,EAAA;AACA,kBAAA,OAAA,GAAA,CAAA,IAAA;AACA,oBAAA,MAAA,IAAA;AACA,sBAAA,IAAA,CAAA,GAAA,EAAA;AACA,sBAAA,OAAA,MAAA;AACA,qBAAA;AACA,oBAAA,KAAA,IAAA;AACA,sBAAA,IAAA,CAAA,SAAA,CAAA;AACA,wBAAA,IAAA,EAAAI,kBAAA,CAAA,KAAA;AACA,wBAAA,OAAA,EAAA,KAAA,CAAA,OAAA;AACA,uBAAA,CAAA;AACA,sBAAA,IAAA,CAAA,eAAA,CAAA,KAAA,CAAA;AACA,sBAAA,IAAA,CAAA,GAAA,EAAA;AACA,sBAAA,OAAA,OAAA,CAAA,MAAA,CAAA,KAAA,CAAA;AACA,qBAAA;AACA,mBAAA;AACA;;AAEA,gBAAA,IAAA,CAAA,GAAA,EAAA;AACA,gBAAA,OAAA,GAAA;AACA,eAAA,CAAA,OAAA,KAAA,EAAA;AACA,gBAAA,IAAA,CAAA,SAAA,CAAA;AACA,kBAAA,IAAA,EAAAA,kBAAA,CAAA,KAAA;AACA,kBAAA,OAAA,EAAA,KAAA,CAAA,OAAA;AACA,iBAAA,CAAA;AACA,gBAAA,IAAA,CAAA,eAAA,CAAA,KAAA,CAAA;AACA,gBAAA,IAAA,CAAA,GAAA,EAAA;AACA,gBAAA,MAAA,KAAA;AACA;AACA,aAAA;AACA,YAAA,IAAA;AACA,WAAA;AACA,SAAA;AACA;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/integrations/tracing/fastify/fastify-otel/index.js"],"sourcesContent":["/*\nVendored in and modified from @fastify/otel version 0.8.0\nhttps://github.com/fastify/otel/releases/tag/v0.8.0\n\nTried not to modify the original code too much keeping it as a JavaScript CJS module to make it easier to update when required\n\nModifications include:\n- Removed reading of package.json to get the version and package name\n\nMIT License\n\nCopyright (c) 2024 Fastify\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\n/* eslint-disable jsdoc/require-jsdoc */\n/* eslint-disable max-lines */\n/* eslint-disable no-param-reassign */\nimport dc from 'node:diagnostics_channel';\nimport { context, diag, propagation, SpanStatusCode, trace } from '@opentelemetry/api';\nimport { getRPCMetadata, RPCType } from '@opentelemetry/core';\nimport { InstrumentationBase } from '@opentelemetry/instrumentation';\nimport {\n ATTR_HTTP_REQUEST_METHOD,\n ATTR_HTTP_RESPONSE_STATUS_CODE,\n ATTR_HTTP_ROUTE,\n ATTR_SERVICE_NAME,\n} from '@opentelemetry/semantic-conventions';\nimport * as minimatch from 'minimatch';\n\n// SENTRY VENDOR NOTE\n// Instead of using the package.json file, we hard code the package name and version here.\nconst PACKAGE_NAME = '@fastify/otel';\nconst PACKAGE_VERSION = '0.8.0';\n\n// Constants\nconst SUPPORTED_VERSIONS = '>=4.0.0 <6';\nconst FASTIFY_HOOKS = [\n 'onRequest',\n 'preParsing',\n 'preValidation',\n 'preHandler',\n 'preSerialization',\n 'onSend',\n 'onResponse',\n 'onError',\n];\nconst ATTRIBUTE_NAMES = {\n HOOK_NAME: 'hook.name',\n FASTIFY_TYPE: 'fastify.type',\n HOOK_CALLBACK_NAME: 'hook.callback.name',\n ROOT: 'fastify.root',\n};\nconst HOOK_TYPES = {\n ROUTE: 'route-hook',\n INSTANCE: 'hook',\n HANDLER: 'request-handler',\n};\nconst ANONYMOUS_FUNCTION_NAME = 'anonymous';\n\n// Symbols\nconst kInstrumentation = Symbol('fastify otel instance');\nconst kRequestSpan = Symbol('fastify otel request spans');\nconst kRequestContext = Symbol('fastify otel request context');\nconst kAddHookOriginal = Symbol('fastify otel addhook original');\nconst kSetNotFoundOriginal = Symbol('fastify otel setnotfound original');\nconst kIgnorePaths = Symbol('fastify otel ignore path');\n\nexport class FastifyOtelInstrumentation extends InstrumentationBase {\n constructor(config) {\n super(PACKAGE_NAME, PACKAGE_VERSION, config);\n this.servername = config?.servername ?? process.env.OTEL_SERVICE_NAME ?? 'fastify';\n this[kIgnorePaths] = null;\n this._logger = diag.createComponentLogger({ namespace: PACKAGE_NAME });\n\n if (config?.ignorePaths != null || process.env.OTEL_FASTIFY_IGNORE_PATHS != null) {\n const ignorePaths = config?.ignorePaths ?? process.env.OTEL_FASTIFY_IGNORE_PATHS;\n\n if ((typeof ignorePaths !== 'string' || ignorePaths.length === 0) && typeof ignorePaths !== 'function') {\n throw new TypeError('ignorePaths must be a string or a function');\n }\n\n const globMatcher = minimatch.minimatch;\n\n this[kIgnorePaths] = routeOptions => {\n if (typeof ignorePaths === 'function') {\n return ignorePaths(routeOptions);\n } else {\n return globMatcher(routeOptions.url, ignorePaths);\n }\n };\n }\n }\n\n enable() {\n if (this._handleInitialization === undefined && this.getConfig().registerOnInitialization) {\n const FastifyInstrumentationPlugin = this.plugin();\n this._handleInitialization = message => {\n message.fastify.register(FastifyInstrumentationPlugin);\n };\n dc.subscribe('fastify.initialization', this._handleInitialization);\n }\n return super.enable();\n }\n\n disable() {\n if (this._handleInitialization) {\n dc.unsubscribe('fastify.initialization', this._handleInitialization);\n this._handleInitialization = undefined;\n }\n return super.disable();\n }\n\n // We do not do patching in this instrumentation\n init() {\n return [];\n }\n\n plugin() {\n const instrumentation = this;\n\n FastifyInstrumentationPlugin[Symbol.for('skip-override')] = true;\n FastifyInstrumentationPlugin[Symbol.for('fastify.display-name')] = '@fastify/otel';\n FastifyInstrumentationPlugin[Symbol.for('plugin-meta')] = {\n fastify: SUPPORTED_VERSIONS,\n name: '@fastify/otel',\n };\n\n return FastifyInstrumentationPlugin;\n\n function FastifyInstrumentationPlugin(instance, opts, done) {\n instance.decorate(kInstrumentation, instrumentation);\n // addHook and notfoundHandler are essentially inherited from the prototype\n // what is important is to bound it to the right instance\n instance.decorate(kAddHookOriginal, instance.addHook);\n instance.decorate(kSetNotFoundOriginal, instance.setNotFoundHandler);\n instance.decorateRequest('opentelemetry', function openetelemetry() {\n const ctx = this[kRequestContext];\n const span = this[kRequestSpan];\n return {\n span,\n tracer: instrumentation.tracer,\n context: ctx,\n inject: (carrier, setter) => {\n return propagation.inject(ctx, carrier, setter);\n },\n extract: (carrier, getter) => {\n return propagation.extract(ctx, carrier, getter);\n },\n };\n });\n instance.decorateRequest(kRequestSpan, null);\n instance.decorateRequest(kRequestContext, null);\n\n instance.addHook('onRoute', function (routeOptions) {\n if (instrumentation[kIgnorePaths]?.(routeOptions) === true) {\n instrumentation._logger.debug(\n `Ignoring route instrumentation ${routeOptions.method} ${routeOptions.url} because it matches the ignore path`,\n );\n return;\n }\n\n for (const hook of FASTIFY_HOOKS) {\n if (routeOptions[hook] != null) {\n const handlerLike = routeOptions[hook];\n\n if (typeof handlerLike === 'function') {\n routeOptions[hook] = handlerWrapper(handlerLike, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - route -> ${hook}`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.ROUTE,\n [ATTR_HTTP_ROUTE]: routeOptions.url,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n handlerLike.name?.length > 0 ? handlerLike.name : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n });\n } else if (Array.isArray(handlerLike)) {\n const wrappedHandlers = [];\n\n for (const handler of handlerLike) {\n wrappedHandlers.push(\n handlerWrapper(handler, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - route -> ${hook}`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.ROUTE,\n [ATTR_HTTP_ROUTE]: routeOptions.url,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n }\n\n routeOptions[hook] = wrappedHandlers;\n }\n }\n }\n\n // We always want to add the onSend hook to the route to be executed last\n if (routeOptions.onSend != null) {\n routeOptions.onSend = Array.isArray(routeOptions.onSend)\n ? [...routeOptions.onSend, onSendHook]\n : [routeOptions.onSend, onSendHook];\n } else {\n routeOptions.onSend = onSendHook;\n }\n\n // We always want to add the onError hook to the route to be executed last\n if (routeOptions.onError != null) {\n routeOptions.onError = Array.isArray(routeOptions.onError)\n ? [...routeOptions.onError, onErrorHook]\n : [routeOptions.onError, onErrorHook];\n } else {\n routeOptions.onError = onErrorHook;\n }\n\n routeOptions.handler = handlerWrapper(routeOptions.handler, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - route-handler`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.HANDLER,\n [ATTR_HTTP_ROUTE]: routeOptions.url,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n routeOptions.handler.name.length > 0 ? routeOptions.handler.name : ANONYMOUS_FUNCTION_NAME,\n });\n });\n\n instance.addHook('onRequest', function (request, _reply, hookDone) {\n if (this[kInstrumentation].isEnabled() === false) {\n return hookDone();\n } else if (\n this[kInstrumentation][kIgnorePaths]?.({\n url: request.url,\n method: request.method,\n }) === true\n ) {\n this[kInstrumentation]._logger.debug(\n `Ignoring request ${request.method} ${request.url} because it matches the ignore path`,\n );\n return hookDone();\n }\n\n let ctx = context.active();\n\n if (trace.getSpan(ctx) == null) {\n ctx = propagation.extract(ctx, request.headers);\n }\n\n const rpcMetadata = getRPCMetadata(ctx);\n\n if (request.routeOptions.url != null && rpcMetadata?.type === RPCType.HTTP) {\n rpcMetadata.route = request.routeOptions.url;\n }\n\n /** @type {import('@opentelemetry/api').Span} */\n const span = this[kInstrumentation].tracer.startSpan(\n 'request',\n {\n attributes: {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.ROOT]: '@fastify/otel',\n [ATTR_HTTP_ROUTE]: request.url,\n [ATTR_HTTP_REQUEST_METHOD]: request.method,\n },\n },\n ctx,\n );\n\n request[kRequestContext] = trace.setSpan(ctx, span);\n request[kRequestSpan] = span;\n\n context.with(request[kRequestContext], () => {\n hookDone();\n });\n });\n\n // onResponse is the last hook to be executed, only added for 404 handlers\n instance.addHook('onResponse', function (request, reply, hookDone) {\n const span = request[kRequestSpan];\n\n if (span != null) {\n span.setStatus({\n code: SpanStatusCode.OK,\n message: 'OK',\n });\n span.setAttributes({\n [ATTR_HTTP_RESPONSE_STATUS_CODE]: 404,\n });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone();\n });\n\n instance.addHook = addHookPatched;\n instance.setNotFoundHandler = setNotFoundHandlerPatched;\n\n done();\n\n function onSendHook(request, reply, payload, hookDone) {\n /** @type {import('@opentelemetry/api').Span} */\n const span = request[kRequestSpan];\n\n if (span != null) {\n if (reply.statusCode < 500) {\n span.setStatus({\n code: SpanStatusCode.OK,\n message: 'OK',\n });\n }\n\n span.setAttributes({\n [ATTR_HTTP_RESPONSE_STATUS_CODE]: reply.statusCode,\n });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone(null, payload);\n }\n\n function onErrorHook(request, reply, error, hookDone) {\n /** @type {Span} */\n const span = request[kRequestSpan];\n\n if (span != null) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n });\n span.recordException(error);\n }\n\n hookDone();\n }\n\n function addHookPatched(name, hook) {\n const addHookOriginal = this[kAddHookOriginal];\n\n if (FASTIFY_HOOKS.includes(name)) {\n return addHookOriginal.call(\n this,\n name,\n handlerWrapper(hook, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - ${name}`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.INSTANCE,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n hook.name?.length > 0 ? hook.name : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n }),\n );\n } else {\n return addHookOriginal.call(this, name, hook);\n }\n }\n\n function setNotFoundHandlerPatched(hooks, handler) {\n const setNotFoundHandlerOriginal = this[kSetNotFoundOriginal];\n if (typeof hooks === 'function') {\n handler = handlerWrapper(hooks, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.INSTANCE,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n hooks.name?.length > 0 ? hooks.name : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n });\n setNotFoundHandlerOriginal.call(this, handler);\n } else {\n if (hooks.preValidation != null) {\n hooks.preValidation = handlerWrapper(hooks.preValidation, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - not-found-handler - preValidation`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.INSTANCE,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n hooks.preValidation.name?.length > 0\n ? hooks.preValidation.name\n : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n });\n }\n\n if (hooks.preHandler != null) {\n hooks.preHandler = handlerWrapper(hooks.preHandler, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - not-found-handler - preHandler`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.INSTANCE,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n hooks.preHandler.name?.length > 0\n ? hooks.preHandler.name\n : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n });\n }\n\n handler = handlerWrapper(handler, {\n [ATTR_SERVICE_NAME]: instance[kInstrumentation].servername,\n [ATTRIBUTE_NAMES.HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_NAMES.FASTIFY_TYPE]: HOOK_TYPES.INSTANCE,\n [ATTRIBUTE_NAMES.HOOK_CALLBACK_NAME]:\n handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME /* c8 ignore next */,\n });\n setNotFoundHandlerOriginal.call(this, hooks, handler);\n }\n }\n\n function handlerWrapper(handler, spanAttributes = {}) {\n return function handlerWrapped(...args) {\n /** @type {FastifyOtelInstrumentation} */\n const instrumentation = this[kInstrumentation];\n const [request] = args;\n\n if (instrumentation.isEnabled() === false) {\n return handler.call(this, ...args);\n }\n\n const ctx = request[kRequestContext] ?? context.active();\n const span = instrumentation.tracer.startSpan(\n `handler - ${\n handler.name?.length > 0\n ? handler.name\n : this.pluginName /* c8 ignore next */ ?? ANONYMOUS_FUNCTION_NAME /* c8 ignore next */\n }`,\n {\n attributes: spanAttributes,\n },\n ctx,\n );\n\n return context.with(\n trace.setSpan(ctx, span),\n function () {\n try {\n const res = handler.call(this, ...args);\n\n if (typeof res?.then === 'function') {\n return res.then(\n result => {\n span.end();\n return result;\n },\n error => {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n });\n span.recordException(error);\n span.end();\n return Promise.reject(error);\n },\n );\n }\n\n span.end();\n return res;\n } catch (error) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n });\n span.recordException(error);\n span.end();\n throw error;\n }\n },\n this,\n );\n };\n }\n }\n }\n}\n"],"names":["InstrumentationBase","diag","dc","propagation","ATTR_SERVICE_NAME","ATTR_HTTP_ROUTE","context","trace","getRPCMetadata","RPCType","ATTR_HTTP_REQUEST_METHOD","SpanStatusCode","ATTR_HTTP_RESPONSE_STATUS_CODE"],"mappings":";;;;;;;;;AAAA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAiBA;AACA;AACA,MAAM,YAAA,GAAe,eAAe;AACpC,MAAM,eAAA,GAAkB,OAAO;;AAE/B;AACA,MAAM,kBAAA,GAAqB,YAAY;AACvC,MAAM,gBAAgB;AACtB,EAAE,WAAW;AACb,EAAE,YAAY;AACd,EAAE,eAAe;AACjB,EAAE,YAAY;AACd,EAAE,kBAAkB;AACpB,EAAE,QAAQ;AACV,EAAE,YAAY;AACd,EAAE,SAAS;AACX,CAAC;AACD,MAAM,kBAAkB;AACxB,EAAE,SAAS,EAAE,WAAW;AACxB,EAAE,YAAY,EAAE,cAAc;AAC9B,EAAE,kBAAkB,EAAE,oBAAoB;AAC1C,EAAE,IAAI,EAAE,cAAc;AACtB,CAAC;AACD,MAAM,aAAa;AACnB,EAAE,KAAK,EAAE,YAAY;AACrB,EAAE,QAAQ,EAAE,MAAM;AAClB,EAAE,OAAO,EAAE,iBAAiB;AAC5B,CAAC;AACD,MAAM,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Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const diagnosticsChannel = require('node:diagnostics_channel');
3
+ const dc = require('node:diagnostics_channel');
4
4
  const core = require('@sentry/core');
5
+ const nodeCore = require('@sentry/node-core');
5
6
  const debugBuild = require('../../../debug-build.js');
6
- const instrument = require('../../../otel/instrument.js');
7
7
  const index = require('./fastify-otel/index.js');
8
8
  const instrumentation = require('./v3/instrumentation.js');
9
9
 
10
10
  const INTEGRATION_NAME = 'Fastify';
11
11
  const INTEGRATION_NAME_V3 = 'Fastify-V3';
12
12
 
13
- const instrumentFastifyV3 = instrument.generateInstrumentOnce(INTEGRATION_NAME_V3, () => new instrumentation.FastifyInstrumentationV3());
13
+ const instrumentFastifyV3 = nodeCore.generateInstrumentOnce(INTEGRATION_NAME_V3, () => new instrumentation.FastifyInstrumentationV3());
14
14
 
15
15
  function handleFastifyError(
16
16
 
@@ -41,14 +41,14 @@ function handleFastifyError(
41
41
  }
42
42
  }
43
43
 
44
- const instrumentFastify = instrument.generateInstrumentOnce(INTEGRATION_NAME, () => {
44
+ const instrumentFastify = nodeCore.generateInstrumentOnce(INTEGRATION_NAME, () => {
45
45
  const fastifyOtelInstrumentationInstance = new index.FastifyOtelInstrumentation();
46
46
  const plugin = fastifyOtelInstrumentationInstance.plugin();
47
47
  const options = fastifyOtelInstrumentationInstance.getConfig();
48
48
  const shouldHandleError = (options )?.shouldHandleError || defaultShouldHandleError;
49
49
 
50
50
  // This message handler works for Fastify versions 3, 4 and 5
51
- diagnosticsChannel.subscribe('fastify.initialization', message => {
51
+ dc.subscribe('fastify.initialization', message => {
52
52
  const fastifyInstance = (message ).fastify;
53
53
 
54
54
  fastifyInstance?.register(plugin).after(err => {
@@ -66,7 +66,7 @@ const instrumentFastify = instrument.generateInstrumentOnce(INTEGRATION_NAME, ()
66
66
 
67
67
  // This diagnostics channel only works on Fastify version 5
68
68
  // For versions 3 and 4, we use `setupFastifyErrorHandler` instead
69
- diagnosticsChannel.subscribe('tracing:fastify.request.handler:error', message => {
69
+ dc.subscribe('tracing:fastify.request.handler:error', message => {
70
70
  const { error, request, reply } = message
71
71
 
72
72
  ;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { Instrumentation, InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n captureException,\n defineIntegration,\n getClient,\n getIsolationScope,\n logger,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { generateInstrumentOnce } from '../../../otel/instrument';\nimport { FastifyOtelInstrumentation } from './fastify-otel/index';\nimport type { FastifyInstance, FastifyReply, FastifyRequest } from './types';\nimport { FastifyInstrumentationV3 } from './v3/instrumentation';\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 * ```javascript\n * setupFastifyErrorHandler(app, {\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 400;\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';\nconst INTEGRATION_NAME_V3 = 'Fastify-V3';\n\nexport const instrumentFastifyV3 = generateInstrumentOnce(INTEGRATION_NAME_V3, () => new FastifyInstrumentationV3());\n\nfunction handleFastifyError(\n this: {\n diagnosticsChannelExists?: boolean;\n },\n error: Error,\n request: FastifyRequest & { opentelemetry?: () => { span?: Span } },\n reply: FastifyReply,\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean,\n handlerOrigin: 'diagnostics-channel' | 'onError-hook',\n): void {\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 logger.warn(\n 'Fastify error handler was already registered via diagnostics channel.',\n 'You can safely remove `setupFastifyErrorHandler` call.',\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);\n }\n}\n\nexport const instrumentFastify = generateInstrumentOnce(INTEGRATION_NAME, () => {\n const fastifyOtelInstrumentationInstance = new FastifyOtelInstrumentation();\n const plugin = fastifyOtelInstrumentationInstance.plugin();\n const options = fastifyOtelInstrumentationInstance.getConfig();\n const shouldHandleError = (options as FastifyHandlerOptions)?.shouldHandleError || defaultShouldHandleError;\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 && logger.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, shouldHandleError, 'diagnostics-channel');\n });\n\n // Returning this as unknown not to deal with the internal types of the FastifyOtelInstrumentation\n return fastifyOtelInstrumentationInstance as Instrumentation<InstrumentationConfig & FastifyHandlerOptions>;\n});\n\nconst _fastifyIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentFastifyV3();\n instrumentFastify();\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(_fastifyIntegration);\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: FastifyInstance, options?: Partial<FastifyHandlerOptions>): void {\n const shouldHandleError = options?.shouldHandleError || defaultShouldHandleError;\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, shouldHandleError, '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 // eslint-disable-next-line @typescript-eslint/no-floating-promises\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.replace(/^fastify -> /, '').replace(/^@fastify\\/otel -> /, '');\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","DEBUG_BUILD","logger","captureException","FastifyOtelInstrumentation","defineIntegration","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getClient","getIsolationScope"],"mappings":";;;;;;;;;AAsDA,MAAM,gBAAA,GAAmB,SAAS;AAClC,MAAM,mBAAA,GAAsB,YAAY;;AAE3B,MAAA,mBAAA,GAAsBA,iCAAsB,CAAC,mBAAmB,EAAE,MAAM,IAAIC,wCAAwB,EAAE;;AAEnH,SAAS,kBAAkB;;AAI3B,EAAE,KAAK;AACP,EAAE,OAAO;AACT,EAAE,KAAK;AACP,EAAE,iBAAiB;AACnB,EAAE,aAAa;AACf,EAAQ;AACR;AACA,EAAE,IAAI,aAAc,KAAI,qBAAqB,EAAE;AAC/C,IAAI,IAAI,CAAC,wBAAyB,GAAE,IAAI;AACxC;;AAEA,EAAE,IAAI,IAAI,CAAC,4BAA4B,aAAA,KAAkB,cAAc,EAAE;AACzE,IAAIC,sBAAY;AAChB,MAAMC,WAAM,CAAC,IAAI;AACjB,QAAQ,uEAAuE;AAC/E,QAAQ,wDAAwD;AAChE,OAAO;;AAEP;AACA,IAAI;AACJ;;AAEA,EAAE,IAAI,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE;AAChD,IAAIC,qBAAgB,CAAC,KAAK,CAAC;AAC3B;AACA;;AAEO,MAAM,oBAAoBJ,iCAAsB,CAAC,gBAAgB,EAAE,MAAM;AAChF,EAAE,MAAM,kCAAmC,GAAE,IAAIK,gCAA0B,EAAE;AAC7E,EAAE,MAAM,MAAO,GAAE,kCAAkC,CAAC,MAAM,EAAE;AAC5D,EAAE,MAAM,OAAQ,GAAE,kCAAkC,CAAC,SAAS,EAAE;AAChE,EAAE,MAAM,oBAAoB,CAAC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AA,WAAA,EAAA,OAAA,OAAA,EAAA,MAAA,KAAA;AACA,IAAA,IAAA,OAAA,CAAA,aAAA,EAAA;AACA,MAAA,MAAA,EAAA,IAAA,EAAA,GAAA,OAAA,CAAA,aAAA,EAAA;;AAEA,MAAA,IAAA,IAAA,EAAA;AACA,QAAA,wBAAA,CAAA,IAAA,CAAA;AACA;AACA;;AAEA,IAAA,MAAA,SAAA,GAAA,OAAA,CAAA,YAAA,EAAA,GAAA;AACA,IAAA,MAAA,MAAA,GAAA,OAAA,CAAA,MAAA,IAAA,KAAA;;AAEA,IAAAC,sBAAA,EAAA,CAAA,kBAAA,CAAA,CAAA,EAAA,MAAA,CAAA,CAAA,EAAA,SAAA,CAAA,CAAA,CAAA;AACA,GAAA,CAAA;AACA;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { Instrumentation, InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n captureException,\n defineIntegration,\n getClient,\n getIsolationScope,\n logger,\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 { FastifyOtelInstrumentation } from './fastify-otel/index';\nimport type { FastifyInstance, FastifyReply, FastifyRequest } from './types';\nimport { FastifyInstrumentationV3 } from './v3/instrumentation';\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 * ```javascript\n * setupFastifyErrorHandler(app, {\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 400;\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';\nconst INTEGRATION_NAME_V3 = 'Fastify-V3';\n\nexport const instrumentFastifyV3 = generateInstrumentOnce(INTEGRATION_NAME_V3, () => new FastifyInstrumentationV3());\n\nfunction handleFastifyError(\n this: {\n diagnosticsChannelExists?: boolean;\n },\n error: Error,\n request: FastifyRequest & { opentelemetry?: () => { span?: Span } },\n reply: FastifyReply,\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean,\n handlerOrigin: 'diagnostics-channel' | 'onError-hook',\n): void {\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 logger.warn(\n 'Fastify error handler was already registered via diagnostics channel.',\n 'You can safely remove `setupFastifyErrorHandler` call.',\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);\n }\n}\n\nexport const instrumentFastify = generateInstrumentOnce(INTEGRATION_NAME, () => {\n const fastifyOtelInstrumentationInstance = new FastifyOtelInstrumentation();\n const plugin = fastifyOtelInstrumentationInstance.plugin();\n const options = fastifyOtelInstrumentationInstance.getConfig();\n const shouldHandleError = (options as FastifyHandlerOptions)?.shouldHandleError || defaultShouldHandleError;\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 && logger.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, shouldHandleError, 'diagnostics-channel');\n });\n\n // Returning this as unknown not to deal with the internal types of the FastifyOtelInstrumentation\n return fastifyOtelInstrumentationInstance as Instrumentation<InstrumentationConfig & FastifyHandlerOptions>;\n});\n\nconst _fastifyIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentFastifyV3();\n instrumentFastify();\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(_fastifyIntegration);\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: FastifyInstance, options?: Partial<FastifyHandlerOptions>): void {\n const shouldHandleError = options?.shouldHandleError || defaultShouldHandleError;\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, shouldHandleError, '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 // eslint-disable-next-line @typescript-eslint/no-floating-promises\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.replace(/^fastify -> /, '').replace(/^@fastify\\/otel -> /, '');\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","DEBUG_BUILD","logger","captureException","FastifyOtelInstrumentation","diagnosticsChannel","defineIntegration","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getClient","getIsolationScope"],"mappings":";;;;;;;;;AAsDA,MAAM,gBAAA,GAAmB,SAAS;AAClC,MAAM,mBAAA,GAAsB,YAAY;;AAE3B,MAAA,mBAAA,GAAsBA,+BAAsB,CAAC,mBAAmB,EAAE,MAAM,IAAIC,wCAAwB,EAAE;;AAEnH,SAAS,kBAAkB;;AAI3B,EAAE,KAAK;AACP,EAAE,OAAO;AACT,EAAE,KAAK;AACP,EAAE,iBAAiB;AACnB,EAAE,aAAa;AACf,EAAQ;AACR;AACA,EAAE,IAAI,aAAc,KAAI,qBAAqB,EAAE;AAC/C,IAAI,IAAI,CAAC,wBAAyB,GAAE,IAAI;AACxC;;AAEA,EAAE,IAAI,IAAI,CAAC,4BAA4B,aAAA,KAAkB,cAAc,EAAE;AACzE,IAAIC,sBAAY;AAChB,MAAMC,WAAM,CAAC,IAAI;AACjB,QAAQ,uEAAuE;AAC/E,QAAQ,wDAAwD;AAChE,OAAO;;AAEP;AACA,I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AA,CAAA,OAAA,CAAA,qBAAA,EAAA,EAAA,CAAA;;AAEA,IAAA,IAAA,CAAA,UAAA,CAAA,WAAA,CAAA;AACA;AACA;;AAEA,SAAA,gBAAA,GAAA;AACA,EAAA,MAAA,MAAA,GAAAE,cAAA,EAAA;AACA,EAAA,IAAA,MAAA,EAAA;AACA,IAAA,MAAA,CAAA,EAAA,CAAA,WAAA,EAAA,CAAA,IAAA,KAAA;AACA,MAAA,wBAAA,CAAA,IAAA,CAAA;AACA,KAAA,CAAA;AACA;AACA;;AAEA,SAAA,mBAAA,CAAA,OAAA,EAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,WAAA,EAAA,OAAA,OAAA,EAAA,MAAA,KAAA;AACA,IAAA,IAAA,OAAA,CAAA,aAAA,EAAA;AACA,MAAA,MAAA,EAAA,IAAA,EAAA,GAAA,OAAA,CAAA,aAAA,EAAA;;AAEA,MAAA,IAAA,IAAA,EAAA;AACA,QAAA,wBAAA,CAAA,IAAA,CAAA;AACA;AACA;;AAEA,IAAA,MAAA,SAAA,GAAA,OAAA,CAAA,YAAA,EAAA,GAAA;AACA,IAAA,MAAA,MAAA,GAAA,OAAA,CAAA,MAAA,IAAA,KAAA;;AAEA,IAAAC,sBAAA,EAAA,CAAA,kBAAA,CAAA,CAAA,EAAA,MAAA,CAAA,CAAA,EAAA,SAAA,CAAA,CAAA,CAAA;AACA,GAAA,CAAA;AACA;;;;;;;"}
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationGenericPool = require('@opentelemetry/instrumentation-generic-pool');
4
4
  const core = require('@sentry/core');
5
- const instrument = require('../../otel/instrument.js');
5
+ const nodeCore = require('@sentry/node-core');
6
6
 
7
7
  const INTEGRATION_NAME = 'GenericPool';
8
8
 
9
- const instrumentGenericPool = instrument.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentationGenericPool.GenericPoolInstrumentation({}));
9
+ const instrumentGenericPool = nodeCore.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentationGenericPool.GenericPoolInstrumentation({}));
10
10
 
11
11
  const _genericPoolIntegration = (() => {
12
12
  let instrumentationWrappedCallback;
@@ -15,7 +15,7 @@ const _genericPoolIntegration = (() => {
15
15
  name: INTEGRATION_NAME,
16
16
  setupOnce() {
17
17
  const instrumentation = instrumentGenericPool();
18
- instrumentationWrappedCallback = instrument.instrumentWhenWrapped(instrumentation);
18
+ instrumentationWrappedCallback = nodeCore.instrumentWhenWrapped(instrumentation);
19
19
  },
20
20
 
21
21
  setup(client) {