@sentry/node 9.35.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 (474) hide show
  1. package/build/cjs/index.js +38 -56
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/fs.js +2 -2
  4. package/build/cjs/integrations/fs.js.map +1 -1
  5. package/build/cjs/integrations/http/index.js +7 -11
  6. package/build/cjs/integrations/http/index.js.map +1 -1
  7. package/build/cjs/integrations/node-fetch/index.js +4 -5
  8. package/build/cjs/integrations/node-fetch/index.js.map +1 -1
  9. package/build/cjs/integrations/tracing/amqplib.js +4 -5
  10. package/build/cjs/integrations/tracing/amqplib.js.map +1 -1
  11. package/build/cjs/integrations/tracing/connect.js +3 -4
  12. package/build/cjs/integrations/tracing/connect.js.map +1 -1
  13. package/build/cjs/integrations/tracing/dataloader.js +3 -3
  14. package/build/cjs/integrations/tracing/dataloader.js.map +1 -1
  15. package/build/cjs/integrations/tracing/express.js +5 -7
  16. package/build/cjs/integrations/tracing/express.js.map +1 -1
  17. package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js +3 -3
  18. package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
  19. package/build/cjs/integrations/tracing/fastify/index.js +6 -6
  20. package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
  21. package/build/cjs/integrations/tracing/genericPool.js +3 -3
  22. package/build/cjs/integrations/tracing/genericPool.js.map +1 -1
  23. package/build/cjs/integrations/tracing/graphql.js +3 -4
  24. package/build/cjs/integrations/tracing/graphql.js.map +1 -1
  25. package/build/cjs/integrations/tracing/hapi/index.js +3 -4
  26. package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
  27. package/build/cjs/integrations/tracing/kafka.js +4 -5
  28. package/build/cjs/integrations/tracing/kafka.js.map +1 -1
  29. package/build/cjs/integrations/tracing/knex.js +3 -3
  30. package/build/cjs/integrations/tracing/knex.js.map +1 -1
  31. package/build/cjs/integrations/tracing/koa.js +4 -6
  32. package/build/cjs/integrations/tracing/koa.js.map +1 -1
  33. package/build/cjs/integrations/tracing/lrumemoizer.js +2 -2
  34. package/build/cjs/integrations/tracing/lrumemoizer.js.map +1 -1
  35. package/build/cjs/integrations/tracing/mongo.js +3 -4
  36. package/build/cjs/integrations/tracing/mongo.js.map +1 -1
  37. package/build/cjs/integrations/tracing/mongoose.js +3 -4
  38. package/build/cjs/integrations/tracing/mongoose.js.map +1 -1
  39. package/build/cjs/integrations/tracing/mysql.js +2 -2
  40. package/build/cjs/integrations/tracing/mysql.js.map +1 -1
  41. package/build/cjs/integrations/tracing/mysql2.js +3 -4
  42. package/build/cjs/integrations/tracing/mysql2.js.map +1 -1
  43. package/build/cjs/integrations/tracing/postgres.js +3 -4
  44. package/build/cjs/integrations/tracing/postgres.js.map +1 -1
  45. package/build/cjs/integrations/tracing/postgresjs.js +3 -4
  46. package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
  47. package/build/cjs/integrations/tracing/prisma.js +2 -2
  48. package/build/cjs/integrations/tracing/prisma.js.map +1 -1
  49. package/build/cjs/integrations/tracing/redis.js +3 -3
  50. package/build/cjs/integrations/tracing/redis.js.map +1 -1
  51. package/build/cjs/integrations/tracing/tedious.js +3 -3
  52. package/build/cjs/integrations/tracing/tedious.js.map +1 -1
  53. package/build/cjs/integrations/tracing/vercelai/index.js +2 -2
  54. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
  55. package/build/cjs/preload.js +2 -2
  56. package/build/cjs/preload.js.map +1 -1
  57. package/build/cjs/sdk/index.js +22 -203
  58. package/build/cjs/sdk/index.js.map +1 -1
  59. package/build/cjs/sdk/initOtel.js +4 -22
  60. package/build/cjs/sdk/initOtel.js.map +1 -1
  61. package/build/esm/index.js +2 -21
  62. package/build/esm/index.js.map +1 -1
  63. package/build/esm/integrations/fs.js +1 -1
  64. package/build/esm/integrations/fs.js.map +1 -1
  65. package/build/esm/integrations/http/index.js +1 -5
  66. package/build/esm/integrations/http/index.js.map +1 -1
  67. package/build/esm/integrations/node-fetch/index.js +2 -3
  68. package/build/esm/integrations/node-fetch/index.js.map +1 -1
  69. package/build/esm/integrations/tracing/amqplib.js +1 -2
  70. package/build/esm/integrations/tracing/amqplib.js.map +1 -1
  71. package/build/esm/integrations/tracing/connect.js +1 -2
  72. package/build/esm/integrations/tracing/connect.js.map +1 -1
  73. package/build/esm/integrations/tracing/dataloader.js +1 -1
  74. package/build/esm/integrations/tracing/dataloader.js.map +1 -1
  75. package/build/esm/integrations/tracing/express.js +2 -4
  76. package/build/esm/integrations/tracing/express.js.map +1 -1
  77. package/build/esm/integrations/tracing/fastify/fastify-otel/index.js +3 -3
  78. package/build/esm/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
  79. package/build/esm/integrations/tracing/fastify/index.js +5 -5
  80. package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
  81. package/build/esm/integrations/tracing/genericPool.js +1 -1
  82. package/build/esm/integrations/tracing/genericPool.js.map +1 -1
  83. package/build/esm/integrations/tracing/graphql.js +2 -3
  84. package/build/esm/integrations/tracing/graphql.js.map +1 -1
  85. package/build/esm/integrations/tracing/hapi/index.js +1 -2
  86. package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
  87. package/build/esm/integrations/tracing/kafka.js +1 -2
  88. package/build/esm/integrations/tracing/kafka.js.map +1 -1
  89. package/build/esm/integrations/tracing/knex.js +1 -1
  90. package/build/esm/integrations/tracing/knex.js.map +1 -1
  91. package/build/esm/integrations/tracing/koa.js +2 -4
  92. package/build/esm/integrations/tracing/koa.js.map +1 -1
  93. package/build/esm/integrations/tracing/lrumemoizer.js +1 -1
  94. package/build/esm/integrations/tracing/lrumemoizer.js.map +1 -1
  95. package/build/esm/integrations/tracing/mongo.js +1 -2
  96. package/build/esm/integrations/tracing/mongo.js.map +1 -1
  97. package/build/esm/integrations/tracing/mongoose.js +1 -2
  98. package/build/esm/integrations/tracing/mongoose.js.map +1 -1
  99. package/build/esm/integrations/tracing/mysql.js +1 -1
  100. package/build/esm/integrations/tracing/mysql.js.map +1 -1
  101. package/build/esm/integrations/tracing/mysql2.js +1 -2
  102. package/build/esm/integrations/tracing/mysql2.js.map +1 -1
  103. package/build/esm/integrations/tracing/postgres.js +1 -2
  104. package/build/esm/integrations/tracing/postgres.js.map +1 -1
  105. package/build/esm/integrations/tracing/postgresjs.js +2 -3
  106. package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
  107. package/build/esm/integrations/tracing/prisma.js +1 -1
  108. package/build/esm/integrations/tracing/prisma.js.map +1 -1
  109. package/build/esm/integrations/tracing/redis.js +1 -1
  110. package/build/esm/integrations/tracing/redis.js.map +1 -1
  111. package/build/esm/integrations/tracing/tedious.js +1 -1
  112. package/build/esm/integrations/tracing/tedious.js.map +1 -1
  113. package/build/esm/integrations/tracing/vercelai/index.js +1 -1
  114. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
  115. package/build/esm/package.json +1 -1
  116. package/build/esm/preload.js +1 -1
  117. package/build/esm/preload.js.map +1 -1
  118. package/build/esm/sdk/index.js +22 -202
  119. package/build/esm/sdk/index.js.map +1 -1
  120. package/build/esm/sdk/initOtel.js +3 -21
  121. package/build/esm/sdk/initOtel.js.map +1 -1
  122. package/build/types/index.d.ts +2 -21
  123. package/build/types/index.d.ts.map +1 -1
  124. package/build/types/integrations/http/index.d.ts +1 -1
  125. package/build/types/integrations/http/index.d.ts.map +1 -1
  126. package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
  127. package/build/types/integrations/tracing/amqplib.d.ts.map +1 -1
  128. package/build/types/integrations/tracing/connect.d.ts.map +1 -1
  129. package/build/types/integrations/tracing/express.d.ts.map +1 -1
  130. package/build/types/integrations/tracing/graphql.d.ts.map +1 -1
  131. package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
  132. package/build/types/integrations/tracing/kafka.d.ts.map +1 -1
  133. package/build/types/integrations/tracing/koa.d.ts.map +1 -1
  134. package/build/types/integrations/tracing/mongo.d.ts.map +1 -1
  135. package/build/types/integrations/tracing/mongoose.d.ts.map +1 -1
  136. package/build/types/integrations/tracing/mysql2.d.ts.map +1 -1
  137. package/build/types/integrations/tracing/postgres.d.ts.map +1 -1
  138. package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
  139. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
  140. package/build/types/sdk/index.d.ts +2 -6
  141. package/build/types/sdk/index.d.ts.map +1 -1
  142. package/build/types/sdk/initOtel.d.ts +1 -1
  143. package/build/types/sdk/initOtel.d.ts.map +1 -1
  144. package/build/types/types.d.ts +1 -1
  145. package/build/types/types.d.ts.map +1 -1
  146. package/build/types-ts3.8/index.d.ts +2 -21
  147. package/build/types-ts3.8/integrations/http/index.d.ts +1 -1
  148. package/build/types-ts3.8/sdk/index.d.ts +2 -6
  149. package/build/types-ts3.8/sdk/initOtel.d.ts +1 -1
  150. package/build/types-ts3.8/types.d.ts +1 -1
  151. package/package.json +4 -3
  152. package/build/cjs/cron/common.js +0 -56
  153. package/build/cjs/cron/common.js.map +0 -1
  154. package/build/cjs/cron/cron.js +0 -112
  155. package/build/cjs/cron/cron.js.map +0 -1
  156. package/build/cjs/cron/index.js +0 -15
  157. package/build/cjs/cron/index.js.map +0 -1
  158. package/build/cjs/cron/node-cron.js +0 -71
  159. package/build/cjs/cron/node-cron.js.map +0 -1
  160. package/build/cjs/cron/node-schedule.js +0 -65
  161. package/build/cjs/cron/node-schedule.js.map +0 -1
  162. package/build/cjs/integrations/anr/index.js +0 -238
  163. package/build/cjs/integrations/anr/index.js.map +0 -1
  164. package/build/cjs/integrations/childProcess.js +0 -100
  165. package/build/cjs/integrations/childProcess.js.map +0 -1
  166. package/build/cjs/integrations/context.js +0 -457
  167. package/build/cjs/integrations/context.js.map +0 -1
  168. package/build/cjs/integrations/contextlines.js +0 -405
  169. package/build/cjs/integrations/contextlines.js.map +0 -1
  170. package/build/cjs/integrations/http/SentryHttpInstrumentation.js +0 -558
  171. package/build/cjs/integrations/http/SentryHttpInstrumentation.js.map +0 -1
  172. package/build/cjs/integrations/local-variables/common.js +0 -69
  173. package/build/cjs/integrations/local-variables/common.js.map +0 -1
  174. package/build/cjs/integrations/local-variables/index.js +0 -12
  175. package/build/cjs/integrations/local-variables/index.js.map +0 -1
  176. package/build/cjs/integrations/local-variables/local-variables-async.js +0 -143
  177. package/build/cjs/integrations/local-variables/local-variables-async.js.map +0 -1
  178. package/build/cjs/integrations/local-variables/local-variables-sync.js +0 -410
  179. package/build/cjs/integrations/local-variables/local-variables-sync.js.map +0 -1
  180. package/build/cjs/integrations/modules.js +0 -135
  181. package/build/cjs/integrations/modules.js.map +0 -1
  182. package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js +0 -291
  183. package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +0 -1
  184. package/build/cjs/integrations/onuncaughtexception.js +0 -134
  185. package/build/cjs/integrations/onuncaughtexception.js.map +0 -1
  186. package/build/cjs/integrations/onunhandledrejection.js +0 -89
  187. package/build/cjs/integrations/onunhandledrejection.js.map +0 -1
  188. package/build/cjs/integrations/processSession.js +0 -36
  189. package/build/cjs/integrations/processSession.js.map +0 -1
  190. package/build/cjs/integrations/spotlight.js +0 -101
  191. package/build/cjs/integrations/spotlight.js.map +0 -1
  192. package/build/cjs/integrations/winston.js +0 -151
  193. package/build/cjs/integrations/winston.js.map +0 -1
  194. package/build/cjs/logs/capture.js +0 -29
  195. package/build/cjs/logs/capture.js.map +0 -1
  196. package/build/cjs/logs/exports.js +0 -178
  197. package/build/cjs/logs/exports.js.map +0 -1
  198. package/build/cjs/nodeVersion.js +0 -12
  199. package/build/cjs/nodeVersion.js.map +0 -1
  200. package/build/cjs/otel/contextManager.js +0 -16
  201. package/build/cjs/otel/contextManager.js.map +0 -1
  202. package/build/cjs/otel/instrument.js +0 -139
  203. package/build/cjs/otel/instrument.js.map +0 -1
  204. package/build/cjs/proxy/base.js +0 -122
  205. package/build/cjs/proxy/base.js.map +0 -1
  206. package/build/cjs/proxy/index.js +0 -173
  207. package/build/cjs/proxy/index.js.map +0 -1
  208. package/build/cjs/proxy/parse-proxy-response.js +0 -104
  209. package/build/cjs/proxy/parse-proxy-response.js.map +0 -1
  210. package/build/cjs/sdk/api.js +0 -117
  211. package/build/cjs/sdk/api.js.map +0 -1
  212. package/build/cjs/sdk/client.js +0 -156
  213. package/build/cjs/sdk/client.js.map +0 -1
  214. package/build/cjs/transports/http.js +0 -158
  215. package/build/cjs/transports/http.js.map +0 -1
  216. package/build/cjs/utils/addOriginToSpan.js +0 -11
  217. package/build/cjs/utils/addOriginToSpan.js.map +0 -1
  218. package/build/cjs/utils/baggage.js +0 -36
  219. package/build/cjs/utils/baggage.js.map +0 -1
  220. package/build/cjs/utils/commonjs.js +0 -13
  221. package/build/cjs/utils/commonjs.js.map +0 -1
  222. package/build/cjs/utils/createMissingInstrumentationContext.js +0 -11
  223. package/build/cjs/utils/createMissingInstrumentationContext.js.map +0 -1
  224. package/build/cjs/utils/debug.js +0 -23
  225. package/build/cjs/utils/debug.js.map +0 -1
  226. package/build/cjs/utils/ensureIsWrapped.js +0 -41
  227. package/build/cjs/utils/ensureIsWrapped.js.map +0 -1
  228. package/build/cjs/utils/envToBool.js +0 -32
  229. package/build/cjs/utils/envToBool.js.map +0 -1
  230. package/build/cjs/utils/errorhandling.js +0 -42
  231. package/build/cjs/utils/errorhandling.js.map +0 -1
  232. package/build/cjs/utils/getRequestUrl.js +0 -18
  233. package/build/cjs/utils/getRequestUrl.js.map +0 -1
  234. package/build/cjs/utils/module.js +0 -60
  235. package/build/cjs/utils/module.js.map +0 -1
  236. package/build/esm/cron/common.js +0 -54
  237. package/build/esm/cron/common.js.map +0 -1
  238. package/build/esm/cron/cron.js +0 -110
  239. package/build/esm/cron/cron.js.map +0 -1
  240. package/build/esm/cron/index.js +0 -13
  241. package/build/esm/cron/index.js.map +0 -1
  242. package/build/esm/cron/node-cron.js +0 -69
  243. package/build/esm/cron/node-cron.js.map +0 -1
  244. package/build/esm/cron/node-schedule.js +0 -63
  245. package/build/esm/cron/node-schedule.js.map +0 -1
  246. package/build/esm/integrations/anr/index.js +0 -234
  247. package/build/esm/integrations/anr/index.js.map +0 -1
  248. package/build/esm/integrations/anr/worker-script.js +0 -2
  249. package/build/esm/integrations/childProcess.js +0 -98
  250. package/build/esm/integrations/childProcess.js.map +0 -1
  251. package/build/esm/integrations/context.js +0 -451
  252. package/build/esm/integrations/context.js.map +0 -1
  253. package/build/esm/integrations/contextlines.js +0 -399
  254. package/build/esm/integrations/contextlines.js.map +0 -1
  255. package/build/esm/integrations/http/SentryHttpInstrumentation.js +0 -555
  256. package/build/esm/integrations/http/SentryHttpInstrumentation.js.map +0 -1
  257. package/build/esm/integrations/local-variables/common.js +0 -64
  258. package/build/esm/integrations/local-variables/common.js.map +0 -1
  259. package/build/esm/integrations/local-variables/index.js +0 -10
  260. package/build/esm/integrations/local-variables/index.js.map +0 -1
  261. package/build/esm/integrations/local-variables/local-variables-async.js +0 -140
  262. package/build/esm/integrations/local-variables/local-variables-async.js.map +0 -1
  263. package/build/esm/integrations/local-variables/local-variables-sync.js +0 -405
  264. package/build/esm/integrations/local-variables/local-variables-sync.js.map +0 -1
  265. package/build/esm/integrations/local-variables/worker-script.js +0 -2
  266. package/build/esm/integrations/modules.js +0 -133
  267. package/build/esm/integrations/modules.js.map +0 -1
  268. package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js +0 -289
  269. package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +0 -1
  270. package/build/esm/integrations/onuncaughtexception.js +0 -131
  271. package/build/esm/integrations/onuncaughtexception.js.map +0 -1
  272. package/build/esm/integrations/onunhandledrejection.js +0 -86
  273. package/build/esm/integrations/onunhandledrejection.js.map +0 -1
  274. package/build/esm/integrations/processSession.js +0 -34
  275. package/build/esm/integrations/processSession.js.map +0 -1
  276. package/build/esm/integrations/spotlight.js +0 -98
  277. package/build/esm/integrations/spotlight.js.map +0 -1
  278. package/build/esm/integrations/winston.js +0 -149
  279. package/build/esm/integrations/winston.js.map +0 -1
  280. package/build/esm/logs/capture.js +0 -27
  281. package/build/esm/logs/capture.js.map +0 -1
  282. package/build/esm/logs/exports.js +0 -170
  283. package/build/esm/logs/exports.js.map +0 -1
  284. package/build/esm/nodeVersion.js +0 -8
  285. package/build/esm/nodeVersion.js.map +0 -1
  286. package/build/esm/otel/contextManager.js +0 -14
  287. package/build/esm/otel/contextManager.js.map +0 -1
  288. package/build/esm/otel/instrument.js +0 -135
  289. package/build/esm/otel/instrument.js.map +0 -1
  290. package/build/esm/proxy/base.js +0 -120
  291. package/build/esm/proxy/base.js.map +0 -1
  292. package/build/esm/proxy/index.js +0 -171
  293. package/build/esm/proxy/index.js.map +0 -1
  294. package/build/esm/proxy/parse-proxy-response.js +0 -102
  295. package/build/esm/proxy/parse-proxy-response.js.map +0 -1
  296. package/build/esm/sdk/api.js +0 -114
  297. package/build/esm/sdk/api.js.map +0 -1
  298. package/build/esm/sdk/client.js +0 -154
  299. package/build/esm/sdk/client.js.map +0 -1
  300. package/build/esm/transports/http.js +0 -156
  301. package/build/esm/transports/http.js.map +0 -1
  302. package/build/esm/utils/addOriginToSpan.js +0 -9
  303. package/build/esm/utils/addOriginToSpan.js.map +0 -1
  304. package/build/esm/utils/baggage.js +0 -34
  305. package/build/esm/utils/baggage.js.map +0 -1
  306. package/build/esm/utils/commonjs.js +0 -11
  307. package/build/esm/utils/commonjs.js.map +0 -1
  308. package/build/esm/utils/createMissingInstrumentationContext.js +0 -9
  309. package/build/esm/utils/createMissingInstrumentationContext.js.map +0 -1
  310. package/build/esm/utils/debug.js +0 -21
  311. package/build/esm/utils/debug.js.map +0 -1
  312. package/build/esm/utils/ensureIsWrapped.js +0 -39
  313. package/build/esm/utils/ensureIsWrapped.js.map +0 -1
  314. package/build/esm/utils/envToBool.js +0 -28
  315. package/build/esm/utils/envToBool.js.map +0 -1
  316. package/build/esm/utils/errorhandling.js +0 -40
  317. package/build/esm/utils/errorhandling.js.map +0 -1
  318. package/build/esm/utils/getRequestUrl.js +0 -16
  319. package/build/esm/utils/getRequestUrl.js.map +0 -1
  320. package/build/esm/utils/module.js +0 -58
  321. package/build/esm/utils/module.js.map +0 -1
  322. package/build/types/cron/common.d.ts +0 -5
  323. package/build/types/cron/common.d.ts.map +0 -1
  324. package/build/types/cron/cron.d.ts +0 -43
  325. package/build/types/cron/cron.d.ts.map +0 -1
  326. package/build/types/cron/index.d.ts +0 -10
  327. package/build/types/cron/index.d.ts.map +0 -1
  328. package/build/types/cron/node-cron.d.ts +0 -27
  329. package/build/types/cron/node-cron.d.ts.map +0 -1
  330. package/build/types/cron/node-schedule.d.ts +0 -19
  331. package/build/types/cron/node-schedule.d.ts.map +0 -1
  332. package/build/types/integrations/anr/common.d.ts +0 -52
  333. package/build/types/integrations/anr/common.d.ts.map +0 -1
  334. package/build/types/integrations/anr/index.d.ts +0 -13
  335. package/build/types/integrations/anr/index.d.ts.map +0 -1
  336. package/build/types/integrations/anr/worker.d.ts +0 -2
  337. package/build/types/integrations/anr/worker.d.ts.map +0 -1
  338. package/build/types/integrations/childProcess.d.ts +0 -20
  339. package/build/types/integrations/childProcess.d.ts.map +0 -1
  340. package/build/types/integrations/context.d.ts +0 -30
  341. package/build/types/integrations/context.d.ts.map +0 -1
  342. package/build/types/integrations/contextlines.d.ts +0 -31
  343. package/build/types/integrations/contextlines.d.ts.map +0 -1
  344. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts +0 -131
  345. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts.map +0 -1
  346. package/build/types/integrations/local-variables/common.d.ts +0 -66
  347. package/build/types/integrations/local-variables/common.d.ts.map +0 -1
  348. package/build/types/integrations/local-variables/index.d.ts +0 -4
  349. package/build/types/integrations/local-variables/index.d.ts.map +0 -1
  350. package/build/types/integrations/local-variables/local-variables-async.d.ts +0 -7
  351. package/build/types/integrations/local-variables/local-variables-async.d.ts.map +0 -1
  352. package/build/types/integrations/local-variables/local-variables-sync.d.ts +0 -34
  353. package/build/types/integrations/local-variables/local-variables-sync.d.ts.map +0 -1
  354. package/build/types/integrations/local-variables/worker.d.ts +0 -2
  355. package/build/types/integrations/local-variables/worker.d.ts.map +0 -1
  356. package/build/types/integrations/modules.d.ts +0 -17
  357. package/build/types/integrations/modules.d.ts.map +0 -1
  358. package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +0 -56
  359. package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts.map +0 -1
  360. package/build/types/integrations/onuncaughtexception.d.ts +0 -31
  361. package/build/types/integrations/onuncaughtexception.d.ts.map +0 -1
  362. package/build/types/integrations/onunhandledrejection.d.ts +0 -23
  363. package/build/types/integrations/onunhandledrejection.d.ts.map +0 -1
  364. package/build/types/integrations/processSession.d.ts +0 -5
  365. package/build/types/integrations/processSession.d.ts.map +0 -1
  366. package/build/types/integrations/spotlight.d.ts +0 -18
  367. package/build/types/integrations/spotlight.d.ts.map +0 -1
  368. package/build/types/integrations/winston.d.ts +0 -44
  369. package/build/types/integrations/winston.d.ts.map +0 -1
  370. package/build/types/logs/capture.d.ts +0 -11
  371. package/build/types/logs/capture.d.ts.map +0 -1
  372. package/build/types/logs/exports.d.ts +0 -150
  373. package/build/types/logs/exports.d.ts.map +0 -1
  374. package/build/types/nodeVersion.d.ts +0 -8
  375. package/build/types/nodeVersion.d.ts.map +0 -1
  376. package/build/types/otel/contextManager.d.ts +0 -10
  377. package/build/types/otel/contextManager.d.ts.map +0 -1
  378. package/build/types/otel/instrument.d.ts +0 -23
  379. package/build/types/otel/instrument.d.ts.map +0 -1
  380. package/build/types/proxy/base.d.ts +0 -65
  381. package/build/types/proxy/base.d.ts.map +0 -1
  382. package/build/types/proxy/helpers.d.ts +0 -42
  383. package/build/types/proxy/helpers.d.ts.map +0 -1
  384. package/build/types/proxy/index.d.ts +0 -73
  385. package/build/types/proxy/index.d.ts.map +0 -1
  386. package/build/types/proxy/parse-proxy-response.d.ts +0 -43
  387. package/build/types/proxy/parse-proxy-response.d.ts.map +0 -1
  388. package/build/types/sdk/api.d.ts +0 -8
  389. package/build/types/sdk/api.d.ts.map +0 -1
  390. package/build/types/sdk/client.d.ts +0 -29
  391. package/build/types/sdk/client.d.ts.map +0 -1
  392. package/build/types/sdk/scope.d.ts +0 -7
  393. package/build/types/sdk/scope.d.ts.map +0 -1
  394. package/build/types/transports/http-module.d.ts +0 -31
  395. package/build/types/transports/http-module.d.ts.map +0 -1
  396. package/build/types/transports/http.d.ts +0 -21
  397. package/build/types/transports/http.d.ts.map +0 -1
  398. package/build/types/transports/index.d.ts +0 -3
  399. package/build/types/transports/index.d.ts.map +0 -1
  400. package/build/types/utils/addOriginToSpan.d.ts +0 -5
  401. package/build/types/utils/addOriginToSpan.d.ts.map +0 -1
  402. package/build/types/utils/baggage.d.ts +0 -6
  403. package/build/types/utils/baggage.d.ts.map +0 -1
  404. package/build/types/utils/commonjs.d.ts +0 -3
  405. package/build/types/utils/commonjs.d.ts.map +0 -1
  406. package/build/types/utils/createMissingInstrumentationContext.d.ts +0 -3
  407. package/build/types/utils/createMissingInstrumentationContext.d.ts.map +0 -1
  408. package/build/types/utils/debug.d.ts +0 -5
  409. package/build/types/utils/debug.d.ts.map +0 -1
  410. package/build/types/utils/ensureIsWrapped.d.ts +0 -5
  411. package/build/types/utils/ensureIsWrapped.d.ts.map +0 -1
  412. package/build/types/utils/entry-point.d.ts +0 -24
  413. package/build/types/utils/entry-point.d.ts.map +0 -1
  414. package/build/types/utils/envToBool.d.ts +0 -13
  415. package/build/types/utils/envToBool.d.ts.map +0 -1
  416. package/build/types/utils/errorhandling.d.ts +0 -5
  417. package/build/types/utils/errorhandling.d.ts.map +0 -1
  418. package/build/types/utils/getRequestUrl.d.ts +0 -5
  419. package/build/types/utils/getRequestUrl.d.ts.map +0 -1
  420. package/build/types/utils/module.d.ts +0 -3
  421. package/build/types/utils/module.d.ts.map +0 -1
  422. package/build/types/utils/prepareEvent.d.ts +0 -17
  423. package/build/types/utils/prepareEvent.d.ts.map +0 -1
  424. package/build/types-ts3.8/cron/common.d.ts +0 -5
  425. package/build/types-ts3.8/cron/cron.d.ts +0 -43
  426. package/build/types-ts3.8/cron/index.d.ts +0 -10
  427. package/build/types-ts3.8/cron/node-cron.d.ts +0 -27
  428. package/build/types-ts3.8/cron/node-schedule.d.ts +0 -19
  429. package/build/types-ts3.8/integrations/anr/common.d.ts +0 -52
  430. package/build/types-ts3.8/integrations/anr/index.d.ts +0 -13
  431. package/build/types-ts3.8/integrations/anr/worker.d.ts +0 -2
  432. package/build/types-ts3.8/integrations/childProcess.d.ts +0 -20
  433. package/build/types-ts3.8/integrations/context.d.ts +0 -30
  434. package/build/types-ts3.8/integrations/contextlines.d.ts +0 -31
  435. package/build/types-ts3.8/integrations/http/SentryHttpInstrumentation.d.ts +0 -133
  436. package/build/types-ts3.8/integrations/local-variables/common.d.ts +0 -66
  437. package/build/types-ts3.8/integrations/local-variables/index.d.ts +0 -4
  438. package/build/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +0 -7
  439. package/build/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +0 -34
  440. package/build/types-ts3.8/integrations/local-variables/worker.d.ts +0 -2
  441. package/build/types-ts3.8/integrations/modules.d.ts +0 -17
  442. package/build/types-ts3.8/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +0 -56
  443. package/build/types-ts3.8/integrations/onuncaughtexception.d.ts +0 -31
  444. package/build/types-ts3.8/integrations/onunhandledrejection.d.ts +0 -23
  445. package/build/types-ts3.8/integrations/processSession.d.ts +0 -5
  446. package/build/types-ts3.8/integrations/spotlight.d.ts +0 -18
  447. package/build/types-ts3.8/integrations/winston.d.ts +0 -44
  448. package/build/types-ts3.8/logs/capture.d.ts +0 -18
  449. package/build/types-ts3.8/logs/exports.d.ts +0 -150
  450. package/build/types-ts3.8/nodeVersion.d.ts +0 -8
  451. package/build/types-ts3.8/otel/contextManager.d.ts +0 -10
  452. package/build/types-ts3.8/otel/instrument.d.ts +0 -23
  453. package/build/types-ts3.8/proxy/base.d.ts +0 -60
  454. package/build/types-ts3.8/proxy/helpers.d.ts +0 -38
  455. package/build/types-ts3.8/proxy/index.d.ts +0 -74
  456. package/build/types-ts3.8/proxy/parse-proxy-response.d.ts +0 -40
  457. package/build/types-ts3.8/sdk/api.d.ts +0 -8
  458. package/build/types-ts3.8/sdk/client.d.ts +0 -32
  459. package/build/types-ts3.8/sdk/scope.d.ts +0 -7
  460. package/build/types-ts3.8/transports/http-module.d.ts +0 -28
  461. package/build/types-ts3.8/transports/http.d.ts +0 -20
  462. package/build/types-ts3.8/transports/index.d.ts +0 -3
  463. package/build/types-ts3.8/utils/addOriginToSpan.d.ts +0 -5
  464. package/build/types-ts3.8/utils/baggage.d.ts +0 -6
  465. package/build/types-ts3.8/utils/commonjs.d.ts +0 -3
  466. package/build/types-ts3.8/utils/createMissingInstrumentationContext.d.ts +0 -3
  467. package/build/types-ts3.8/utils/debug.d.ts +0 -5
  468. package/build/types-ts3.8/utils/ensureIsWrapped.d.ts +0 -5
  469. package/build/types-ts3.8/utils/entry-point.d.ts +0 -24
  470. package/build/types-ts3.8/utils/envToBool.d.ts +0 -13
  471. package/build/types-ts3.8/utils/errorhandling.d.ts +0 -5
  472. package/build/types-ts3.8/utils/getRequestUrl.d.ts +0 -5
  473. package/build/types-ts3.8/utils/module.d.ts +0 -3
  474. package/build/types-ts3.8/utils/prepareEvent.d.ts +0 -17
@@ -2,20 +2,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationKafkajs = require('@opentelemetry/instrumentation-kafkajs');
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 = 'Kafka';
9
8
 
10
- const instrumentKafka = instrument.generateInstrumentOnce(
9
+ const instrumentKafka = nodeCore.generateInstrumentOnce(
11
10
  INTEGRATION_NAME,
12
11
  () =>
13
12
  new instrumentationKafkajs.KafkaJsInstrumentation({
14
13
  consumerHook(span) {
15
- addOriginToSpan.addOriginToSpan(span, 'auto.kafkajs.otel.consumer');
14
+ nodeCore.addOriginToSpan(span, 'auto.kafkajs.otel.consumer');
16
15
  },
17
16
  producerHook(span) {
18
- addOriginToSpan.addOriginToSpan(span, 'auto.kafkajs.otel.producer');
17
+ nodeCore.addOriginToSpan(span, 'auto.kafkajs.otel.producer');
19
18
  },
20
19
  }),
21
20
  );
@@ -1 +1 @@
1
- {"version":3,"file":"kafka.js","sources":["../../../../src/integrations/tracing/kafka.ts"],"sourcesContent":["import { KafkaJsInstrumentation } from '@opentelemetry/instrumentation-kafkajs';\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 = 'Kafka';\n\nexport const instrumentKafka = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new KafkaJsInstrumentation({\n consumerHook(span) {\n addOriginToSpan(span, 'auto.kafkajs.otel.consumer');\n },\n producerHook(span) {\n addOriginToSpan(span, 'auto.kafkajs.otel.producer');\n },\n }),\n);\n\nconst _kafkaIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKafka();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [kafkajs](https://www.npmjs.com/package/kafkajs) library.\n *\n * For more information, see the [`kafkaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/kafka/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.kafkaIntegration()],\n * });\n */\nexport const kafkaIntegration = defineIntegration(_kafkaIntegration);\n"],"names":["generateInstrumentOnce","KafkaJsInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;;AAMA,MAAM,gBAAA,GAAmB,OAAO;;AAEzB,MAAM,eAAgB,GAAEA,iCAAsB;AACrD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,6CAAsB,CAAC;AAC/B,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,+BAAe,CAAC,IAAI,EAAE,4BAA4B,CAAC;AAC3D,OAAO;AACP,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQA,+BAAe,CAAC,IAAI,EAAE,4BAA4B,CAAC;AAC3D,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,iBAAkB,IAAG,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAe,EAAE;AACvB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,gBAAiB,GAAEC,sBAAiB,CAAC,iBAAiB;;;;;"}
1
+ {"version":3,"file":"kafka.js","sources":["../../../../src/integrations/tracing/kafka.ts"],"sourcesContent":["import { KafkaJsInstrumentation } from '@opentelemetry/instrumentation-kafkajs';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Kafka';\n\nexport const instrumentKafka = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new KafkaJsInstrumentation({\n consumerHook(span) {\n addOriginToSpan(span, 'auto.kafkajs.otel.consumer');\n },\n producerHook(span) {\n addOriginToSpan(span, 'auto.kafkajs.otel.producer');\n },\n }),\n);\n\nconst _kafkaIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKafka();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [kafkajs](https://www.npmjs.com/package/kafkajs) library.\n *\n * For more information, see the [`kafkaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/kafka/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.kafkaIntegration()],\n * });\n */\nexport const kafkaIntegration = defineIntegration(_kafkaIntegration);\n"],"names":["generateInstrumentOnce","KafkaJsInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAO;;AAEzB,MAAM,eAAgB,GAAEA,+BAAsB;AACrD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,6CAAsB,CAAC;AAC/B,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,4BAA4B,CAAC;AAC3D,OAAO;AACP,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQA,wBAAe,CAAC,IAAI,EAAE,4BAA4B,CAAC;AAC3D,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,iBAAkB,IAAG,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAe,EAAE;AACvB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,gBAAiB,GAAEC,sBAAiB,CAAC,iBAAiB;;;;;"}
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationKnex = require('@opentelemetry/instrumentation-knex');
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 = 'Knex';
8
8
 
9
- const instrumentKnex = instrument.generateInstrumentOnce(
9
+ const instrumentKnex = nodeCore.generateInstrumentOnce(
10
10
  INTEGRATION_NAME,
11
11
  () => new instrumentationKnex.KnexInstrumentation({ requireParentSpan: true }),
12
12
  );
@@ -18,7 +18,7 @@ const _knexIntegration = (() => {
18
18
  name: INTEGRATION_NAME,
19
19
  setupOnce() {
20
20
  const instrumentation = instrumentKnex();
21
- instrumentationWrappedCallback = instrument.instrumentWhenWrapped(instrumentation);
21
+ instrumentationWrappedCallback = nodeCore.instrumentWhenWrapped(instrumentation);
22
22
  },
23
23
 
24
24
  setup(client) {
@@ -1 +1 @@
1
- {"version":3,"file":"knex.js","sources":["../../../../src/integrations/tracing/knex.ts"],"sourcesContent":["import { KnexInstrumentation } from '@opentelemetry/instrumentation-knex';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core';\nimport { generateInstrumentOnce, instrumentWhenWrapped } from '../../otel/instrument';\n\nconst INTEGRATION_NAME = 'Knex';\n\nexport const instrumentKnex = generateInstrumentOnce(\n INTEGRATION_NAME,\n () => new KnexInstrumentation({ requireParentSpan: true }),\n);\n\nconst _knexIntegration = (() => {\n let instrumentationWrappedCallback: undefined | ((callback: () => void) => void);\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n const instrumentation = instrumentKnex();\n instrumentationWrappedCallback = instrumentWhenWrapped(instrumentation);\n },\n\n setup(client) {\n instrumentationWrappedCallback?.(() =>\n client.on('spanStart', span => {\n const { data } = spanToJSON(span);\n // knex.version is always set in the span data\n // https://github.com/open-telemetry/opentelemetry-js-contrib/blob/0309caeafc44ac9cb13a3345b790b01b76d0497d/plugins/node/opentelemetry-instrumentation-knex/src/instrumentation.ts#L138\n if ('knex.version' in data) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.knex');\n }\n }),\n );\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Knex integration\n *\n * Capture tracing data for [Knex](https://knexjs.org/).\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n *\n * Sentry.init({\n * integrations: [Sentry.knexIntegration()],\n * });\n * ```\n */\nexport const knexIntegration = defineIntegration(_knexIntegration);\n"],"names":["generateInstrumentOnce","KnexInstrumentation","instrumentWhenWrapped","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,MAAM;;AAExB,MAAM,cAAe,GAAEA,iCAAsB;AACpD,EAAE,gBAAgB;AAClB,EAAE,MAAM,IAAIC,uCAAmB,CAAC,EAAE,iBAAiB,EAAE,IAAK,EAAC,CAAC;AAC5D;;AAEA,MAAM,gBAAiB,IAAG,MAAM;AAChC,EAAE,IAAI,8BAA8B;;AAEpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,MAAM,eAAA,GAAkB,cAAc,EAAE;AAC9C,MAAM,8BAA+B,GAAEC,gCAAqB,CAAC,eAAe,CAAC;AAC7E,KAAK;;AAEL,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,8BAA8B,GAAG;AACvC,QAAQ,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ;AACvC,UAAU,MAAM,EAAE,IAAK,EAAA,GAAIC,eAAU,CAAC,IAAI,CAAC;AAC3C;AACA;AACA,UAAU,IAAI,cAAe,IAAG,IAAI,EAAE;AACtC,YAAY,IAAI,CAAC,YAAY,CAACC,qCAAgC,EAAE,mBAAmB,CAAC;AACpF;AACA,SAAS,CAAC;AACV,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,eAAgB,GAAEC,sBAAiB,CAAC,gBAAgB;;;;;"}
1
+ {"version":3,"file":"knex.js","sources":["../../../../src/integrations/tracing/knex.ts"],"sourcesContent":["import { KnexInstrumentation } from '@opentelemetry/instrumentation-knex';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core';\nimport { generateInstrumentOnce, instrumentWhenWrapped } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Knex';\n\nexport const instrumentKnex = generateInstrumentOnce(\n INTEGRATION_NAME,\n () => new KnexInstrumentation({ requireParentSpan: true }),\n);\n\nconst _knexIntegration = (() => {\n let instrumentationWrappedCallback: undefined | ((callback: () => void) => void);\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n const instrumentation = instrumentKnex();\n instrumentationWrappedCallback = instrumentWhenWrapped(instrumentation);\n },\n\n setup(client) {\n instrumentationWrappedCallback?.(() =>\n client.on('spanStart', span => {\n const { data } = spanToJSON(span);\n // knex.version is always set in the span data\n // https://github.com/open-telemetry/opentelemetry-js-contrib/blob/0309caeafc44ac9cb13a3345b790b01b76d0497d/plugins/node/opentelemetry-instrumentation-knex/src/instrumentation.ts#L138\n if ('knex.version' in data) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.knex');\n }\n }),\n );\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Knex integration\n *\n * Capture tracing data for [Knex](https://knexjs.org/).\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n *\n * Sentry.init({\n * integrations: [Sentry.knexIntegration()],\n * });\n * ```\n */\nexport const knexIntegration = defineIntegration(_knexIntegration);\n"],"names":["generateInstrumentOnce","KnexInstrumentation","instrumentWhenWrapped","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,MAAM;;AAExB,MAAM,cAAe,GAAEA,+BAAsB;AACpD,EAAE,gBAAgB;AAClB,EAAE,MAAM,IAAIC,uCAAmB,CAAC,EAAE,iBAAiB,EAAE,IAAK,EAAC,CAAC;AAC5D;;AAEA,MAAM,gBAAiB,IAAG,MAAM;AAChC,EAAE,IAAI,8BAA8B;;AAEpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,MAAM,eAAA,GAAkB,cAAc,EAAE;AAC9C,MAAM,8BAA+B,GAAEC,8BAAqB,CAAC,eAAe,CAAC;AAC7E,KAAK;;AAEL,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,8BAA8B,GAAG;AACvC,QAAQ,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ;AACvC,UAAU,MAAM,EAAE,IAAK,EAAA,GAAIC,eAAU,CAAC,IAAI,CAAC;AAC3C;AACA;AACA,UAAU,IAAI,cAAe,IAAG,IAAI,EAAE;AACtC,YAAY,IAAI,CAAC,YAAY,CAACC,qCAAgC,EAAE,mBAAmB,CAAC;AACpF;AACA,SAAS,CAAC;AACV,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,eAAgB,GAAEC,sBAAiB,CAAC,gBAAgB;;;;;"}
@@ -3,21 +3,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
3
  const instrumentationKoa = require('@opentelemetry/instrumentation-koa');
4
4
  const semanticConventions = require('@opentelemetry/semantic-conventions');
5
5
  const core = require('@sentry/core');
6
+ const nodeCore = require('@sentry/node-core');
6
7
  const debugBuild = require('../../debug-build.js');
7
- const instrument = require('../../otel/instrument.js');
8
- const addOriginToSpan = require('../../utils/addOriginToSpan.js');
9
- const ensureIsWrapped = require('../../utils/ensureIsWrapped.js');
10
8
 
11
9
  const INTEGRATION_NAME = 'Koa';
12
10
 
13
- const instrumentKoa = instrument.generateInstrumentOnce(
11
+ const instrumentKoa = nodeCore.generateInstrumentOnce(
14
12
  INTEGRATION_NAME,
15
13
  instrumentationKoa.KoaInstrumentation,
16
14
  (options = {}) => {
17
15
  return {
18
16
  ignoreLayersType: options.ignoreLayersType ,
19
17
  requestHook(span, info) {
20
- addOriginToSpan.addOriginToSpan(span, 'auto.http.otel.koa');
18
+ nodeCore.addOriginToSpan(span, 'auto.http.otel.koa');
21
19
 
22
20
  const attributes = core.spanToJSON(span).data;
23
21
 
@@ -126,7 +124,7 @@ const setupKoaErrorHandler = (app) => {
126
124
  }
127
125
  });
128
126
 
129
- ensureIsWrapped.ensureIsWrapped(app.use, 'koa');
127
+ nodeCore.ensureIsWrapped(app.use, 'koa');
130
128
  };
131
129
 
132
130
  exports.instrumentKoa = instrumentKoa;
@@ -1 +1 @@
1
- {"version":3,"file":"koa.js","sources":["../../../../src/integrations/tracing/koa.ts"],"sourcesContent":["import type { KoaInstrumentationConfig, KoaLayerType } from '@opentelemetry/instrumentation-koa';\nimport { KoaInstrumentation } from '@opentelemetry/instrumentation-koa';\nimport { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n captureException,\n defineIntegration,\n getDefaultIsolationScope,\n getIsolationScope,\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';\n\ninterface KoaOptions {\n /**\n * Ignore layers of specified types\n */\n ignoreLayersType?: Array<'middleware' | 'router'>;\n}\n\nconst INTEGRATION_NAME = 'Koa';\n\nexport const instrumentKoa = generateInstrumentOnce(\n INTEGRATION_NAME,\n KoaInstrumentation,\n (options: KoaOptions = {}) => {\n return {\n ignoreLayersType: options.ignoreLayersType as KoaLayerType[],\n requestHook(span, info) {\n addOriginToSpan(span, 'auto.http.otel.koa');\n\n const attributes = spanToJSON(span).data;\n\n // this is one of: middleware, router\n const type = attributes['koa.type'];\n if (type) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, `${type}.koa`);\n }\n\n // Also update the name\n const name = attributes['koa.name'];\n if (typeof name === 'string') {\n // Somehow, name is sometimes `''` for middleware spans\n // See: https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2220\n span.updateName(name || '< unknown >');\n }\n\n if (getIsolationScope() === getDefaultIsolationScope()) {\n DEBUG_BUILD && logger.warn('Isolation scope is default isolation scope - skipping setting transactionName');\n return;\n }\n const route = attributes[ATTR_HTTP_ROUTE];\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const method = info.context?.request?.method?.toUpperCase() || 'GET';\n if (route) {\n getIsolationScope().setTransactionName(`${method} ${route}`);\n }\n },\n } satisfies KoaInstrumentationConfig;\n },\n);\n\nconst _koaIntegration = ((options: KoaOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKoa(options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Koa](https://koajs.com/).\n *\n * If you also want to capture errors, you need to call `setupKoaErrorHandler(app)` after you set up your Koa server.\n *\n * For more information, see the [koa documentation](https://docs.sentry.io/platforms/javascript/guides/koa/).\n *\n * @param {KoaOptions} options Configuration options for the Koa integration.\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.koaIntegration()],\n * })\n * ```\n *\n * @example\n * ```javascript\n * // To ignore middleware spans\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [\n * Sentry.koaIntegration({\n * ignoreLayersType: ['middleware']\n * })\n * ],\n * })\n * ```\n */\nexport const koaIntegration = defineIntegration(_koaIntegration);\n\n/**\n * Add an Koa 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 Koa = require(\"koa\");\n *\n * const app = new Koa();\n *\n * Sentry.setupKoaErrorHandler(app);\n *\n * // Add your routes, etc.\n *\n * app.listen(3000);\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const setupKoaErrorHandler = (app: { use: (arg0: (ctx: any, next: any) => Promise<void>) => void }): void => {\n app.use(async (ctx, next) => {\n try {\n await next();\n } catch (error) {\n captureException(error);\n throw error;\n }\n });\n\n ensureIsWrapped(app.use, 'koa');\n};\n"],"names":["generateInstrumentOnce","KoaInstrumentation","addOriginToSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","getIsolationScope","getDefaultIsolationScope","DEBUG_BUILD","logger","ATTR_HTTP_ROUTE","defineIntegration","captureException","ensureIsWrapped"],"mappings":";;;;;;;;;;AAyBA,MAAM,gBAAA,GAAmB,KAAK;;AAEvB,MAAM,aAAc,GAAEA,iCAAsB;AACnD,EAAE,gBAAgB;AAClB,EAAEC,qCAAkB;AACpB,EAAE,CAAC,OAAO,GAAe,EAAE,KAAK;AAChC,IAAI,OAAO;AACX,MAAM,gBAAgB,EAAE,OAAO,CAAC,gBAAiB;AACjD,MAAM,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE;AAC9B,QAAQC,+BAAe,CAAC,IAAI,EAAE,oBAAoB,CAAC;;AAEnD,QAAQ,MAAM,aAAaC,eAAU,CAAC,IAAI,CAAC,CAAC,IAAI;;AAEhD;AACA,QAAQ,MAAM,IAAK,GAAE,UAAU,CAAC,UAAU,CAAC;AAC3C,QAAQ,IAAI,IAAI,EAAE;AAClB,UAAU,IAAI,CAAC,YAAY,CAACC,iCAA4B,EAAE,CAAC,EAAA,IAAA,CAAA,IAAA,CAAA,CAAA;AACA;;AAEA;AACA,QAAA,MAAA,IAAA,GAAA,UAAA,CAAA,UAAA,CAAA;AACA,QAAA,IAAA,OAAA,IAAA,KAAA,QAAA,EAAA;AACA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A,KAAA,EAAA;AACA,MAAAC,qBAAA,CAAA,KAAA,CAAA;AACA,MAAA,MAAA,KAAA;AACA;AACA,GAAA,CAAA;;AAEA,EAAAC,+BAAA,CAAA,GAAA,CAAA,GAAA,EAAA,KAAA,CAAA;AACA;;;;;;"}
1
+ {"version":3,"file":"koa.js","sources":["../../../../src/integrations/tracing/koa.ts"],"sourcesContent":["import type { KoaInstrumentationConfig, KoaLayerType } from '@opentelemetry/instrumentation-koa';\nimport { KoaInstrumentation } from '@opentelemetry/instrumentation-koa';\nimport { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n captureException,\n defineIntegration,\n getDefaultIsolationScope,\n getIsolationScope,\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';\n\ninterface KoaOptions {\n /**\n * Ignore layers of specified types\n */\n ignoreLayersType?: Array<'middleware' | 'router'>;\n}\n\nconst INTEGRATION_NAME = 'Koa';\n\nexport const instrumentKoa = generateInstrumentOnce(\n INTEGRATION_NAME,\n KoaInstrumentation,\n (options: KoaOptions = {}) => {\n return {\n ignoreLayersType: options.ignoreLayersType as KoaLayerType[],\n requestHook(span, info) {\n addOriginToSpan(span, 'auto.http.otel.koa');\n\n const attributes = spanToJSON(span).data;\n\n // this is one of: middleware, router\n const type = attributes['koa.type'];\n if (type) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, `${type}.koa`);\n }\n\n // Also update the name\n const name = attributes['koa.name'];\n if (typeof name === 'string') {\n // Somehow, name is sometimes `''` for middleware spans\n // See: https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2220\n span.updateName(name || '< unknown >');\n }\n\n if (getIsolationScope() === getDefaultIsolationScope()) {\n DEBUG_BUILD && logger.warn('Isolation scope is default isolation scope - skipping setting transactionName');\n return;\n }\n const route = attributes[ATTR_HTTP_ROUTE];\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const method = info.context?.request?.method?.toUpperCase() || 'GET';\n if (route) {\n getIsolationScope().setTransactionName(`${method} ${route}`);\n }\n },\n } satisfies KoaInstrumentationConfig;\n },\n);\n\nconst _koaIntegration = ((options: KoaOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKoa(options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Koa](https://koajs.com/).\n *\n * If you also want to capture errors, you need to call `setupKoaErrorHandler(app)` after you set up your Koa server.\n *\n * For more information, see the [koa documentation](https://docs.sentry.io/platforms/javascript/guides/koa/).\n *\n * @param {KoaOptions} options Configuration options for the Koa integration.\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.koaIntegration()],\n * })\n * ```\n *\n * @example\n * ```javascript\n * // To ignore middleware spans\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [\n * Sentry.koaIntegration({\n * ignoreLayersType: ['middleware']\n * })\n * ],\n * })\n * ```\n */\nexport const koaIntegration = defineIntegration(_koaIntegration);\n\n/**\n * Add an Koa 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 Koa = require(\"koa\");\n *\n * const app = new Koa();\n *\n * Sentry.setupKoaErrorHandler(app);\n *\n * // Add your routes, etc.\n *\n * app.listen(3000);\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const setupKoaErrorHandler = (app: { use: (arg0: (ctx: any, next: any) => Promise<void>) => void }): void => {\n app.use(async (ctx, next) => {\n try {\n await next();\n } catch (error) {\n captureException(error);\n throw error;\n }\n });\n\n ensureIsWrapped(app.use, 'koa');\n};\n"],"names":["generateInstrumentOnce","KoaInstrumentation","addOriginToSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","getIsolationScope","getDefaultIsolationScope","DEBUG_BUILD","logger","ATTR_HTTP_ROUTE","defineIntegration","captureException","ensureIsWrapped"],"mappings":";;;;;;;;AAuBA,MAAM,gBAAA,GAAmB,KAAK;;AAEvB,MAAM,aAAc,GAAEA,+BAAsB;AACnD,EAAE,gBAAgB;AAClB,EAAEC,qCAAkB;AACpB,EAAE,CAAC,OAAO,GAAe,EAAE,KAAK;AAChC,IAAI,OAAO;AACX,MAAM,gBAAgB,EAAE,OAAO,CAAC,gBAAiB;AACjD,MAAM,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE;AAC9B,QAAQC,wBAAe,CAAC,IAAI,EAAE,oBAAoB,CAAC;;AAEnD,QAAQ,MAAM,aAAaC,eAAU,CAAC,IAAI,CAAC,CAAC,IAAI;;AAEhD;AACA,QAAQ,MAAM,IAAK,GAAE,UAAU,CAAC,UAAU,CAAC;AAC3C,QAAQ,IAAI,IAAI,EAAE;AAClB,UAAU,IAAI,CAAC,YAAY,CAACC,iCAA4B,EAAE,CAAC,EAAA,IAAA,CAAA,IAAA,CAAA,CAAA;AACA;;AAEA;AACA,QAAA,MAAA,IAAA,GAAA,UAAA,CAAA,UAAA,CAAA;AACA,QAAA,IAAA,OAAA,IAAA,KAAA,QAAA,EAAA;AACA;AACA;AACA,UAAA,IAAA,CAAA,UAAA,CAAA,IAAA,IAAA,aAAA,CAAA;AACA;;AAEA,QAAA,IAAAC,sBAAA,EAAA,KAAAC,6BAAA,EAAA,EAAA;AACA,UAAAC,sBAAA,IAAAC,WAAA,CAAA,IAAA,CAAA,+EAAA,CAAA;AACA,UAAA;AACA;AACA,QAAA,MAAA,KAAA,GAAA,UAAA,CAAAC,mCAAA,CAAA;AACA;AACA,QAAA,MAAA,MAAA,GAAA,IAAA,CAAA,OAAA,EAAA,OAAA,EAAA,MAAA,EAAA,WAAA,EAAA,IAAA,KAAA;AACA,QAAA,IAAA,KAAA,EAAA;AACA,UAAAJ,sBAAA,EAAA,CAAA,kBAAA,CAAA,CAAA,EAAA,MAAA,CAAA,CAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AACA;AACA,OAAA;AACA,KAAA;AACA,GAAA;AACA;;AAEA,MAAA,eAAA,IAAA,CAAA,OAAA,GAAA,EAAA,KAAA;AACA,EAAA,OAAA;AACA,IAAA,IAAA,EAAA,gBAAA;AACA,IAAA,SAAA,GAAA;AACA,MAAA,aAAA,CAAA,OAAA,CAAA;AACA,KAAA;AACA,GAAA;AACA,CAAA,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAA,cAAA,GAAAK,sBAAA,CAAA,eAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAA,oBAAA,GAAA,CAAA,GAAA,KAAA;AACA,EAAA,GAAA,CAAA,GAAA,CAAA,OAAA,GAAA,EAAA,IAAA,KAAA;AACA,IAAA,IAAA;AACA,MAAA,MAAA,IAAA,EAAA;AACA,KAAA,CAAA,OAAA,KAAA,EAAA;AACA,MAAAC,qBAAA,CAAA,KAAA,CAAA;AACA,MAAA,MAAA,KAAA;AACA;AACA,GAAA,CAAA;;AAEA,EAAAC,wBAAA,CAAA,GAAA,CAAA,GAAA,EAAA,KAAA,CAAA;AACA;;;;;;"}
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationLruMemoizer = require('@opentelemetry/instrumentation-lru-memoizer');
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 = 'LruMemoizer';
8
8
 
9
- const instrumentLruMemoizer = instrument.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentationLruMemoizer.LruMemoizerInstrumentation());
9
+ const instrumentLruMemoizer = nodeCore.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentationLruMemoizer.LruMemoizerInstrumentation());
10
10
 
11
11
  const _lruMemoizerIntegration = (() => {
12
12
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"lrumemoizer.js","sources":["../../../../src/integrations/tracing/lrumemoizer.ts"],"sourcesContent":["import { LruMemoizerInstrumentation } from '@opentelemetry/instrumentation-lru-memoizer';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../otel/instrument';\n\nconst INTEGRATION_NAME = 'LruMemoizer';\n\nexport const instrumentLruMemoizer = generateInstrumentOnce(INTEGRATION_NAME, () => new LruMemoizerInstrumentation());\n\nconst _lruMemoizerIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentLruMemoizer();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [lru-memoizer](https://www.npmjs.com/package/lru-memoizer) library.\n *\n * For more information, see the [`lruMemoizerIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/lrumemoizer/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.lruMemoizerIntegration()],\n * });\n */\nexport const lruMemoizerIntegration = defineIntegration(_lruMemoizerIntegration);\n"],"names":["generateInstrumentOnce","LruMemoizerInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,aAAa;;AAEzB,MAAA,qBAAA,GAAwBA,iCAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,qDAA0B,EAAE;;AAEpH,MAAM,uBAAwB,IAAG,MAAM;AACvC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,qBAAqB,EAAE;AAC7B,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,sBAAuB,GAAEC,sBAAiB,CAAC,uBAAuB;;;;;"}
1
+ {"version":3,"file":"lrumemoizer.js","sources":["../../../../src/integrations/tracing/lrumemoizer.ts"],"sourcesContent":["import { LruMemoizerInstrumentation } from '@opentelemetry/instrumentation-lru-memoizer';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'LruMemoizer';\n\nexport const instrumentLruMemoizer = generateInstrumentOnce(INTEGRATION_NAME, () => new LruMemoizerInstrumentation());\n\nconst _lruMemoizerIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentLruMemoizer();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [lru-memoizer](https://www.npmjs.com/package/lru-memoizer) library.\n *\n * For more information, see the [`lruMemoizerIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/lrumemoizer/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.lruMemoizerIntegration()],\n * });\n */\nexport const lruMemoizerIntegration = defineIntegration(_lruMemoizerIntegration);\n"],"names":["generateInstrumentOnce","LruMemoizerInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,aAAa;;AAEzB,MAAA,qBAAA,GAAwBA,+BAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,qDAA0B,EAAE;;AAEpH,MAAM,uBAAwB,IAAG,MAAM;AACvC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,qBAAqB,EAAE;AAC7B,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,sBAAuB,GAAEC,sBAAiB,CAAC,uBAAuB;;;;;"}
@@ -2,18 +2,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationMongodb = require('@opentelemetry/instrumentation-mongodb');
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 = 'Mongo';
9
8
 
10
- const instrumentMongo = instrument.generateInstrumentOnce(
9
+ const instrumentMongo = nodeCore.generateInstrumentOnce(
11
10
  INTEGRATION_NAME,
12
11
  () =>
13
12
  new instrumentationMongodb.MongoDBInstrumentation({
14
13
  dbStatementSerializer: _defaultDbStatementSerializer,
15
14
  responseHook(span) {
16
- addOriginToSpan.addOriginToSpan(span, 'auto.db.otel.mongo');
15
+ nodeCore.addOriginToSpan(span, 'auto.db.otel.mongo');
17
16
  },
18
17
  }),
19
18
  );
@@ -1 +1 @@
1
- {"version":3,"file":"mongo.js","sources":["../../../../src/integrations/tracing/mongo.ts"],"sourcesContent":["import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';\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 = 'Mongo';\n\nexport const instrumentMongo = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MongoDBInstrumentation({\n dbStatementSerializer: _defaultDbStatementSerializer,\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mongo');\n },\n }),\n);\n\n/**\n * Replaces values in document with '?', hiding PII and helping grouping.\n */\nexport function _defaultDbStatementSerializer(commandObj: Record<string, unknown>): string {\n const resultObj = _scrubStatement(commandObj);\n return JSON.stringify(resultObj);\n}\n\nfunction _scrubStatement(value: unknown): unknown {\n if (Array.isArray(value)) {\n return value.map(element => _scrubStatement(element));\n }\n\n if (isCommandObj(value)) {\n const initial: Record<string, unknown> = {};\n return Object.entries(value)\n .map(([key, element]) => [key, _scrubStatement(element)])\n .reduce((prev, current) => {\n if (isCommandEntry(current)) {\n prev[current[0]] = current[1];\n }\n return prev;\n }, initial);\n }\n\n // A value like string or number, possible contains PII, scrub it\n return '?';\n}\n\nfunction isCommandObj(value: Record<string, unknown> | unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !isBuffer(value);\n}\n\nfunction isBuffer(value: unknown): boolean {\n let isBuffer = false;\n if (typeof Buffer !== 'undefined') {\n isBuffer = Buffer.isBuffer(value);\n }\n return isBuffer;\n}\n\nfunction isCommandEntry(value: [string, unknown] | unknown): value is [string, unknown] {\n return Array.isArray(value);\n}\n\nconst _mongoIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongo();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongodb](https://www.npmjs.com/package/mongodb) library.\n *\n * For more information, see the [`mongoIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongo/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongoIntegration()],\n * });\n * ```\n */\nexport const mongoIntegration = defineIntegration(_mongoIntegration);\n"],"names":["generateInstrumentOnce","MongoDBInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;;AAMA,MAAM,gBAAA,GAAmB,OAAO;;AAEzB,MAAM,eAAgB,GAAEA,iCAAsB;AACrD,EAAE,gBAAgB;AAClB,EAAE;AACF,IA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xE;;AAEA,SAAS,QAAQ,CAAC,KAAK,EAAoB;AAC3C,EAAE,IAAI,QAAS,GAAE,KAAK;AACtB,EAAE,IAAI,OAAO,MAAO,KAAI,WAAW,EAAE;AACrC,IAAI,WAAW,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;AACrC;AACA,EAAE,OAAO,QAAQ;AACjB;;AAEA,SAAS,cAAc,CAAC,KAAK,EAA2D;AACxF,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAC7B;;AAEA,MAAM,iBAAkB,IAAG,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAe,EAAE;AACvB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,gBAAiB,GAAEC,sBAAiB,CAAC,iBAAiB;;;;;;"}
1
+ {"version":3,"file":"mongo.js","sources":["../../../../src/integrations/tracing/mongo.ts"],"sourcesContent":["import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mongo';\n\nexport const instrumentMongo = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MongoDBInstrumentation({\n dbStatementSerializer: _defaultDbStatementSerializer,\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mongo');\n },\n }),\n);\n\n/**\n * Replaces values in document with '?', hiding PII and helping grouping.\n */\nexport function _defaultDbStatementSerializer(commandObj: Record<string, unknown>): string {\n const resultObj = _scrubStatement(commandObj);\n return JSON.stringify(resultObj);\n}\n\nfunction _scrubStatement(value: unknown): unknown {\n if (Array.isArray(value)) {\n return value.map(element => _scrubStatement(element));\n }\n\n if (isCommandObj(value)) {\n const initial: Record<string, unknown> = {};\n return Object.entries(value)\n .map(([key, element]) => [key, _scrubStatement(element)])\n .reduce((prev, current) => {\n if (isCommandEntry(current)) {\n prev[current[0]] = current[1];\n }\n return prev;\n }, initial);\n }\n\n // A value like string or number, possible contains PII, scrub it\n return '?';\n}\n\nfunction isCommandObj(value: Record<string, unknown> | unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !isBuffer(value);\n}\n\nfunction isBuffer(value: unknown): boolean {\n let isBuffer = false;\n if (typeof Buffer !== 'undefined') {\n isBuffer = Buffer.isBuffer(value);\n }\n return isBuffer;\n}\n\nfunction isCommandEntry(value: [string, unknown] | unknown): value is [string, unknown] {\n return Array.isArray(value);\n}\n\nconst _mongoIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongo();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongodb](https://www.npmjs.com/package/mongodb) library.\n *\n * For more information, see the [`mongoIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongo/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongoIntegration()],\n * });\n * ```\n */\nexport const mongoIntegration = defineIntegration(_mongoIntegration);\n"],"names":["generateInstrumentOnce","MongoDBInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAO;;AAEzB,MAAM,eAAgB,GAAEA,+BAAsB;AACrD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,6CAAsB,CAAC;AAC/B,MAAM,qBAAqB,EAAE,6BAA6B;AAC1D,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,oBAAoB,CAAC;AACnD,OAAO;AACP,KAAK,CAAC;AACN;;AAEA;AACA;AACA;AACO,SAAS,6BAA6B,CAAC,UAAU,EAA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c,CAAC,KAAK,EAA2D;AACxF,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAC7B;;AAEA,MAAM,iBAAkB,IAAG,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAe,EAAE;AACvB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,gBAAiB,GAAEC,sBAAiB,CAAC,iBAAiB;;;;;;"}
@@ -2,17 +2,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationMongoose = require('@opentelemetry/instrumentation-mongoose');
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 = 'Mongoose';
9
8
 
10
- const instrumentMongoose = instrument.generateInstrumentOnce(
9
+ const instrumentMongoose = nodeCore.generateInstrumentOnce(
11
10
  INTEGRATION_NAME,
12
11
  () =>
13
12
  new instrumentationMongoose.MongooseInstrumentation({
14
13
  responseHook(span) {
15
- addOriginToSpan.addOriginToSpan(span, 'auto.db.otel.mongoose');
14
+ nodeCore.addOriginToSpan(span, 'auto.db.otel.mongoose');
16
15
  },
17
16
  }),
18
17
  );
@@ -1 +1 @@
1
- {"version":3,"file":"mongoose.js","sources":["../../../../src/integrations/tracing/mongoose.ts"],"sourcesContent":["import { MongooseInstrumentation } from '@opentelemetry/instrumentation-mongoose';\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 = 'Mongoose';\n\nexport const instrumentMongoose = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MongooseInstrumentation({\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mongoose');\n },\n }),\n);\n\nconst _mongooseIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongoose();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongoose](https://www.npmjs.com/package/mongoose) library.\n *\n * For more information, see the [`mongooseIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongoose/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongooseIntegration()],\n * });\n * ```\n */\nexport const mongooseIntegration = defineIntegration(_mongooseIntegration);\n"],"names":["generateInstrumentOnce","MongooseInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;;AAMA,MAAM,gBAAA,GAAmB,UAAU;;AAE5B,MAAM,kBAAmB,GAAEA,iCAAsB;AACxD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,+CAAuB,CAAC;AAChC,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,+BAAe,CAAC,IAAI,EAAE,uBAAuB,CAAC;AACtD,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,oBAAqB,IAAG,MAAM;AACpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,kBAAkB,EAAE;AAC1B,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,mBAAoB,GAAEC,sBAAiB,CAAC,oBAAoB;;;;;"}
1
+ {"version":3,"file":"mongoose.js","sources":["../../../../src/integrations/tracing/mongoose.ts"],"sourcesContent":["import { MongooseInstrumentation } from '@opentelemetry/instrumentation-mongoose';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mongoose';\n\nexport const instrumentMongoose = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MongooseInstrumentation({\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mongoose');\n },\n }),\n);\n\nconst _mongooseIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongoose();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongoose](https://www.npmjs.com/package/mongoose) library.\n *\n * For more information, see the [`mongooseIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongoose/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongooseIntegration()],\n * });\n * ```\n */\nexport const mongooseIntegration = defineIntegration(_mongooseIntegration);\n"],"names":["generateInstrumentOnce","MongooseInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,UAAU;;AAE5B,MAAM,kBAAmB,GAAEA,+BAAsB;AACxD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,+CAAuB,CAAC;AAChC,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,uBAAuB,CAAC;AACtD,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,oBAAqB,IAAG,MAAM;AACpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,kBAAkB,EAAE;AAC1B,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,mBAAoB,GAAEC,sBAAiB,CAAC,oBAAoB;;;;;"}
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationMysql = require('@opentelemetry/instrumentation-mysql');
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 = 'Mysql';
8
8
 
9
- const instrumentMysql = instrument.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentationMysql.MySQLInstrumentation({}));
9
+ const instrumentMysql = nodeCore.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentationMysql.MySQLInstrumentation({}));
10
10
 
11
11
  const _mysqlIntegration = (() => {
12
12
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"mysql.js","sources":["../../../../src/integrations/tracing/mysql.ts"],"sourcesContent":["import { MySQLInstrumentation } from '@opentelemetry/instrumentation-mysql';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../otel/instrument';\n\nconst INTEGRATION_NAME = 'Mysql';\n\nexport const instrumentMysql = generateInstrumentOnce(INTEGRATION_NAME, () => new MySQLInstrumentation({}));\n\nconst _mysqlIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql](https://www.npmjs.com/package/mysql) library.\n *\n * For more information, see the [`mysqlIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysqlIntegration = defineIntegration(_mysqlIntegration);\n"],"names":["generateInstrumentOnce","MySQLInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAO;;MAEnB,eAAgB,GAAEA,iCAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,yCAAoB,CAAC,EAAE,CAAC;;AAE1G,MAAM,iBAAkB,IAAG,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAe,EAAE;AACvB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,gBAAiB,GAAEC,sBAAiB,CAAC,iBAAiB;;;;;"}
1
+ {"version":3,"file":"mysql.js","sources":["../../../../src/integrations/tracing/mysql.ts"],"sourcesContent":["import { MySQLInstrumentation } from '@opentelemetry/instrumentation-mysql';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mysql';\n\nexport const instrumentMysql = generateInstrumentOnce(INTEGRATION_NAME, () => new MySQLInstrumentation({}));\n\nconst _mysqlIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql](https://www.npmjs.com/package/mysql) library.\n *\n * For more information, see the [`mysqlIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysqlIntegration = defineIntegration(_mysqlIntegration);\n"],"names":["generateInstrumentOnce","MySQLInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAO;;MAEnB,eAAgB,GAAEA,+BAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,yCAAoB,CAAC,EAAE,CAAC;;AAE1G,MAAM,iBAAkB,IAAG,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAe,EAAE;AACvB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,gBAAiB,GAAEC,sBAAiB,CAAC,iBAAiB;;;;;"}
@@ -2,17 +2,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationMysql2 = require('@opentelemetry/instrumentation-mysql2');
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 = 'Mysql2';
9
8
 
10
- const instrumentMysql2 = instrument.generateInstrumentOnce(
9
+ const instrumentMysql2 = nodeCore.generateInstrumentOnce(
11
10
  INTEGRATION_NAME,
12
11
  () =>
13
12
  new instrumentationMysql2.MySQL2Instrumentation({
14
13
  responseHook(span) {
15
- addOriginToSpan.addOriginToSpan(span, 'auto.db.otel.mysql2');
14
+ nodeCore.addOriginToSpan(span, 'auto.db.otel.mysql2');
16
15
  },
17
16
  }),
18
17
  );
@@ -1 +1 @@
1
- {"version":3,"file":"mysql2.js","sources":["../../../../src/integrations/tracing/mysql2.ts"],"sourcesContent":["import { MySQL2Instrumentation } from '@opentelemetry/instrumentation-mysql2';\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 = 'Mysql2';\n\nexport const instrumentMysql2 = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MySQL2Instrumentation({\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mysql2');\n },\n }),\n);\n\nconst _mysql2Integration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql2();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql2](https://www.npmjs.com/package/mysql2) library.\n *\n * For more information, see the [`mysql2Integration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql2/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysql2Integration = defineIntegration(_mysql2Integration);\n"],"names":["generateInstrumentOnce","MySQL2Instrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;;AAMA,MAAM,gBAAA,GAAmB,QAAQ;;AAE1B,MAAM,gBAAiB,GAAEA,iCAAsB;AACtD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,2CAAqB,CAAC;AAC9B,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,+BAAe,CAAC,IAAI,EAAE,qBAAqB,CAAC;AACpD,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,kBAAmB,IAAG,MAAM;AAClC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,gBAAgB,EAAE;AACxB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,iBAAkB,GAAEC,sBAAiB,CAAC,kBAAkB;;;;;"}
1
+ {"version":3,"file":"mysql2.js","sources":["../../../../src/integrations/tracing/mysql2.ts"],"sourcesContent":["import { MySQL2Instrumentation } from '@opentelemetry/instrumentation-mysql2';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mysql2';\n\nexport const instrumentMysql2 = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MySQL2Instrumentation({\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mysql2');\n },\n }),\n);\n\nconst _mysql2Integration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql2();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql2](https://www.npmjs.com/package/mysql2) library.\n *\n * For more information, see the [`mysql2Integration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql2/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysql2Integration = defineIntegration(_mysql2Integration);\n"],"names":["generateInstrumentOnce","MySQL2Instrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,QAAQ;;AAE1B,MAAM,gBAAiB,GAAEA,+BAAsB;AACtD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,2CAAqB,CAAC;AAC9B,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,qBAAqB,CAAC;AACpD,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,kBAAmB,IAAG,MAAM;AAClC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,gBAAgB,EAAE;AACxB,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,iBAAkB,GAAEC,sBAAiB,CAAC,kBAAkB;;;;;"}
@@ -2,18 +2,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentationPg = require('@opentelemetry/instrumentation-pg');
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 = 'Postgres';
9
8
 
10
- const instrumentPostgres = instrument.generateInstrumentOnce(
9
+ const instrumentPostgres = nodeCore.generateInstrumentOnce(
11
10
  INTEGRATION_NAME,
12
11
  () =>
13
12
  new instrumentationPg.PgInstrumentation({
14
13
  requireParentSpan: true,
15
14
  requestHook(span) {
16
- addOriginToSpan.addOriginToSpan(span, 'auto.db.otel.postgres');
15
+ nodeCore.addOriginToSpan(span, 'auto.db.otel.postgres');
17
16
  },
18
17
  }),
19
18
  );
@@ -1 +1 @@
1
- {"version":3,"file":"postgres.js","sources":["../../../../src/integrations/tracing/postgres.ts"],"sourcesContent":["import { PgInstrumentation } from '@opentelemetry/instrumentation-pg';\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 = 'Postgres';\n\nexport const instrumentPostgres = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new PgInstrumentation({\n requireParentSpan: true,\n requestHook(span) {\n addOriginToSpan(span, 'auto.db.otel.postgres');\n },\n }),\n);\n\nconst _postgresIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPostgres();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [pg](https://www.npmjs.com/package/pg) library.\n *\n * For more information, see the [`postgresIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/postgres/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.postgresIntegration()],\n * });\n * ```\n */\nexport const postgresIntegration = defineIntegration(_postgresIntegration);\n"],"names":["generateInstrumentOnce","PgInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;;AAMA,MAAM,gBAAA,GAAmB,UAAU;;AAE5B,MAAM,kBAAmB,GAAEA,iCAAsB;AACxD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,mCAAiB,CAAC;AAC1B,MAAM,iBAAiB,EAAE,IAAI;AAC7B,MAAM,WAAW,CAAC,IAAI,EAAE;AACxB,QAAQC,+BAAe,CAAC,IAAI,EAAE,uBAAuB,CAAC;AACtD,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,oBAAqB,IAAG,MAAM;AACpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,kBAAkB,EAAE;AAC1B,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,mBAAoB,GAAEC,sBAAiB,CAAC,oBAAoB;;;;;"}
1
+ {"version":3,"file":"postgres.js","sources":["../../../../src/integrations/tracing/postgres.ts"],"sourcesContent":["import { PgInstrumentation } from '@opentelemetry/instrumentation-pg';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Postgres';\n\nexport const instrumentPostgres = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new PgInstrumentation({\n requireParentSpan: true,\n requestHook(span) {\n addOriginToSpan(span, 'auto.db.otel.postgres');\n },\n }),\n);\n\nconst _postgresIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPostgres();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [pg](https://www.npmjs.com/package/pg) library.\n *\n * For more information, see the [`postgresIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/postgres/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.postgresIntegration()],\n * });\n * ```\n */\nexport const postgresIntegration = defineIntegration(_postgresIntegration);\n"],"names":["generateInstrumentOnce","PgInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,UAAU;;AAE5B,MAAM,kBAAmB,GAAEA,+BAAsB;AACxD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,mCAAiB,CAAC;AAC1B,MAAM,iBAAiB,EAAE,IAAI;AAC7B,MAAM,WAAW,CAAC,IAAI,EAAE;AACxB,QAAQC,wBAAe,CAAC,IAAI,EAAE,uBAAuB,CAAC;AACtD,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,oBAAqB,IAAG,MAAM;AACpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,kBAAkB,EAAE;AAC1B,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,mBAAoB,GAAEC,sBAAiB,CAAC,oBAAoB;;;;;"}
@@ -4,15 +4,14 @@ const api = require('@opentelemetry/api');
4
4
  const instrumentation = require('@opentelemetry/instrumentation');
5
5
  const semanticConventions = require('@opentelemetry/semantic-conventions');
6
6
  const core = require('@sentry/core');
7
- const instrument = require('../../otel/instrument.js');
8
- const addOriginToSpan = require('../../utils/addOriginToSpan.js');
7
+ const nodeCore = require('@sentry/node-core');
9
8
 
10
9
  // Instrumentation for https://github.com/porsager/postgres
11
10
 
12
11
  const INTEGRATION_NAME = 'PostgresJs';
13
12
  const SUPPORTED_VERSIONS = ['>=3.0.0 <4'];
14
13
 
15
- const instrumentPostgresJs = instrument.generateInstrumentOnce(
14
+ const instrumentPostgresJs = nodeCore.generateInstrumentOnce(
16
15
  INTEGRATION_NAME,
17
16
  (options) =>
18
17
  new PostgresJsInstrumentation({
@@ -154,7 +153,7 @@ class PostgresJsInstrumentation extends instrumentation.InstrumentationBase {
154
153
 
155
154
  ;
156
155
 
157
- addOriginToSpan.addOriginToSpan(span, 'auto.db.otel.postgres');
156
+ nodeCore.addOriginToSpan(span, 'auto.db.otel.postgres');
158
157
 
159
158
  const { requestHook } = this.getConfig();
160
159
 
@@ -1 +1 @@
1
- {"version":3,"file":"postgresjs.js","sources":["../../../../src/integrations/tracing/postgresjs.ts"],"sourcesContent":["// Instrumentation for https://github.com/porsager/postgres\nimport { context, trace } from '@opentelemetry/api';\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport {\n ATTR_DB_NAMESPACE,\n ATTR_DB_OPERATION_NAME,\n ATTR_DB_QUERY_TEXT,\n ATTR_DB_RESPONSE_STATUS_CODE,\n ATTR_DB_SYSTEM_NAME,\n ATTR_ERROR_TYPE,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from '@opentelemetry/semantic-conventions';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n defineIntegration,\n getCurrentScope,\n logger,\n SDK_VERSION,\n SPAN_STATUS_ERROR,\n startSpanManual,\n} from '@sentry/core';\nimport { generateInstrumentOnce } from '../../otel/instrument';\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\n\nconst INTEGRATION_NAME = 'PostgresJs';\nconst SUPPORTED_VERSIONS = ['>=3.0.0 <4'];\n\ntype PostgresConnectionContext = {\n ATTR_DB_NAMESPACE?: string; // Database name\n ATTR_SERVER_ADDRESS?: string; // Hostname or IP address of the database server\n ATTR_SERVER_PORT?: string; // Port number of the database server\n};\n\ntype PostgresJsInstrumentationConfig = InstrumentationConfig & {\n /**\n * Whether to require a parent span for the instrumentation.\n * If set to true, the instrumentation will only create spans if there is a parent span\n * available in the current scope.\n * @default true\n */\n requireParentSpan?: boolean;\n /**\n * Hook to modify the span before it is started.\n * This can be used to set additional attributes or modify the span in any way.\n */\n requestHook?: (span: Span, sanitizedSqlQuery: string, postgresConnectionContext?: PostgresConnectionContext) => void;\n};\n\nexport const instrumentPostgresJs = generateInstrumentOnce(\n INTEGRATION_NAME,\n (options?: PostgresJsInstrumentationConfig) =>\n new PostgresJsInstrumentation({\n requireParentSpan: options?.requireParentSpan ?? true,\n requestHook: options?.requestHook,\n }),\n);\n\n/**\n * Instrumentation for the [postgres](https://www.npmjs.com/package/postgres) library.\n * This instrumentation captures postgresjs queries and their attributes,\n */\nexport class PostgresJsInstrumentation extends InstrumentationBase<PostgresJsInstrumentationConfig> {\n public constructor(config: PostgresJsInstrumentationConfig) {\n super('sentry-postgres-js', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation.\n */\n public init(): InstrumentationNodeModuleDefinition[] {\n const instrumentationModule = new InstrumentationNodeModuleDefinition('postgres', SUPPORTED_VERSIONS);\n\n ['src', 'cf/src', 'cjs/src'].forEach(path => {\n instrumentationModule.files.push(\n new InstrumentationNodeModuleFile(\n `postgres/${path}/connection.js`,\n ['*'],\n this._patchConnection.bind(this),\n this._unwrap.bind(this),\n ),\n );\n\n instrumentationModule.files.push(\n new InstrumentationNodeModuleFile(\n `postgres/${path}/query.js`,\n SUPPORTED_VERSIONS,\n this._patchQuery.bind(this),\n this._unwrap.bind(this),\n ),\n );\n });\n\n return [instrumentationModule];\n }\n\n /**\n * Determines whether a span should be created based on the current context.\n * If `requireParentSpan` is set to true in the configuration, a span will\n * only be created if there is a parent span available.\n */\n private _shouldCreateSpans(): boolean {\n const config = this.getConfig();\n const hasParentSpan = trace.getSpan(context.active()) !== undefined;\n return hasParentSpan || !config.requireParentSpan;\n }\n\n /**\n * Patches the reject method of the Query class to set the span status and end it\n */\n private _patchReject(rejectTarget: any, span: Span): any {\n return new Proxy(rejectTarget, {\n apply: (\n rejectTarget,\n rejectThisArg,\n rejectArgs: {\n message?: string;\n code?: string;\n name?: string;\n }[],\n ) => {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n // This message is the error message from the rejectArgs, when available\n // e.g \"relation 'User' does not exist\"\n message: rejectArgs?.[0]?.message || 'unknown_error',\n });\n\n const result = Reflect.apply(rejectTarget, rejectThisArg, rejectArgs);\n\n // This status code is PG error code, e.g. '42P01' for \"relation does not exist\"\n // https://www.postgresql.org/docs/current/errcodes-appendix.html\n span.setAttribute(ATTR_DB_RESPONSE_STATUS_CODE, rejectArgs?.[0]?.code || 'Unknown error');\n // This is the error type, e.g. 'PostgresError' for a Postgres error\n span.setAttribute(ATTR_ERROR_TYPE, rejectArgs?.[0]?.name || 'Unknown error');\n\n span.end();\n return result;\n },\n });\n }\n\n /**\n * Patches the resolve method of the Query class to end the span when the query is resolved.\n */\n private _patchResolve(resolveTarget: any, span: Span): any {\n return new Proxy(resolveTarget, {\n apply: (resolveTarget, resolveThisArg, resolveArgs: [{ command?: string }]) => {\n const result = Reflect.apply(resolveTarget, resolveThisArg, resolveArgs);\n const sqlCommand = resolveArgs?.[0]?.command;\n\n if (sqlCommand) {\n // SQL command is only available when the query is resolved successfully\n span.setAttribute(ATTR_DB_OPERATION_NAME, sqlCommand);\n }\n span.end();\n return result;\n },\n });\n }\n\n /**\n * Patches the Query class to instrument the handle method.\n */\n private _patchQuery(moduleExports: {\n Query: {\n prototype: {\n handle: any;\n };\n };\n }): any {\n moduleExports.Query.prototype.handle = new Proxy(moduleExports.Query.prototype.handle, {\n apply: async (\n handleTarget,\n handleThisArg: {\n resolve: any;\n reject: any;\n strings?: string[];\n },\n handleArgs,\n ) => {\n if (!this._shouldCreateSpans()) {\n // If we don't need to create spans, just call the original method\n return Reflect.apply(handleTarget, handleThisArg, handleArgs);\n }\n\n const sanitizedSqlQuery = this._sanitizeSqlQuery(handleThisArg.strings?.[0]);\n\n return startSpanManual(\n {\n name: sanitizedSqlQuery || 'postgresjs.query',\n op: 'db',\n },\n (span: Span) => {\n const scope = getCurrentScope();\n const postgresConnectionContext = scope.getScopeData().contexts['postgresjsConnection'] as\n | PostgresConnectionContext\n | undefined;\n\n addOriginToSpan(span, 'auto.db.otel.postgres');\n\n const { requestHook } = this.getConfig();\n\n if (requestHook) {\n safeExecuteInTheMiddle(\n () => requestHook(span, sanitizedSqlQuery, postgresConnectionContext),\n error => {\n if (error) {\n logger.error(`Error in requestHook for ${INTEGRATION_NAME} integration:`, error);\n }\n },\n );\n }\n\n // ATTR_DB_NAMESPACE is used to indicate the database name and the schema name\n // It's only the database name as we don't have the schema information\n const databaseName = postgresConnectionContext?.ATTR_DB_NAMESPACE || '<unknown database>';\n const databaseHost = postgresConnectionContext?.ATTR_SERVER_ADDRESS || '<unknown host>';\n const databasePort = postgresConnectionContext?.ATTR_SERVER_PORT || '<unknown port>';\n\n span.setAttribute(ATTR_DB_SYSTEM_NAME, 'postgres');\n span.setAttribute(ATTR_DB_NAMESPACE, databaseName);\n span.setAttribute(ATTR_SERVER_ADDRESS, databaseHost);\n span.setAttribute(ATTR_SERVER_PORT, databasePort);\n span.setAttribute(ATTR_DB_QUERY_TEXT, sanitizedSqlQuery);\n\n handleThisArg.resolve = this._patchResolve(handleThisArg.resolve, span);\n handleThisArg.reject = this._patchReject(handleThisArg.reject, span);\n\n try {\n return Reflect.apply(handleTarget, handleThisArg, handleArgs);\n } catch (error) {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n });\n span.end();\n throw error; // Re-throw the error to propagate it\n }\n },\n );\n },\n });\n\n return moduleExports;\n }\n\n /**\n * Patches the Connection class to set the database, host, and port attributes\n * when a new connection is created.\n */\n private _patchConnection(Connection: any): any {\n return new Proxy(Connection, {\n apply: (connectionTarget, thisArg, connectionArgs: { database: string; host: string[]; port: number[] }[]) => {\n const databaseName = connectionArgs[0]?.database || '<unknown database>';\n const databaseHost = connectionArgs[0]?.host?.[0] || '<unknown host>';\n const databasePort = connectionArgs[0]?.port?.[0] || '<unknown port>';\n\n const scope = getCurrentScope();\n scope.setContext('postgresjsConnection', {\n ATTR_DB_NAMESPACE: databaseName,\n ATTR_SERVER_ADDRESS: databaseHost,\n ATTR_SERVER_PORT: databasePort,\n });\n\n return Reflect.apply(connectionTarget, thisArg, connectionArgs);\n },\n });\n }\n\n /**\n * Sanitize SQL query as per the OTEL semantic conventions\n * https://opentelemetry.io/docs/specs/semconv/database/database-spans/#sanitization-of-dbquerytext\n */\n private _sanitizeSqlQuery(sqlQuery: string | undefined): string {\n if (!sqlQuery) {\n return 'Unknown SQL Query';\n }\n\n return (\n sqlQuery\n .replace(/\\s+/g, ' ')\n .trim() // Remove extra spaces including newlines and trim\n .substring(0, 1024) // Truncate to 1024 characters\n .replace(/--.*?(\\r?\\n|$)/g, '') // Single line comments\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '') // Multi-line comments\n .replace(/;\\s*$/, '') // Remove trailing semicolons\n .replace(/\\b\\d+\\b/g, '?') // Replace standalone numbers\n // Collapse whitespace to a single space\n .replace(/\\s+/g, ' ')\n // Collapse IN and in clauses\n // eg. IN (?, ?, ?, ?) to IN (?)\n .replace(/\\bIN\\b\\s*\\(\\s*\\?(?:\\s*,\\s*\\?)*\\s*\\)/g, 'IN (?)')\n );\n }\n}\n\nconst _postgresJsIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPostgresJs();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [postgres](https://www.npmjs.com/package/postgres) library.\n *\n * For more information, see the [`postgresIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/postgres/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.postgresJsIntegration()],\n * });\n * ```\n */\n\nexport const postgresJsIntegration = defineIntegration(_postgresJsIntegration);\n"],"names":["generateInstrumentOnce","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","trace","context","SPAN_STATUS_ERROR","ATTR_DB_RESPONSE_STATUS_CODE","ATTR_ERROR_TYPE","ATTR_DB_OPERATION_NAME","startSpanManual","getCurrentScope","addOriginToSpan","safeExecuteInTheMiddle","logger","ATTR_DB_SYSTEM_NAME","ATTR_DB_NAMESPACE","ATTR_SERVER_ADDRESS","ATTR_SERVER_PORT","ATTR_DB_QUERY_TEXT","defineIntegration"],"mappings":";;;;;;;;;AAAA;;AA+BA,MAAM,gBAAA,GAAmB,YAAY;AACrC,MAAM,kBAAmB,GAAE,CAAC,YAAY,CAAC;;AAuBlC,MAAM,oBAAqB,GAAEA,iCAAsB;AAC1D,EAAE,gBAAgB;AAClB,EAAE,CAAC,OAAO;AACV,IAAI,IAAI,yBAAyB,CAAC;AAClC,MAAM,iBAAiB,EAAE,OAAO,EAAE,iBAAA,IAAqB,IAAI;AAC3D,MAAM,WAAW,EAAE,OAAO,EAAE,WAAW;AACvC,KAAK,CAAC;AACN;;AAEA;AACA;AACA;AACA;AACO,MAAM,yBAAA,SAAkCC,mCAAmB,CAAkC;AACpG,GAAS,WAAW,CAAC,MAAM,EAAmC;AAC9D,IAAI,KAAK,CAAC,oBAAoB,EAAEC,gBAAW,EAAE,MAAM,CAAC;AACpD;;AAEA;AACA;AACA;AACA,GAAS,IAAI,GAA0C;AACvD,IAAI,MAAM,wBAAwB,IAAIC,mDAAmC,CAAC,UAAU,EAAE,kBAAkB,CAAC;;AAEzG,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,IAAA,IAAQ;AACjD,MAAM,qBAAqB,CAAC,KAAK,CAAC,IAAI;AACtC,QAAQ,IAAIC,6CAA6B;AACzC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC;AAC1C,UAAU,CAAC,GAAG,CAAC;AACf,UAAU,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CA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"sourcesContent":["// Instrumentation for https://github.com/porsager/postgres\nimport { context, trace } from '@opentelemetry/api';\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport {\n ATTR_DB_NAMESPACE,\n ATTR_DB_OPERATION_NAME,\n ATTR_DB_QUERY_TEXT,\n ATTR_DB_RESPONSE_STATUS_CODE,\n ATTR_DB_SYSTEM_NAME,\n ATTR_ERROR_TYPE,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from '@opentelemetry/semantic-conventions';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n defineIntegration,\n getCurrentScope,\n logger,\n SDK_VERSION,\n SPAN_STATUS_ERROR,\n startSpanManual,\n} from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'PostgresJs';\nconst SUPPORTED_VERSIONS = ['>=3.0.0 <4'];\n\ntype PostgresConnectionContext = {\n ATTR_DB_NAMESPACE?: string; // Database name\n ATTR_SERVER_ADDRESS?: string; // Hostname or IP address of the database server\n ATTR_SERVER_PORT?: string; // Port number of the database server\n};\n\ntype PostgresJsInstrumentationConfig = InstrumentationConfig & {\n /**\n * Whether to require a parent span for the instrumentation.\n * If set to true, the instrumentation will only create spans if there is a parent span\n * available in the current scope.\n * @default true\n */\n requireParentSpan?: boolean;\n /**\n * Hook to modify the span before it is started.\n * This can be used to set additional attributes or modify the span in any way.\n */\n requestHook?: (span: Span, sanitizedSqlQuery: string, postgresConnectionContext?: PostgresConnectionContext) => void;\n};\n\nexport const instrumentPostgresJs = generateInstrumentOnce(\n INTEGRATION_NAME,\n (options?: PostgresJsInstrumentationConfig) =>\n new PostgresJsInstrumentation({\n requireParentSpan: options?.requireParentSpan ?? true,\n requestHook: options?.requestHook,\n }),\n);\n\n/**\n * Instrumentation for the [postgres](https://www.npmjs.com/package/postgres) library.\n * This instrumentation captures postgresjs queries and their attributes,\n */\nexport class PostgresJsInstrumentation extends InstrumentationBase<PostgresJsInstrumentationConfig> {\n public constructor(config: PostgresJsInstrumentationConfig) {\n super('sentry-postgres-js', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation.\n */\n public init(): InstrumentationNodeModuleDefinition[] {\n const instrumentationModule = new InstrumentationNodeModuleDefinition('postgres', SUPPORTED_VERSIONS);\n\n ['src', 'cf/src', 'cjs/src'].forEach(path => {\n instrumentationModule.files.push(\n new InstrumentationNodeModuleFile(\n `postgres/${path}/connection.js`,\n ['*'],\n this._patchConnection.bind(this),\n this._unwrap.bind(this),\n ),\n );\n\n instrumentationModule.files.push(\n new InstrumentationNodeModuleFile(\n `postgres/${path}/query.js`,\n SUPPORTED_VERSIONS,\n this._patchQuery.bind(this),\n this._unwrap.bind(this),\n ),\n );\n });\n\n return [instrumentationModule];\n }\n\n /**\n * Determines whether a span should be created based on the current context.\n * If `requireParentSpan` is set to true in the configuration, a span will\n * only be created if there is a parent span available.\n */\n private _shouldCreateSpans(): boolean {\n const config = this.getConfig();\n const hasParentSpan = trace.getSpan(context.active()) !== undefined;\n return hasParentSpan || !config.requireParentSpan;\n }\n\n /**\n * Patches the reject method of the Query class to set the span status and end it\n */\n private _patchReject(rejectTarget: any, span: Span): any {\n return new Proxy(rejectTarget, {\n apply: (\n rejectTarget,\n rejectThisArg,\n rejectArgs: {\n message?: string;\n code?: string;\n name?: string;\n }[],\n ) => {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n // This message is the error message from the rejectArgs, when available\n // e.g \"relation 'User' does not exist\"\n message: rejectArgs?.[0]?.message || 'unknown_error',\n });\n\n const result = Reflect.apply(rejectTarget, rejectThisArg, rejectArgs);\n\n // This status code is PG error code, e.g. '42P01' for \"relation does not exist\"\n // https://www.postgresql.org/docs/current/errcodes-appendix.html\n span.setAttribute(ATTR_DB_RESPONSE_STATUS_CODE, rejectArgs?.[0]?.code || 'Unknown error');\n // This is the error type, e.g. 'PostgresError' for a Postgres error\n span.setAttribute(ATTR_ERROR_TYPE, rejectArgs?.[0]?.name || 'Unknown error');\n\n span.end();\n return result;\n },\n });\n }\n\n /**\n * Patches the resolve method of the Query class to end the span when the query is resolved.\n */\n private _patchResolve(resolveTarget: any, span: Span): any {\n return new Proxy(resolveTarget, {\n apply: (resolveTarget, resolveThisArg, resolveArgs: [{ command?: string }]) => {\n const result = Reflect.apply(resolveTarget, resolveThisArg, resolveArgs);\n const sqlCommand = resolveArgs?.[0]?.command;\n\n if (sqlCommand) {\n // SQL command is only available when the query is resolved successfully\n span.setAttribute(ATTR_DB_OPERATION_NAME, sqlCommand);\n }\n span.end();\n return result;\n },\n });\n }\n\n /**\n * Patches the Query class to instrument the handle method.\n */\n private _patchQuery(moduleExports: {\n Query: {\n prototype: {\n handle: any;\n };\n };\n }): any {\n moduleExports.Query.prototype.handle = new Proxy(moduleExports.Query.prototype.handle, {\n apply: async (\n handleTarget,\n handleThisArg: {\n resolve: any;\n reject: any;\n strings?: string[];\n },\n handleArgs,\n ) => {\n if (!this._shouldCreateSpans()) {\n // If we don't need to create spans, just call the original method\n return Reflect.apply(handleTarget, handleThisArg, handleArgs);\n }\n\n const sanitizedSqlQuery = this._sanitizeSqlQuery(handleThisArg.strings?.[0]);\n\n return startSpanManual(\n {\n name: sanitizedSqlQuery || 'postgresjs.query',\n op: 'db',\n },\n (span: Span) => {\n const scope = getCurrentScope();\n const postgresConnectionContext = scope.getScopeData().contexts['postgresjsConnection'] as\n | PostgresConnectionContext\n | undefined;\n\n addOriginToSpan(span, 'auto.db.otel.postgres');\n\n const { requestHook } = this.getConfig();\n\n if (requestHook) {\n safeExecuteInTheMiddle(\n () => requestHook(span, sanitizedSqlQuery, postgresConnectionContext),\n error => {\n if (error) {\n logger.error(`Error in requestHook for ${INTEGRATION_NAME} integration:`, error);\n }\n },\n );\n }\n\n // ATTR_DB_NAMESPACE is used to indicate the database name and the schema name\n // It's only the database name as we don't have the schema information\n const databaseName = postgresConnectionContext?.ATTR_DB_NAMESPACE || '<unknown database>';\n const databaseHost = postgresConnectionContext?.ATTR_SERVER_ADDRESS || '<unknown host>';\n const databasePort = postgresConnectionContext?.ATTR_SERVER_PORT || '<unknown port>';\n\n span.setAttribute(ATTR_DB_SYSTEM_NAME, 'postgres');\n span.setAttribute(ATTR_DB_NAMESPACE, databaseName);\n span.setAttribute(ATTR_SERVER_ADDRESS, databaseHost);\n span.setAttribute(ATTR_SERVER_PORT, databasePort);\n span.setAttribute(ATTR_DB_QUERY_TEXT, sanitizedSqlQuery);\n\n handleThisArg.resolve = this._patchResolve(handleThisArg.resolve, span);\n handleThisArg.reject = this._patchReject(handleThisArg.reject, span);\n\n try {\n return Reflect.apply(handleTarget, handleThisArg, handleArgs);\n } catch (error) {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n });\n span.end();\n throw error; // Re-throw the error to propagate it\n }\n },\n );\n },\n });\n\n return moduleExports;\n }\n\n /**\n * Patches the Connection class to set the database, host, and port attributes\n * when a new connection is created.\n */\n private _patchConnection(Connection: any): any {\n return new Proxy(Connection, {\n apply: (connectionTarget, thisArg, connectionArgs: { database: string; host: string[]; port: number[] }[]) => {\n const databaseName = connectionArgs[0]?.database || '<unknown database>';\n const databaseHost = connectionArgs[0]?.host?.[0] || '<unknown host>';\n const databasePort = connectionArgs[0]?.port?.[0] || '<unknown port>';\n\n const scope = getCurrentScope();\n scope.setContext('postgresjsConnection', {\n ATTR_DB_NAMESPACE: databaseName,\n ATTR_SERVER_ADDRESS: databaseHost,\n ATTR_SERVER_PORT: databasePort,\n });\n\n return Reflect.apply(connectionTarget, thisArg, connectionArgs);\n },\n });\n }\n\n /**\n * Sanitize SQL query as per the OTEL semantic conventions\n * https://opentelemetry.io/docs/specs/semconv/database/database-spans/#sanitization-of-dbquerytext\n */\n private _sanitizeSqlQuery(sqlQuery: string | undefined): string {\n if (!sqlQuery) {\n return 'Unknown SQL Query';\n }\n\n return (\n sqlQuery\n .replace(/\\s+/g, ' ')\n .trim() // Remove extra spaces including newlines and trim\n .substring(0, 1024) // Truncate to 1024 characters\n .replace(/--.*?(\\r?\\n|$)/g, '') // Single line comments\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '') // Multi-line comments\n .replace(/;\\s*$/, '') // Remove trailing semicolons\n .replace(/\\b\\d+\\b/g, '?') // Replace standalone numbers\n // Collapse whitespace to a single space\n .replace(/\\s+/g, ' ')\n // Collapse IN and in clauses\n // eg. IN (?, ?, ?, ?) to IN (?)\n .replace(/\\bIN\\b\\s*\\(\\s*\\?(?:\\s*,\\s*\\?)*\\s*\\)/g, 'IN (?)')\n );\n }\n}\n\nconst _postgresJsIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPostgresJs();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [postgres](https://www.npmjs.com/package/postgres) library.\n *\n * For more information, see the [`postgresIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/postgres/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.postgresJsIntegration()],\n * });\n * ```\n */\n\nexport const postgresJsIntegration = defineIntegration(_postgresJsIntegration);\n"],"names":["generateInstrumentOnce","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","trace","context","SPAN_STATUS_ERROR","ATTR_DB_RESPONSE_STATUS_CODE","ATTR_ERROR_TYPE","ATTR_DB_OPERATION_NAME","startSpanManual","getCurrentScope","addOriginToSpan","safeExecuteInTheMiddle","logger","ATTR_DB_SYSTEM_NAME","ATTR_DB_NAMESPACE","ATTR_SERVER_ADDRESS","ATTR_SERVER_PORT","ATTR_DB_QUERY_TEXT","defineIntegration"],"mappings":";;;;;;;;AAAA;;AA8BA,MAAM,gBAAA,GAAmB,YAAY;AACrC,MAAM,kBAAmB,G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Q,EAAE;AACnB,MAAM,OAAO,mBAAmB;AAChC;;AAEA,IAAI;AACJ,MAAM;AACN,SAAS,OAAO,CAAC,MAAM,EAAE,GAAG;AAC5B,SAAS,IAAI,EAAC;AACd,SAAS,SAAS,CAAC,CAAC,EAAE,IAAI,CAAA;AAC1B,SAAS,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAA;AACtC,SAAS,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAA;AACxC,SAAS,OAAO,CAAC,OAAO,EAAE,EAAE,CAAA;AAC5B,SAAS,OAAO,CAAC,UAAU,EAAE,GAAG,CAAA;AAChC;AACA,SAAS,OAAO,CAAC,MAAM,EAAE,GAAG;AAC5B;AACA;AACA,SAAS,OAAO,CAAC,sCAAsC,EAAE,QAAQ;AACjE;AACA;AACA;;AAEA,MAAM,sBAAuB,IAAG,MAAM;AACtC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,oBAAoB,EAAE;AAC5B,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;MAEa,qBAAsB,GAAES,sBAAiB,CAAC,sBAAsB;;;;;;"}
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentation = require('@prisma/instrumentation');
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 = 'Prisma';
8
8
 
@@ -53,7 +53,7 @@ class SentryPrismaInteropInstrumentation extends instrumentation.PrismaInstrumen
53
53
  }
54
54
  }
55
55
 
56
- const instrumentPrisma = instrument.generateInstrumentOnce(
56
+ const instrumentPrisma = nodeCore.generateInstrumentOnce(
57
57
  INTEGRATION_NAME,
58
58
  options => {
59
59
  // Use a passed instrumentation instance to support older Prisma versions
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.js","sources":["../../../../src/integrations/tracing/prisma.ts"],"sourcesContent":["import type { Instrumentation } from '@opentelemetry/instrumentation';\nimport { PrismaInstrumentation } from '@prisma/instrumentation';\nimport { consoleSandbox, defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../otel/instrument';\nimport type { PrismaV5TracingHelper } from './prisma/vendor/v5-tracing-helper';\nimport type { PrismaV6TracingHelper } from './prisma/vendor/v6-tracing-helper';\n\nconst INTEGRATION_NAME = 'Prisma';\n\ntype CompatibilityLayerTraceHelper = PrismaV5TracingHelper & PrismaV6TracingHelper;\n\nfunction isPrismaV6TracingHelper(helper: unknown): helper is PrismaV6TracingHelper {\n return !!helper && typeof helper === 'object' && 'dispatchEngineSpans' in helper;\n}\n\nfunction getPrismaTracingHelper(): unknown | undefined {\n const prismaInstrumentationObject = (globalThis as Record<string, unknown>).PRISMA_INSTRUMENTATION;\n const prismaTracingHelper =\n prismaInstrumentationObject &&\n typeof prismaInstrumentationObject === 'object' &&\n 'helper' in prismaInstrumentationObject\n ? prismaInstrumentationObject.helper\n : undefined;\n\n return prismaTracingHelper;\n}\n\nclass SentryPrismaInteropInstrumentation extends PrismaInstrumentation {\n public constructor() {\n super();\n }\n\n public enable(): void {\n super.enable();\n\n // The PrismaIntegration (super class) defines a global variable `global[\"PRISMA_INSTRUMENTATION\"]` when `enable()` is called. This global variable holds a \"TracingHelper\" which Prisma uses internally to create tracing data. It's their way of not depending on OTEL with their main package. The sucky thing is, prisma broke the interface of the tracing helper with the v6 major update. This means that if you use Prisma 5 with the v6 instrumentation (or vice versa) Prisma just blows up, because tries to call methods on the helper that no longer exist.\n // Because we actually want to use the v6 instrumentation and not blow up in Prisma 5 user's faces, what we're doing here is backfilling the v5 method (`createEngineSpan`) with a noop so that no longer crashes when it attempts to call that function.\n // We still won't fully emit all the spans, but this could potentially be implemented in the future.\n const prismaTracingHelper = getPrismaTracingHelper();\n\n let emittedWarning = false;\n\n if (isPrismaV6TracingHelper(prismaTracingHelper)) {\n (prismaTracingHelper as CompatibilityLayerTraceHelper).createEngineSpan = () => {\n consoleSandbox(() => {\n if (!emittedWarning) {\n emittedWarning = true;\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] The Sentry SDK supports tracing with Prisma version 5 only with limited capabilities. For full tracing capabilities pass `prismaInstrumentation` for version 5 to the Sentry `prismaIntegration`. Read more: https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/',\n );\n }\n });\n };\n }\n }\n}\n\nexport const instrumentPrisma = generateInstrumentOnce<{ prismaInstrumentation?: Instrumentation }>(\n INTEGRATION_NAME,\n options => {\n // Use a passed instrumentation instance to support older Prisma versions\n if (options?.prismaInstrumentation) {\n return options.prismaInstrumentation;\n }\n\n return new SentryPrismaInteropInstrumentation();\n },\n);\n\n/**\n * Adds Sentry tracing instrumentation for the [prisma](https://www.npmjs.com/package/prisma) library.\n * For more information, see the [`prismaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/).\n *\n * NOTE: By default, this integration works with Prisma version 6.\n * To get performance instrumentation for other Prisma versions,\n * 1. Install the `@prisma/instrumentation` package with the desired version.\n * 1. Pass a `new PrismaInstrumentation()` instance as exported from `@prisma/instrumentation` to the `prismaInstrumentation` option of this integration:\n *\n * ```js\n * import { PrismaInstrumentation } from '@prisma/instrumentation'\n *\n * Sentry.init({\n * integrations: [\n * prismaIntegration({\n * // Override the default instrumentation that Sentry uses\n * prismaInstrumentation: new PrismaInstrumentation()\n * })\n * ]\n * })\n * ```\n *\n * The passed instrumentation instance will override the default instrumentation instance the integration would use, while the `prismaIntegration` will still ensure data compatibility for the various Prisma versions.\n * 1. Depending on your Prisma version (prior to version 6), add `previewFeatures = [\"tracing\"]` to the client generator block of your Prisma schema:\n *\n * ```\n * generator client {\n * provider = \"prisma-client-js\"\n * previewFeatures = [\"tracing\"]\n * }\n * ```\n */\nexport const prismaIntegration = defineIntegration(\n ({\n prismaInstrumentation,\n }: {\n /**\n * Overrides the instrumentation used by the Sentry SDK with the passed in instrumentation instance.\n *\n * NOTE: By default, the Sentry SDK uses the Prisma v6 instrumentation. Use this option if you need performance instrumentation different Prisma versions.\n *\n * For more information refer to the documentation of `prismaIntegration()` or see https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/\n */\n prismaInstrumentation?: Instrumentation;\n } = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPrisma({ prismaInstrumentation });\n },\n setup(client) {\n // If no tracing helper exists, we skip any work here\n // this means that prisma is not being used\n if (!getPrismaTracingHelper()) {\n return;\n }\n\n client.on('spanStart', span => {\n const spanJSON = spanToJSON(span);\n if (spanJSON.description?.startsWith('prisma:')) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.prisma');\n }\n\n // Make sure we use the query text as the span name, for ex. SELECT * FROM \"User\" WHERE \"id\" = $1\n if (spanJSON.description === 'prisma:engine:db_query' && spanJSON.data['db.query.text']) {\n span.updateName(spanJSON.data['db.query.text'] as string);\n }\n\n // In Prisma v5.22+, the `db.system` attribute is automatically set\n // On older versions, this is missing, so we add it here\n if (spanJSON.description === 'prisma:engine:db_query' && !spanJSON.data['db.system']) {\n span.setAttribute('db.system', 'prisma');\n }\n });\n },\n };\n },\n);\n"],"names":["PrismaInstrumentation","consoleSandbox","generateInstrumentOnce","defineIntegration","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN"],"mappings":";;;;;;AAOA,MAAM,gBAAA,GAAmB,QAAQ;;AAIjC,SAAS,uBAAuB,CAAC,MAAM,EAA4C;AACnF,EAAE,OAAO,CAAC,CAAC,MAAA,IAAU,OAAO,MAAO,KAAI,QAAS,IAAG,qBAAsB,IAAG,MAAM;AAClF;;AAEA,SAAS,sBAAsB,GAAwB;AACvD,EAAE,MAAM,2BAA4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H,IAAI,qBAAqB;AACzB;;AASE,GAAI,EAAE,KAAK;AACb,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,gBAAgB;AAC5B,MAAM,SAAS,GAAG;AAClB,QAAQ,gBAAgB,CAAC,EAAE,qBAAA,EAAuB,CAAC;AACnD,OAAO;AACP,MAAM,KAAK,CAAC,MAAM,EAAE;AACpB;AACA;AACA,QAAQ,IAAI,CAAC,sBAAsB,EAAE,EAAE;AACvC,UAAU;AACV;;AAEA,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,SAAS,CAAC,EAAE;AAC3D,YAAY,IAAI,CAAC,YAAY,CAACC,qCAAgC,EAAE,qBAAqB,CAAC;AACtF;;AAEA;AACA,UAAU,IAAI,QAAQ,CAAC,gBAAgB,wBAAA,IAA4B,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE;AACnG,YAAY,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAA,EAAY;AACrE;;AAEA;AACA;AACA,UAAU,IAAI,QAAQ,CAAC,gBAAgB,wBAAA,IAA4B,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;AAChG,YAAY,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC;AACpD;AACA,SAAS,CAAC;AACV,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;;"}
1
+ {"version":3,"file":"prisma.js","sources":["../../../../src/integrations/tracing/prisma.ts"],"sourcesContent":["import type { Instrumentation } from '@opentelemetry/instrumentation';\nimport { PrismaInstrumentation } from '@prisma/instrumentation';\nimport { consoleSandbox, defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport type { PrismaV5TracingHelper } from './prisma/vendor/v5-tracing-helper';\nimport type { PrismaV6TracingHelper } from './prisma/vendor/v6-tracing-helper';\n\nconst INTEGRATION_NAME = 'Prisma';\n\ntype CompatibilityLayerTraceHelper = PrismaV5TracingHelper & PrismaV6TracingHelper;\n\nfunction isPrismaV6TracingHelper(helper: unknown): helper is PrismaV6TracingHelper {\n return !!helper && typeof helper === 'object' && 'dispatchEngineSpans' in helper;\n}\n\nfunction getPrismaTracingHelper(): unknown | undefined {\n const prismaInstrumentationObject = (globalThis as Record<string, unknown>).PRISMA_INSTRUMENTATION;\n const prismaTracingHelper =\n prismaInstrumentationObject &&\n typeof prismaInstrumentationObject === 'object' &&\n 'helper' in prismaInstrumentationObject\n ? prismaInstrumentationObject.helper\n : undefined;\n\n return prismaTracingHelper;\n}\n\nclass SentryPrismaInteropInstrumentation extends PrismaInstrumentation {\n public constructor() {\n super();\n }\n\n public enable(): void {\n super.enable();\n\n // The PrismaIntegration (super class) defines a global variable `global[\"PRISMA_INSTRUMENTATION\"]` when `enable()` is called. This global variable holds a \"TracingHelper\" which Prisma uses internally to create tracing data. It's their way of not depending on OTEL with their main package. The sucky thing is, prisma broke the interface of the tracing helper with the v6 major update. This means that if you use Prisma 5 with the v6 instrumentation (or vice versa) Prisma just blows up, because tries to call methods on the helper that no longer exist.\n // Because we actually want to use the v6 instrumentation and not blow up in Prisma 5 user's faces, what we're doing here is backfilling the v5 method (`createEngineSpan`) with a noop so that no longer crashes when it attempts to call that function.\n // We still won't fully emit all the spans, but this could potentially be implemented in the future.\n const prismaTracingHelper = getPrismaTracingHelper();\n\n let emittedWarning = false;\n\n if (isPrismaV6TracingHelper(prismaTracingHelper)) {\n (prismaTracingHelper as CompatibilityLayerTraceHelper).createEngineSpan = () => {\n consoleSandbox(() => {\n if (!emittedWarning) {\n emittedWarning = true;\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] The Sentry SDK supports tracing with Prisma version 5 only with limited capabilities. For full tracing capabilities pass `prismaInstrumentation` for version 5 to the Sentry `prismaIntegration`. Read more: https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/',\n );\n }\n });\n };\n }\n }\n}\n\nexport const instrumentPrisma = generateInstrumentOnce<{ prismaInstrumentation?: Instrumentation }>(\n INTEGRATION_NAME,\n options => {\n // Use a passed instrumentation instance to support older Prisma versions\n if (options?.prismaInstrumentation) {\n return options.prismaInstrumentation;\n }\n\n return new SentryPrismaInteropInstrumentation();\n },\n);\n\n/**\n * Adds Sentry tracing instrumentation for the [prisma](https://www.npmjs.com/package/prisma) library.\n * For more information, see the [`prismaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/).\n *\n * NOTE: By default, this integration works with Prisma version 6.\n * To get performance instrumentation for other Prisma versions,\n * 1. Install the `@prisma/instrumentation` package with the desired version.\n * 1. Pass a `new PrismaInstrumentation()` instance as exported from `@prisma/instrumentation` to the `prismaInstrumentation` option of this integration:\n *\n * ```js\n * import { PrismaInstrumentation } from '@prisma/instrumentation'\n *\n * Sentry.init({\n * integrations: [\n * prismaIntegration({\n * // Override the default instrumentation that Sentry uses\n * prismaInstrumentation: new PrismaInstrumentation()\n * })\n * ]\n * })\n * ```\n *\n * The passed instrumentation instance will override the default instrumentation instance the integration would use, while the `prismaIntegration` will still ensure data compatibility for the various Prisma versions.\n * 1. Depending on your Prisma version (prior to version 6), add `previewFeatures = [\"tracing\"]` to the client generator block of your Prisma schema:\n *\n * ```\n * generator client {\n * provider = \"prisma-client-js\"\n * previewFeatures = [\"tracing\"]\n * }\n * ```\n */\nexport const prismaIntegration = defineIntegration(\n ({\n prismaInstrumentation,\n }: {\n /**\n * Overrides the instrumentation used by the Sentry SDK with the passed in instrumentation instance.\n *\n * NOTE: By default, the Sentry SDK uses the Prisma v6 instrumentation. Use this option if you need performance instrumentation different Prisma versions.\n *\n * For more information refer to the documentation of `prismaIntegration()` or see https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/\n */\n prismaInstrumentation?: Instrumentation;\n } = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPrisma({ prismaInstrumentation });\n },\n setup(client) {\n // If no tracing helper exists, we skip any work here\n // this means that prisma is not being used\n if (!getPrismaTracingHelper()) {\n return;\n }\n\n client.on('spanStart', span => {\n const spanJSON = spanToJSON(span);\n if (spanJSON.description?.startsWith('prisma:')) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.prisma');\n }\n\n // Make sure we use the query text as the span name, for ex. SELECT * FROM \"User\" WHERE \"id\" = $1\n if (spanJSON.description === 'prisma:engine:db_query' && spanJSON.data['db.query.text']) {\n span.updateName(spanJSON.data['db.query.text'] as string);\n }\n\n // In Prisma v5.22+, the `db.system` attribute is automatically set\n // On older versions, this is missing, so we add it here\n if (spanJSON.description === 'prisma:engine:db_query' && !spanJSON.data['db.system']) {\n span.setAttribute('db.system', 'prisma');\n }\n });\n },\n };\n },\n);\n"],"names":["PrismaInstrumentation","consoleSandbox","generateInstrumentOnce","defineIntegration","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN"],"mappings":";;;;;;AAOA,MAAM,gBAAA,GAAmB,QAAQ;;AAIjC,SAAS,uBAAuB,CAAC,MAAM,EAA4C;AACnF,EAAE,OAAO,CAAC,CAAC,MAAA,IAAU,OAAO,MAAO,KAAI,QAAS,IAAG,qBAAsB,IAAG,MAAM;AAClF;;AAEA,SAAS,sBAAsB,GAAwB;AACvD,EAAE,MAAM,2BAA4B,GAAE,CAAC,UAAW,GAA4B,sBAAsB;AACpG,EAAE,MAAM,mBAAoB;AAC5B,IAAI,2BAA4B;AAChC,IAAI,OAAO,2BAA4B,KAAI,QAAS;AACpD,IAAI,YAAY;AAChB,QAAQ,2BAA2B,CAAC;AACpC,QAAQ,SAAS;;AAEjB,EAAE,OAAO,mBAAmB;AAC5B;;AAEA,MAAM,kCAAA,SAA2CA,qCAAsB,CAAA;AAC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,EAAE;AACvC,UAAU;AACV;;AAEA,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,SAAS,CAAC,EAAE;AAC3D,YAAY,IAAI,CAAC,YAAY,CAACC,qCAAgC,EAAE,qBAAqB,CAAC;AACtF;;AAEA;AACA,UAAU,IAAI,QAAQ,CAAC,gBAAgB,wBAAA,IAA4B,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE;AACnG,YAAY,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAA,EAAY;AACrE;;AAEA;AACA;AACA,UAAU,IAAI,QAAQ,CAAC,gBAAgB,wBAAA,IAA4B,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;AAChG,YAAY,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC;AACpD;AACA,SAAS,CAAC;AACV,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;;"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
3
  const instrumentationIoredis = require('@opentelemetry/instrumentation-ioredis');
4
4
  const instrumentationRedis4 = require('@opentelemetry/instrumentation-redis-4');
5
5
  const core = require('@sentry/core');
6
- const instrument = require('../../otel/instrument.js');
6
+ const nodeCore = require('@sentry/node-core');
7
7
  const redisCache = require('../../utils/redisCache.js');
8
8
 
9
9
  const INTEGRATION_NAME = 'Redis';
@@ -54,13 +54,13 @@ const cacheResponseHook = (span, redisCommand, cmdArgs, response) => {
54
54
  span.updateName(core.truncate(spanDescription, 1024));
55
55
  };
56
56
 
57
- const instrumentIORedis = instrument.generateInstrumentOnce('IORedis', () => {
57
+ const instrumentIORedis = nodeCore.generateInstrumentOnce('IORedis', () => {
58
58
  return new instrumentationIoredis.IORedisInstrumentation({
59
59
  responseHook: cacheResponseHook,
60
60
  });
61
61
  });
62
62
 
63
- const instrumentRedis4 = instrument.generateInstrumentOnce('Redis-4', () => {
63
+ const instrumentRedis4 = nodeCore.generateInstrumentOnce('Redis-4', () => {
64
64
  return new instrumentationRedis4.RedisInstrumentation({
65
65
  responseHook: cacheResponseHook,
66
66
  });