@sentry/node 10.58.0 → 10.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (502) hide show
  1. package/build/cjs/index.js +2 -0
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/fs/index.js +3 -84
  4. package/build/cjs/integrations/fs/index.js.map +1 -1
  5. package/build/cjs/integrations/fs/vendored/constants.js.map +1 -1
  6. package/build/cjs/integrations/fs/vendored/instrumentation.js +145 -175
  7. package/build/cjs/integrations/fs/vendored/instrumentation.js.map +1 -1
  8. package/build/cjs/integrations/fs/vendored/utils.js.map +1 -1
  9. package/build/cjs/integrations/node-fetch/vendored/undici.js.map +1 -1
  10. package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
  11. package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +1 -1
  12. package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
  13. package/build/cjs/integrations/tracing/amqplib/vendored/types.js.map +1 -1
  14. package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
  15. package/build/cjs/integrations/tracing/connect/index.js +0 -21
  16. package/build/cjs/integrations/tracing/connect/index.js.map +1 -1
  17. package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js +0 -6
  18. package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -1
  19. package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js +33 -42
  20. package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
  21. package/build/cjs/integrations/tracing/connect/vendored/internal-types.js.map +1 -1
  22. package/build/cjs/integrations/tracing/connect/vendored/utils.js +3 -2
  23. package/build/cjs/integrations/tracing/connect/vendored/utils.js.map +1 -1
  24. package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
  25. package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +1 -1
  26. package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
  27. package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js.map +1 -1
  28. package/build/cjs/integrations/tracing/genericPool/index.js +1 -15
  29. package/build/cjs/integrations/tracing/genericPool/index.js.map +1 -1
  30. package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js +30 -18
  31. package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -1
  32. package/build/cjs/integrations/tracing/graphql/index.js +1 -51
  33. package/build/cjs/integrations/tracing/graphql/index.js.map +1 -1
  34. package/build/cjs/integrations/tracing/graphql/vendored/enum.js.map +1 -1
  35. package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js +0 -2
  36. package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -1
  37. package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js +67 -57
  38. package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
  39. package/build/cjs/integrations/tracing/graphql/vendored/internal-types.js.map +1 -1
  40. package/build/cjs/integrations/tracing/graphql/vendored/symbols.js.map +1 -1
  41. package/build/cjs/integrations/tracing/graphql/vendored/utils.js +28 -62
  42. package/build/cjs/integrations/tracing/graphql/vendored/utils.js.map +1 -1
  43. package/build/cjs/integrations/tracing/hapi/index.js +0 -17
  44. package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
  45. package/build/cjs/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -1
  46. package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js +28 -45
  47. package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
  48. package/build/cjs/integrations/tracing/hapi/vendored/internal-types.js.map +1 -1
  49. package/build/cjs/integrations/tracing/hapi/vendored/semconv.js.map +1 -1
  50. package/build/cjs/integrations/tracing/hapi/vendored/utils.js +4 -9
  51. package/build/cjs/integrations/tracing/hapi/vendored/utils.js.map +1 -1
  52. package/build/cjs/integrations/tracing/index.js +1 -0
  53. package/build/cjs/integrations/tracing/index.js.map +1 -1
  54. package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
  55. package/build/cjs/integrations/tracing/kafka/vendored/internal-types.js.map +1 -1
  56. package/build/cjs/integrations/tracing/kafka/vendored/propagator.js.map +1 -1
  57. package/build/cjs/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
  58. package/build/cjs/integrations/tracing/knex/index.js +2 -17
  59. package/build/cjs/integrations/tracing/knex/index.js.map +1 -1
  60. package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +65 -93
  61. package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
  62. package/build/cjs/integrations/tracing/knex/vendored/semconv.js +2 -0
  63. package/build/cjs/integrations/tracing/knex/vendored/semconv.js.map +1 -1
  64. package/build/cjs/integrations/tracing/knex/vendored/utils.js +2 -15
  65. package/build/cjs/integrations/tracing/knex/vendored/utils.js.map +1 -1
  66. package/build/cjs/integrations/tracing/koa/index.js +1 -24
  67. package/build/cjs/integrations/tracing/koa/index.js.map +1 -1
  68. package/build/cjs/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -1
  69. package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js +29 -41
  70. package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
  71. package/build/cjs/integrations/tracing/koa/vendored/internal-types.js.map +1 -1
  72. package/build/cjs/integrations/tracing/koa/vendored/types.js.map +1 -1
  73. package/build/cjs/integrations/tracing/koa/vendored/utils.js.map +1 -1
  74. package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
  75. package/build/cjs/integrations/tracing/mongo/index.js +1 -42
  76. package/build/cjs/integrations/tracing/mongo/index.js.map +1 -1
  77. package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js +12 -562
  78. package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
  79. package/build/cjs/integrations/tracing/mongo/vendored/internal-types.js.map +1 -1
  80. package/build/cjs/integrations/tracing/mongo/vendored/patches.js +151 -0
  81. package/build/cjs/integrations/tracing/mongo/vendored/patches.js.map +1 -0
  82. package/build/cjs/integrations/tracing/mongo/vendored/semconv.js +0 -4
  83. package/build/cjs/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
  84. package/build/cjs/integrations/tracing/mongo/vendored/utils.js +153 -0
  85. package/build/cjs/integrations/tracing/mongo/vendored/utils.js.map +1 -0
  86. package/build/cjs/integrations/tracing/mongoose/index.js +1 -8
  87. package/build/cjs/integrations/tracing/mongoose/index.js.map +1 -1
  88. package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js +56 -203
  89. package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
  90. package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js +0 -4
  91. package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
  92. package/build/cjs/integrations/tracing/mongoose/vendored/utils.js +19 -49
  93. package/build/cjs/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
  94. package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js.map +1 -1
  95. package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
  96. package/build/cjs/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
  97. package/build/cjs/integrations/tracing/mysql/vendored/utils.js.map +1 -1
  98. package/build/cjs/integrations/tracing/mysql2/index.js +1 -8
  99. package/build/cjs/integrations/tracing/mysql2/index.js.map +1 -1
  100. package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +21 -59
  101. package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
  102. package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
  103. package/build/cjs/integrations/tracing/mysql2/vendored/utils.js +14 -33
  104. package/build/cjs/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
  105. package/build/cjs/integrations/tracing/postgres/index.js +0 -4
  106. package/build/cjs/integrations/tracing/postgres/index.js.map +1 -1
  107. package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js +0 -1
  108. package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -1
  109. package/build/cjs/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -1
  110. package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js +51 -261
  111. package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
  112. package/build/cjs/integrations/tracing/postgres/vendored/semconv.js +0 -12
  113. package/build/cjs/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
  114. package/build/cjs/integrations/tracing/postgres/vendored/utils.js +43 -167
  115. package/build/cjs/integrations/tracing/postgres/vendored/utils.js.map +1 -1
  116. package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
  117. package/build/cjs/integrations/tracing/prisma/vendored/constants.js.map +1 -1
  118. package/build/cjs/integrations/tracing/prisma/vendored/global.js.map +1 -1
  119. package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
  120. package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
  121. package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +89 -160
  122. package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
  123. package/build/cjs/integrations/tracing/redis/vendored/redis-common.js.map +1 -1
  124. package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +92 -231
  125. package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
  126. package/build/cjs/integrations/tracing/redis/vendored/semconv.js +0 -2
  127. package/build/cjs/integrations/tracing/redis/vendored/semconv.js.map +1 -1
  128. package/build/cjs/integrations/tracing/tedious/index.js +1 -25
  129. package/build/cjs/integrations/tracing/tedious/index.js.map +1 -1
  130. package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js +25 -76
  131. package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
  132. package/build/cjs/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
  133. package/build/cjs/integrations/tracing/tedious/vendored/utils.js.map +1 -1
  134. package/build/cjs/sdk/diagnosticsChannelInjection.js +21 -0
  135. package/build/cjs/sdk/diagnosticsChannelInjection.js.map +1 -0
  136. package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js +19 -0
  137. package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
  138. package/build/cjs/sdk/index.js +17 -1
  139. package/build/cjs/sdk/index.js.map +1 -1
  140. package/build/esm/index.js +1 -0
  141. package/build/esm/index.js.map +1 -1
  142. package/build/esm/integrations/fs/index.js +4 -85
  143. package/build/esm/integrations/fs/index.js.map +1 -1
  144. package/build/esm/integrations/fs/vendored/constants.js.map +1 -1
  145. package/build/esm/integrations/fs/vendored/instrumentation.js +147 -177
  146. package/build/esm/integrations/fs/vendored/instrumentation.js.map +1 -1
  147. package/build/esm/integrations/fs/vendored/utils.js.map +1 -1
  148. package/build/esm/integrations/node-fetch/vendored/undici.js.map +1 -1
  149. package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
  150. package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +1 -1
  151. package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
  152. package/build/esm/integrations/tracing/amqplib/vendored/types.js.map +1 -1
  153. package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
  154. package/build/esm/integrations/tracing/connect/index.js +1 -22
  155. package/build/esm/integrations/tracing/connect/index.js.map +1 -1
  156. package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js +1 -6
  157. package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -1
  158. package/build/esm/integrations/tracing/connect/vendored/instrumentation.js +36 -44
  159. package/build/esm/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
  160. package/build/esm/integrations/tracing/connect/vendored/internal-types.js.map +1 -1
  161. package/build/esm/integrations/tracing/connect/vendored/utils.js +3 -2
  162. package/build/esm/integrations/tracing/connect/vendored/utils.js.map +1 -1
  163. package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
  164. package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +1 -1
  165. package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
  166. package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js.map +1 -1
  167. package/build/esm/integrations/tracing/genericPool/index.js +3 -17
  168. package/build/esm/integrations/tracing/genericPool/index.js.map +1 -1
  169. package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js +31 -19
  170. package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -1
  171. package/build/esm/integrations/tracing/graphql/index.js +3 -53
  172. package/build/esm/integrations/tracing/graphql/index.js.map +1 -1
  173. package/build/esm/integrations/tracing/graphql/vendored/enum.js.map +1 -1
  174. package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js +0 -2
  175. package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -1
  176. package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js +69 -59
  177. package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
  178. package/build/esm/integrations/tracing/graphql/vendored/internal-types.js.map +1 -1
  179. package/build/esm/integrations/tracing/graphql/vendored/symbols.js.map +1 -1
  180. package/build/esm/integrations/tracing/graphql/vendored/utils.js +29 -62
  181. package/build/esm/integrations/tracing/graphql/vendored/utils.js.map +1 -1
  182. package/build/esm/integrations/tracing/hapi/index.js +1 -18
  183. package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
  184. package/build/esm/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -1
  185. package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js +30 -47
  186. package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
  187. package/build/esm/integrations/tracing/hapi/vendored/internal-types.js.map +1 -1
  188. package/build/esm/integrations/tracing/hapi/vendored/semconv.js.map +1 -1
  189. package/build/esm/integrations/tracing/hapi/vendored/utils.js +5 -10
  190. package/build/esm/integrations/tracing/hapi/vendored/utils.js.map +1 -1
  191. package/build/esm/integrations/tracing/index.js +1 -0
  192. package/build/esm/integrations/tracing/index.js.map +1 -1
  193. package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
  194. package/build/esm/integrations/tracing/kafka/vendored/internal-types.js.map +1 -1
  195. package/build/esm/integrations/tracing/kafka/vendored/propagator.js.map +1 -1
  196. package/build/esm/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
  197. package/build/esm/integrations/tracing/knex/index.js +4 -19
  198. package/build/esm/integrations/tracing/knex/index.js.map +1 -1
  199. package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +66 -94
  200. package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
  201. package/build/esm/integrations/tracing/knex/vendored/semconv.js +2 -1
  202. package/build/esm/integrations/tracing/knex/vendored/semconv.js.map +1 -1
  203. package/build/esm/integrations/tracing/knex/vendored/utils.js +3 -15
  204. package/build/esm/integrations/tracing/knex/vendored/utils.js.map +1 -1
  205. package/build/esm/integrations/tracing/koa/index.js +3 -26
  206. package/build/esm/integrations/tracing/koa/index.js.map +1 -1
  207. package/build/esm/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -1
  208. package/build/esm/integrations/tracing/koa/vendored/instrumentation.js +31 -43
  209. package/build/esm/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
  210. package/build/esm/integrations/tracing/koa/vendored/internal-types.js.map +1 -1
  211. package/build/esm/integrations/tracing/koa/vendored/types.js.map +1 -1
  212. package/build/esm/integrations/tracing/koa/vendored/utils.js.map +1 -1
  213. package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
  214. package/build/esm/integrations/tracing/mongo/index.js +3 -43
  215. package/build/esm/integrations/tracing/mongo/index.js.map +1 -1
  216. package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js +13 -563
  217. package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
  218. package/build/esm/integrations/tracing/mongo/vendored/internal-types.js.map +1 -1
  219. package/build/esm/integrations/tracing/mongo/vendored/patches.js +143 -0
  220. package/build/esm/integrations/tracing/mongo/vendored/patches.js.map +1 -0
  221. package/build/esm/integrations/tracing/mongo/vendored/semconv.js +1 -3
  222. package/build/esm/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
  223. package/build/esm/integrations/tracing/mongo/vendored/utils.js +146 -0
  224. package/build/esm/integrations/tracing/mongo/vendored/utils.js.map +1 -0
  225. package/build/esm/integrations/tracing/mongoose/index.js +2 -9
  226. package/build/esm/integrations/tracing/mongoose/index.js.map +1 -1
  227. package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js +59 -206
  228. package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
  229. package/build/esm/integrations/tracing/mongoose/vendored/semconv.js +1 -3
  230. package/build/esm/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
  231. package/build/esm/integrations/tracing/mongoose/vendored/utils.js +20 -50
  232. package/build/esm/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
  233. package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js.map +1 -1
  234. package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
  235. package/build/esm/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
  236. package/build/esm/integrations/tracing/mysql/vendored/utils.js.map +1 -1
  237. package/build/esm/integrations/tracing/mysql2/index.js +2 -9
  238. package/build/esm/integrations/tracing/mysql2/index.js.map +1 -1
  239. package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +26 -64
  240. package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
  241. package/build/esm/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
  242. package/build/esm/integrations/tracing/mysql2/vendored/utils.js +15 -34
  243. package/build/esm/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
  244. package/build/esm/integrations/tracing/postgres/index.js +1 -5
  245. package/build/esm/integrations/tracing/postgres/index.js.map +1 -1
  246. package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js +0 -1
  247. package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -1
  248. package/build/esm/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -1
  249. package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js +52 -262
  250. package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
  251. package/build/esm/integrations/tracing/postgres/vendored/semconv.js +1 -7
  252. package/build/esm/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
  253. package/build/esm/integrations/tracing/postgres/vendored/utils.js +44 -165
  254. package/build/esm/integrations/tracing/postgres/vendored/utils.js.map +1 -1
  255. package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
  256. package/build/esm/integrations/tracing/prisma/vendored/constants.js.map +1 -1
  257. package/build/esm/integrations/tracing/prisma/vendored/global.js.map +1 -1
  258. package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
  259. package/build/esm/integrations/tracing/redis/index.js.map +1 -1
  260. package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +92 -163
  261. package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
  262. package/build/esm/integrations/tracing/redis/vendored/redis-common.js.map +1 -1
  263. package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +94 -233
  264. package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
  265. package/build/esm/integrations/tracing/redis/vendored/semconv.js +1 -2
  266. package/build/esm/integrations/tracing/redis/vendored/semconv.js.map +1 -1
  267. package/build/esm/integrations/tracing/tedious/index.js +3 -27
  268. package/build/esm/integrations/tracing/tedious/index.js.map +1 -1
  269. package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js +29 -79
  270. package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
  271. package/build/esm/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
  272. package/build/esm/integrations/tracing/tedious/vendored/utils.js.map +1 -1
  273. package/build/esm/package.json +1 -1
  274. package/build/esm/sdk/diagnosticsChannelInjection.js +17 -0
  275. package/build/esm/sdk/diagnosticsChannelInjection.js.map +1 -0
  276. package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js +17 -0
  277. package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
  278. package/build/esm/sdk/index.js +17 -1
  279. package/build/esm/sdk/index.js.map +1 -1
  280. package/build/import-hook.mjs +6 -0
  281. package/build/types/index.d.ts +1 -0
  282. package/build/types/index.d.ts.map +1 -1
  283. package/build/types/integrations/fs/index.d.ts.map +1 -1
  284. package/build/types/integrations/fs/vendored/constants.d.ts.map +1 -1
  285. package/build/types/integrations/fs/vendored/instrumentation.d.ts +6 -10
  286. package/build/types/integrations/fs/vendored/instrumentation.d.ts.map +1 -1
  287. package/build/types/integrations/fs/vendored/types.d.ts +10 -15
  288. package/build/types/integrations/fs/vendored/types.d.ts.map +1 -1
  289. package/build/types/integrations/fs/vendored/utils.d.ts +2 -2
  290. package/build/types/integrations/fs/vendored/utils.d.ts.map +1 -1
  291. package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +1 -1
  292. package/build/types/integrations/node-fetch/vendored/types.d.ts.map +1 -1
  293. package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +1 -1
  294. package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts.map +1 -1
  295. package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts.map +1 -1
  296. package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -1
  297. package/build/types/integrations/tracing/amqplib/vendored/types.d.ts.map +1 -1
  298. package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -1
  299. package/build/types/integrations/tracing/connect/index.d.ts.map +1 -1
  300. package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +0 -4
  301. package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts.map +1 -1
  302. package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts +5 -5
  303. package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts.map +1 -1
  304. package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts +2 -2
  305. package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts.map +1 -1
  306. package/build/types/integrations/tracing/connect/vendored/utils.d.ts +1 -1
  307. package/build/types/integrations/tracing/connect/vendored/utils.d.ts.map +1 -1
  308. package/build/types/integrations/tracing/dataloader/vendored/instrumentation.d.ts.map +1 -1
  309. package/build/types/integrations/tracing/dataloader/vendored/types.d.ts.map +1 -1
  310. package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts.map +1 -1
  311. package/build/types/integrations/tracing/genericPool/index.d.ts.map +1 -1
  312. package/build/types/integrations/tracing/genericPool/vendored/instrumentation.d.ts.map +1 -1
  313. package/build/types/integrations/tracing/graphql/index.d.ts.map +1 -1
  314. package/build/types/integrations/tracing/graphql/vendored/enum.d.ts.map +1 -1
  315. package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +1 -3
  316. package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts.map +1 -1
  317. package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts +7 -2
  318. package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts.map +1 -1
  319. package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts +4 -4
  320. package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts.map +1 -1
  321. package/build/types/integrations/tracing/graphql/vendored/symbols.d.ts.map +1 -1
  322. package/build/types/integrations/tracing/graphql/vendored/types.d.ts +5 -43
  323. package/build/types/integrations/tracing/graphql/vendored/types.d.ts.map +1 -1
  324. package/build/types/integrations/tracing/graphql/vendored/utils.d.ts +8 -11
  325. package/build/types/integrations/tracing/graphql/vendored/utils.d.ts.map +1 -1
  326. package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
  327. package/build/types/integrations/tracing/hapi/vendored/enums/AttributeNames.d.ts.map +1 -1
  328. package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts +2 -2
  329. package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts.map +1 -1
  330. package/build/types/integrations/tracing/hapi/vendored/internal-types.d.ts.map +1 -1
  331. package/build/types/integrations/tracing/hapi/vendored/semconv.d.ts.map +1 -1
  332. package/build/types/integrations/tracing/hapi/vendored/utils.d.ts +3 -4
  333. package/build/types/integrations/tracing/hapi/vendored/utils.d.ts.map +1 -1
  334. package/build/types/integrations/tracing/index.d.ts.map +1 -1
  335. package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts.map +1 -1
  336. package/build/types/integrations/tracing/kafka/vendored/internal-types.d.ts.map +1 -1
  337. package/build/types/integrations/tracing/kafka/vendored/propagator.d.ts.map +1 -1
  338. package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts.map +1 -1
  339. package/build/types/integrations/tracing/kafka/vendored/types.d.ts.map +1 -1
  340. package/build/types/integrations/tracing/knex/index.d.ts.map +1 -1
  341. package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts +8 -10
  342. package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts.map +1 -1
  343. package/build/types/integrations/tracing/knex/vendored/semconv.d.ts +1 -0
  344. package/build/types/integrations/tracing/knex/vendored/semconv.d.ts.map +1 -1
  345. package/build/types/integrations/tracing/knex/vendored/utils.d.ts +0 -6
  346. package/build/types/integrations/tracing/knex/vendored/utils.d.ts.map +1 -1
  347. package/build/types/integrations/tracing/koa/index.d.ts.map +1 -1
  348. package/build/types/integrations/tracing/koa/vendored/enums/AttributeNames.d.ts.map +1 -1
  349. package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts +1 -1
  350. package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts.map +1 -1
  351. package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts +4 -4
  352. package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts.map +1 -1
  353. package/build/types/integrations/tracing/koa/vendored/types.d.ts +2 -39
  354. package/build/types/integrations/tracing/koa/vendored/types.d.ts.map +1 -1
  355. package/build/types/integrations/tracing/koa/vendored/utils.d.ts +3 -3
  356. package/build/types/integrations/tracing/koa/vendored/utils.d.ts.map +1 -1
  357. package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts.map +1 -1
  358. package/build/types/integrations/tracing/mongo/index.d.ts +0 -4
  359. package/build/types/integrations/tracing/mongo/index.d.ts.map +1 -1
  360. package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts +4 -72
  361. package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts.map +1 -1
  362. package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts +0 -59
  363. package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts.map +1 -1
  364. package/build/types/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
  365. package/build/types/integrations/tracing/mongo/vendored/patches.d.ts.map +1 -0
  366. package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts +0 -54
  367. package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts.map +1 -1
  368. package/build/types/integrations/tracing/mongo/vendored/utils.d.ts +24 -0
  369. package/build/types/integrations/tracing/mongo/vendored/utils.d.ts.map +1 -0
  370. package/build/types/integrations/tracing/mongoose/index.d.ts.map +1 -1
  371. package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +3 -0
  372. package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts.map +1 -1
  373. package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts +3 -8
  374. package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts.map +1 -1
  375. package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -14
  376. package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts.map +1 -1
  377. package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts +4 -6
  378. package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts.map +1 -1
  379. package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts.map +1 -1
  380. package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts.map +1 -1
  381. package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts.map +1 -1
  382. package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts.map +1 -1
  383. package/build/types/integrations/tracing/mysql/vendored/types.d.ts.map +1 -1
  384. package/build/types/integrations/tracing/mysql/vendored/utils.d.ts.map +1 -1
  385. package/build/types/integrations/tracing/mysql2/index.d.ts.map +1 -1
  386. package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts +3 -6
  387. package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -1
  388. package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts.map +1 -1
  389. package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts +3 -5
  390. package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts.map +1 -1
  391. package/build/types/integrations/tracing/postgres/index.d.ts.map +1 -1
  392. package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +0 -1
  393. package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts.map +1 -1
  394. package/build/types/integrations/tracing/postgres/vendored/enums/SpanNames.d.ts.map +1 -1
  395. package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts +1 -9
  396. package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts.map +1 -1
  397. package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts +0 -2
  398. package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts.map +1 -1
  399. package/build/types/integrations/tracing/postgres/vendored/pg-pool-types.d.ts.map +1 -1
  400. package/build/types/integrations/tracing/postgres/vendored/pg-types.d.ts.map +1 -1
  401. package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts +0 -50
  402. package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts.map +1 -1
  403. package/build/types/integrations/tracing/postgres/vendored/types.d.ts +2 -56
  404. package/build/types/integrations/tracing/postgres/vendored/types.d.ts.map +1 -1
  405. package/build/types/integrations/tracing/postgres/vendored/utils.d.ts +13 -26
  406. package/build/types/integrations/tracing/postgres/vendored/utils.d.ts.map +1 -1
  407. package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts.map +1 -1
  408. package/build/types/integrations/tracing/prisma/vendored/constants.d.ts.map +1 -1
  409. package/build/types/integrations/tracing/prisma/vendored/global.d.ts.map +1 -1
  410. package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts.map +1 -1
  411. package/build/types/integrations/tracing/prisma/vendored/types.d.ts.map +1 -1
  412. package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
  413. package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +3 -8
  414. package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts.map +1 -1
  415. package/build/types/integrations/tracing/redis/vendored/redis-common.d.ts.map +1 -1
  416. package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -1
  417. package/build/types/integrations/tracing/redis/vendored/semconv.d.ts.map +1 -1
  418. package/build/types/integrations/tracing/redis/vendored/types.d.ts +2 -36
  419. package/build/types/integrations/tracing/redis/vendored/types.d.ts.map +1 -1
  420. package/build/types/integrations/tracing/tedious/index.d.ts.map +1 -1
  421. package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts +3 -14
  422. package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts.map +1 -1
  423. package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts.map +1 -1
  424. package/build/types/integrations/tracing/tedious/vendored/utils.d.ts.map +1 -1
  425. package/build/types/sdk/diagnosticsChannelInjection.d.ts +41 -0
  426. package/build/types/sdk/diagnosticsChannelInjection.d.ts.map +1 -0
  427. package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +34 -0
  428. package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts.map +1 -0
  429. package/build/types/sdk/index.d.ts.map +1 -1
  430. package/build/types-ts3.8/index.d.ts +1 -0
  431. package/build/types-ts3.8/integrations/fs/vendored/instrumentation.d.ts +6 -10
  432. package/build/types-ts3.8/integrations/fs/vendored/types.d.ts +10 -15
  433. package/build/types-ts3.8/integrations/fs/vendored/utils.d.ts +2 -2
  434. package/build/types-ts3.8/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +0 -4
  435. package/build/types-ts3.8/integrations/tracing/connect/vendored/instrumentation.d.ts +4 -4
  436. package/build/types-ts3.8/integrations/tracing/connect/vendored/internal-types.d.ts +2 -2
  437. package/build/types-ts3.8/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +1 -3
  438. package/build/types-ts3.8/integrations/tracing/graphql/vendored/instrumentation.d.ts +6 -1
  439. package/build/types-ts3.8/integrations/tracing/graphql/vendored/internal-types.d.ts +3 -3
  440. package/build/types-ts3.8/integrations/tracing/graphql/vendored/types.d.ts +4 -42
  441. package/build/types-ts3.8/integrations/tracing/graphql/vendored/utils.d.ts +6 -9
  442. package/build/types-ts3.8/integrations/tracing/hapi/vendored/instrumentation.d.ts +2 -2
  443. package/build/types-ts3.8/integrations/tracing/hapi/vendored/utils.d.ts +1 -2
  444. package/build/types-ts3.8/integrations/tracing/knex/vendored/instrumentation.d.ts +8 -10
  445. package/build/types-ts3.8/integrations/tracing/knex/vendored/semconv.d.ts +1 -0
  446. package/build/types-ts3.8/integrations/tracing/knex/vendored/utils.d.ts +0 -6
  447. package/build/types-ts3.8/integrations/tracing/koa/vendored/internal-types.d.ts +4 -4
  448. package/build/types-ts3.8/integrations/tracing/koa/vendored/types.d.ts +1 -38
  449. package/build/types-ts3.8/integrations/tracing/mongo/index.d.ts +0 -4
  450. package/build/types-ts3.8/integrations/tracing/mongo/vendored/instrumentation.d.ts +4 -72
  451. package/build/types-ts3.8/integrations/tracing/mongo/vendored/internal-types.d.ts +0 -59
  452. package/build/types-ts3.8/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
  453. package/build/types-ts3.8/integrations/tracing/mongo/vendored/semconv.d.ts +0 -54
  454. package/build/types-ts3.8/integrations/tracing/mongo/vendored/utils.d.ts +24 -0
  455. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +3 -0
  456. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose.d.ts +3 -8
  457. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -14
  458. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/utils.d.ts +4 -6
  459. package/build/types-ts3.8/integrations/tracing/mysql2/vendored/instrumentation.d.ts +3 -6
  460. package/build/types-ts3.8/integrations/tracing/mysql2/vendored/utils.d.ts +3 -5
  461. package/build/types-ts3.8/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +0 -1
  462. package/build/types-ts3.8/integrations/tracing/postgres/vendored/instrumentation.d.ts +0 -8
  463. package/build/types-ts3.8/integrations/tracing/postgres/vendored/internal-types.d.ts +0 -2
  464. package/build/types-ts3.8/integrations/tracing/postgres/vendored/semconv.d.ts +0 -50
  465. package/build/types-ts3.8/integrations/tracing/postgres/vendored/types.d.ts +1 -55
  466. package/build/types-ts3.8/integrations/tracing/postgres/vendored/utils.d.ts +13 -26
  467. package/build/types-ts3.8/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +3 -8
  468. package/build/types-ts3.8/integrations/tracing/redis/vendored/types.d.ts +2 -36
  469. package/build/types-ts3.8/integrations/tracing/tedious/vendored/instrumentation.d.ts +3 -14
  470. package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +41 -0
  471. package/build/types-ts3.8/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +34 -0
  472. package/package.json +20 -6
  473. package/build/cjs/integrations/tracing/knex/vendored/constants.js +0 -16
  474. package/build/cjs/integrations/tracing/knex/vendored/constants.js.map +0 -1
  475. package/build/cjs/integrations/tracing/postgres/vendored/internal-types.js +0 -6
  476. package/build/cjs/integrations/tracing/postgres/vendored/internal-types.js.map +0 -1
  477. package/build/cjs/integrations/tracing/utils/sql-common.js +0 -43
  478. package/build/cjs/integrations/tracing/utils/sql-common.js.map +0 -1
  479. package/build/esm/integrations/tracing/knex/vendored/constants.js +0 -13
  480. package/build/esm/integrations/tracing/knex/vendored/constants.js.map +0 -1
  481. package/build/esm/integrations/tracing/postgres/vendored/internal-types.js +0 -4
  482. package/build/esm/integrations/tracing/postgres/vendored/internal-types.js.map +0 -1
  483. package/build/esm/integrations/tracing/utils/sql-common.js +0 -41
  484. package/build/esm/integrations/tracing/utils/sql-common.js.map +0 -1
  485. package/build/types/integrations/tracing/knex/vendored/constants.d.ts +0 -3
  486. package/build/types/integrations/tracing/knex/vendored/constants.d.ts.map +0 -1
  487. package/build/types/integrations/tracing/knex/vendored/types.d.ts +0 -8
  488. package/build/types/integrations/tracing/knex/vendored/types.d.ts.map +0 -1
  489. package/build/types/integrations/tracing/mongo/vendored/types.d.ts +0 -51
  490. package/build/types/integrations/tracing/mongo/vendored/types.d.ts.map +0 -1
  491. package/build/types/integrations/tracing/mongoose/vendored/types.d.ts +0 -36
  492. package/build/types/integrations/tracing/mongoose/vendored/types.d.ts.map +0 -1
  493. package/build/types/integrations/tracing/mysql2/vendored/types.d.ts +0 -18
  494. package/build/types/integrations/tracing/mysql2/vendored/types.d.ts.map +0 -1
  495. package/build/types/integrations/tracing/tedious/vendored/types.d.ts +0 -10
  496. package/build/types/integrations/tracing/tedious/vendored/types.d.ts.map +0 -1
  497. package/build/types-ts3.8/integrations/tracing/knex/vendored/constants.d.ts +0 -3
  498. package/build/types-ts3.8/integrations/tracing/knex/vendored/types.d.ts +0 -8
  499. package/build/types-ts3.8/integrations/tracing/mongo/vendored/types.d.ts +0 -51
  500. package/build/types-ts3.8/integrations/tracing/mongoose/vendored/types.d.ts +0 -36
  501. package/build/types-ts3.8/integrations/tracing/mysql2/vendored/types.d.ts +0 -18
  502. package/build/types-ts3.8/integrations/tracing/tedious/vendored/types.d.ts +0 -10
@@ -1,28 +1,14 @@
1
1
  import { GenericPoolInstrumentation } from './vendored/instrumentation.js';
2
- import { defineIntegration, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
3
- import { generateInstrumentOnce, instrumentWhenWrapped } from '@sentry/node-core';
2
+ import { defineIntegration } from '@sentry/core';
3
+ import { generateInstrumentOnce } from '@sentry/node-core';
4
4
 
5
5
  const INTEGRATION_NAME = "GenericPool";
6
6
  const instrumentGenericPool = generateInstrumentOnce(INTEGRATION_NAME, () => new GenericPoolInstrumentation({}));
7
7
  const _genericPoolIntegration = (() => {
8
- let instrumentationWrappedCallback;
9
8
  return {
10
9
  name: INTEGRATION_NAME,
11
10
  setupOnce() {
12
- const instrumentation = instrumentGenericPool();
13
- instrumentationWrappedCallback = instrumentWhenWrapped(instrumentation);
14
- },
15
- setup(client) {
16
- instrumentationWrappedCallback?.(
17
- () => client.on("spanStart", (span) => {
18
- const spanJSON = spanToJSON(span);
19
- const spanDescription = spanJSON.description;
20
- const isGenericPoolSpan = spanDescription === "generic-pool.acquire";
21
- if (isGenericPoolSpan) {
22
- span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, "auto.db.otel.generic_pool");
23
- }
24
- })
25
- );
11
+ instrumentGenericPool();
26
12
  }
27
13
  };
28
14
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/genericPool/index.ts"],"sourcesContent":["import { GenericPoolInstrumentation } from './vendored/instrumentation';\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 = 'GenericPool';\n\nexport const instrumentGenericPool = generateInstrumentOnce(INTEGRATION_NAME, () => new GenericPoolInstrumentation({}));\n\nconst _genericPoolIntegration = (() => {\n let instrumentationWrappedCallback: undefined | ((callback: () => void) => void);\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n const instrumentation = instrumentGenericPool();\n instrumentationWrappedCallback = instrumentWhenWrapped(instrumentation);\n },\n\n setup(client) {\n instrumentationWrappedCallback?.(() =>\n client.on('spanStart', span => {\n const spanJSON = spanToJSON(span);\n const spanDescription = spanJSON.description;\n const isGenericPoolSpan = spanDescription === 'generic-pool.acquire';\n\n if (isGenericPoolSpan) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.generic_pool');\n }\n }),\n );\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [generic-pool](https://www.npmjs.com/package/generic-pool) library.\n *\n * For more information, see the [`genericPoolIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/genericpool/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.genericPoolIntegration()],\n * });\n * ```\n */\nexport const genericPoolIntegration = defineIntegration(_genericPoolIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,aAAA;AAElB,MAAM,qBAAA,GAAwB,uBAAuB,gBAAA,EAAkB,MAAM,IAAI,0BAAA,CAA2B,EAAE,CAAC;AAEtH,MAAM,2BAA2B,MAAM;AACrC,EAAA,IAAI,8BAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,MAAM,kBAAkB,qBAAA,EAAsB;AAC9C,MAAA,8BAAA,GAAiC,sBAAsB,eAAe,CAAA;AAAA,IACxE,CAAA;AAAA,IAEA,MAAM,MAAA,EAAQ;AACZ,MAAA,8BAAA;AAAA,QAAiC,MAC/B,MAAA,CAAO,EAAA,CAAG,WAAA,EAAa,CAAA,IAAA,KAAQ;AAC7B,UAAA,MAAM,QAAA,GAAW,WAAW,IAAI,CAAA;AAChC,UAAA,MAAM,kBAAkB,QAAA,CAAS,WAAA;AACjC,UAAA,MAAM,oBAAoB,eAAA,KAAoB,sBAAA;AAE9C,UAAA,IAAI,iBAAA,EAAmB;AACrB,YAAA,IAAA,CAAK,YAAA,CAAa,kCAAkC,2BAA2B,CAAA;AAAA,UACjF;AAAA,QACF,CAAC;AAAA,OACH;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,sBAAA,GAAyB,kBAAkB,uBAAuB;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/genericPool/index.ts"],"sourcesContent":["import { GenericPoolInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'GenericPool';\n\nexport const instrumentGenericPool = generateInstrumentOnce(INTEGRATION_NAME, () => new GenericPoolInstrumentation({}));\n\nconst _genericPoolIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentGenericPool();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [generic-pool](https://www.npmjs.com/package/generic-pool) library.\n *\n * For more information, see the [`genericPoolIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/genericpool/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.genericPoolIntegration()],\n * });\n * ```\n */\nexport const genericPoolIntegration = defineIntegration(_genericPoolIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,aAAA;AAElB,MAAM,qBAAA,GAAwB,uBAAuB,gBAAA,EAAkB,MAAM,IAAI,0BAAA,CAA2B,EAAE,CAAC;AAEtH,MAAM,2BAA2B,MAAM;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,qBAAA,EAAsB;AAAA,IACxB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,sBAAA,GAAyB,kBAAkB,uBAAuB;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';
2
- import { SDK_VERSION, startSpan, startSpanManual, SPAN_STATUS_ERROR } from '@sentry/core';
2
+ import { SDK_VERSION, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpanManual, SPAN_STATUS_ERROR } from '@sentry/core';
3
3
 
4
4
  const MODULE_NAME = "generic-pool";
5
5
  const PACKAGE_NAME = "@sentry/instrumentation-generic-pool";
@@ -65,9 +65,15 @@ class GenericPoolInstrumentation extends InstrumentationBase {
65
65
  }
66
66
  _acquirePatcher(original) {
67
67
  return function wrapped_acquire(...args) {
68
- return startSpan({ name: "generic-pool.acquire" }, () => {
69
- return original.call(this, ...args);
70
- });
68
+ return startSpan(
69
+ {
70
+ name: "generic-pool.acquire",
71
+ attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.db.otel.generic_pool" }
72
+ },
73
+ () => {
74
+ return original.call(this, ...args);
75
+ }
76
+ );
71
77
  };
72
78
  }
73
79
  _poolWrapper(original) {
@@ -85,21 +91,27 @@ class GenericPoolInstrumentation extends InstrumentationBase {
85
91
  if (isDisabled()) {
86
92
  return original.call(this, cb, priority);
87
93
  }
88
- return startSpanManual({ name: "generic-pool.acquire" }, (span) => {
89
- original.call(
90
- this,
91
- (err, client) => {
92
- if (err) {
93
- span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" });
94
- }
95
- span.end();
96
- if (cb) {
97
- cb(err, client);
98
- }
99
- },
100
- priority
101
- );
102
- });
94
+ return startSpanManual(
95
+ {
96
+ name: "generic-pool.acquire",
97
+ attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.db.otel.generic_pool" }
98
+ },
99
+ (span) => {
100
+ original.call(
101
+ this,
102
+ (err, client) => {
103
+ if (err) {
104
+ span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" });
105
+ }
106
+ span.end();
107
+ if (cb) {
108
+ cb(err, client);
109
+ }
110
+ },
111
+ priority
112
+ );
113
+ }
114
+ );
103
115
  };
104
116
  }
105
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/genericPool/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-generic-pool\n * - Upstream version: @opentelemetry/instrumentation-generic-pool@0.61.0\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport { SDK_VERSION, SPAN_STATUS_ERROR, startSpan, startSpanManual } from '@sentry/core';\nimport type * as genericPool from './generic-pool-types';\n\nconst MODULE_NAME = 'generic-pool';\nconst PACKAGE_NAME = '@sentry/instrumentation-generic-pool';\n\ntype AcquireFn = (this: unknown, ...args: unknown[]) => unknown;\ninterface PoolConstructor {\n prototype: { acquire: AcquireFn };\n}\ninterface GenericPoolModule {\n Pool: PoolConstructor;\n}\n\nexport class GenericPoolInstrumentation extends InstrumentationBase {\n // only used for v2 - v2.3)\n private _isDisabled = false;\n\n constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n init() {\n return [\n new InstrumentationNodeModuleDefinition(\n MODULE_NAME,\n ['>=3.0.0 <4'],\n (moduleExports: GenericPoolModule) => {\n const Pool = moduleExports.Pool;\n if (isWrapped(Pool.prototype.acquire)) {\n this._unwrap(Pool.prototype, 'acquire');\n }\n this._wrap(Pool.prototype, 'acquire', this._acquirePatcher.bind(this));\n return moduleExports;\n },\n (moduleExports: GenericPoolModule) => {\n const Pool = moduleExports.Pool;\n this._unwrap(Pool.prototype, 'acquire');\n return moduleExports;\n },\n ),\n new InstrumentationNodeModuleDefinition(\n MODULE_NAME,\n ['>=2.4.0 <3'],\n (moduleExports: GenericPoolModule) => {\n const Pool = moduleExports.Pool;\n if (isWrapped(Pool.prototype.acquire)) {\n this._unwrap(Pool.prototype, 'acquire');\n }\n this._wrap(Pool.prototype, 'acquire', this._acquireWithCallbacksPatcher.bind(this));\n return moduleExports;\n },\n (moduleExports: GenericPoolModule) => {\n const Pool = moduleExports.Pool;\n this._unwrap(Pool.prototype, 'acquire');\n return moduleExports;\n },\n ),\n new InstrumentationNodeModuleDefinition(\n MODULE_NAME,\n ['>=2.0.0 <2.4'],\n (moduleExports: GenericPoolModule) => {\n this._isDisabled = false;\n if (isWrapped(moduleExports.Pool)) {\n this._unwrap(moduleExports, 'Pool');\n }\n this._wrap(moduleExports, 'Pool', this._poolWrapper.bind(this));\n return moduleExports;\n },\n (moduleExports: GenericPoolModule) => {\n // since the object is created on the fly every time, we need to use\n // a boolean switch here to disable the instrumentation\n this._isDisabled = true;\n return moduleExports;\n },\n ),\n ];\n }\n\n private _acquirePatcher(original: AcquireFn) {\n return function wrapped_acquire(this: genericPool.Pool<unknown>, ...args: unknown[]) {\n return startSpan({ name: 'generic-pool.acquire' }, () => {\n return original.call(this, ...args) as PromiseLike<unknown>;\n });\n };\n }\n\n private _poolWrapper(original: (this: unknown, ...args: unknown[]) => { acquire: AcquireFn }) {\n const wrap = this._wrap.bind(this);\n const acquireWithCallbacksPatcher = this._acquireWithCallbacksPatcher.bind(this);\n return function wrapped_pool(this: unknown, ...args: unknown[]) {\n const pool = original.apply(this, args);\n wrap(pool, 'acquire', acquireWithCallbacksPatcher);\n return pool;\n };\n }\n\n private _acquireWithCallbacksPatcher(original: AcquireFn) {\n const isDisabled = (): boolean => this._isDisabled;\n return function wrapped_acquire(\n this: genericPool.Pool<unknown>,\n cb: (err: unknown, client: unknown) => unknown,\n priority: number,\n ) {\n // only used for v2 - v2.3\n if (isDisabled()) {\n return original.call(this, cb, priority);\n }\n\n return startSpanManual({ name: 'generic-pool.acquire' }, span => {\n original.call(\n this,\n (err: unknown, client: unknown) => {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n }\n span.end();\n // Not checking whether cb is a function because\n // the original code doesn't do that either.\n // The callback's return value is unused by generic-pool, so we don't return it.\n if (cb) {\n cb(err, client);\n }\n },\n priority,\n );\n });\n };\n }\n}\n"],"names":[],"mappings":";;;AA0BA,MAAM,WAAA,GAAc,cAAA;AACpB,MAAM,YAAA,GAAe,sCAAA;AAUd,MAAM,mCAAmC,mBAAA,CAAoB;AAAA,EAIlE,WAAA,CAAY,MAAA,GAAgC,EAAC,EAAG;AAC9C,IAAA,KAAA,CAAM,YAAA,EAAc,aAAa,MAAM,CAAA;AAHzC;AAAA,IAAA,IAAA,CAAQ,WAAA,GAAc,KAAA;AAAA,EAItB;AAAA,EAEA,IAAA,GAAO;AACL,IAAA,OAAO;AAAA,MACL,IAAI,mCAAA;AAAA,QACF,WAAA;AAAA,QACA,CAAC,YAAY,CAAA;AAAA,QACb,CAAC,aA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AA,EAEQ,6BAA6B,QAAA,EAAqB;AACxD,IAAA,MAAM,UAAA,GAAa,MAAe,IAAA,CAAK,WAAA;AACvC,IAAA,OAAO,SAAS,eAAA,CAEd,EAAA,EACA,QAAA,EACA;AAEA,MAAA,IAAI,YAAW,EAAG;AAChB,QAAA,OAAO,QAAA,CAAS,IAAA,CAAK,IAAA,EAAM,EAAA,EAAI,QAAQ,CAAA;AAAA,MACzC;AAEA,MAAA,OAAO,eAAA,CAAgB,EAAE,IAAA,EAAM,sBAAA,IAA0B,CAAA,IAAA,KAAQ;AAC/D,QAAA,QAAA,CAAS,IAAA;AAAA,UACP,IAAA;AAAA,UACA,CAAC,KAAc,MAAA,KAAoB;AACjC,YAAA,IAAI,GAAA,EAAK;AACP,cAAA,IAAA,CAAK,UAAU,EAAE,IAAA,EAAM,iBAAA,EAAmB,OAAA,EAAS,kBAAkB,CAAA;AAAA,YACvE;AACA,YAAA,IAAA,CAAK,GAAA,EAAI;AAIT,YAAA,IAAI,EAAA,EAAI;AACN,cAAA,EAAA,CAAG,KAAK,MAAM,CAAA;AAAA,YAChB;AAAA,UACF,CAAA;AAAA,UACA;AAAA,SACF;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAA;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/genericPool/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-generic-pool\n * - Upstream version: @opentelemetry/instrumentation-generic-pool@0.61.0\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport {\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n startSpan,\n startSpanManual,\n} from '@sentry/core';\nimport type * as genericPool from './generic-pool-types';\n\nconst MODULE_NAME = 'generic-pool';\nconst PACKAGE_NAME = '@sentry/instrumentation-generic-pool';\n\ntype AcquireFn = (this: unknown, ...args: unknown[]) => unknown;\ninterface PoolConstructor {\n prototype: { acquire: AcquireFn };\n}\ninterface GenericPoolModule {\n Pool: PoolConstructor;\n}\n\nexport class GenericPoolInstrumentation extends InstrumentationBase {\n // only used for v2 - v2.3)\n private _isDisabled = false;\n\n constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n init() {\n return [\n new InstrumentationNodeModuleDefinition(\n MODULE_NAME,\n ['>=3.0.0 <4'],\n (moduleExports: GenericPoolModule) => {\n const Pool = moduleExports.Pool;\n if (isWrapped(Pool.prototype.acquire)) {\n this._unwrap(Pool.prototype, 'acquire');\n }\n this._wrap(Pool.prototype, 'acquire', this._acquirePatcher.bind(this));\n return moduleExports;\n },\n (moduleExports: GenericPoolModule) => {\n const Pool = moduleExports.Pool;\n this._unwrap(Pool.prototype, 'acquire');\n return moduleExports;\n },\n ),\n new InstrumentationNodeModuleDefinition(\n MODULE_NAME,\n ['>=2.4.0 <3'],\n (moduleExports: GenericPoolModule) => {\n const Pool = moduleExports.Pool;\n if (isWrapped(Pool.prototype.acquire)) {\n this._unwrap(Pool.prototype, 'acquire');\n }\n this._wrap(Pool.prototype, 'acquire', this._acquireWithCallbacksPatcher.bind(this));\n return moduleExports;\n },\n (moduleExports: GenericPoolModule) => {\n const Pool = moduleExports.Pool;\n this._unwrap(Pool.prototype, 'acquire');\n return moduleExports;\n },\n ),\n new InstrumentationNodeModuleDefinition(\n MODULE_NAME,\n ['>=2.0.0 <2.4'],\n (moduleExports: GenericPoolModule) => {\n this._isDisabled = false;\n if (isWrapped(moduleExports.Pool)) {\n this._unwrap(moduleExports, 'Pool');\n }\n this._wrap(moduleExports, 'Pool', this._poolWrapper.bind(this));\n return moduleExports;\n },\n (moduleExports: GenericPoolModule) => {\n // since the object is created on the fly every time, we need to use\n // a boolean switch here to disable the instrumentation\n this._isDisabled = true;\n return moduleExports;\n },\n ),\n ];\n }\n\n private _acquirePatcher(original: AcquireFn) {\n return function wrapped_acquire(this: genericPool.Pool<unknown>, ...args: unknown[]) {\n return startSpan(\n {\n name: 'generic-pool.acquire',\n attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.otel.generic_pool' },\n },\n () => {\n return original.call(this, ...args) as PromiseLike<unknown>;\n },\n );\n };\n }\n\n private _poolWrapper(original: (this: unknown, ...args: unknown[]) => { acquire: AcquireFn }) {\n const wrap = this._wrap.bind(this);\n const acquireWithCallbacksPatcher = this._acquireWithCallbacksPatcher.bind(this);\n return function wrapped_pool(this: unknown, ...args: unknown[]) {\n const pool = original.apply(this, args);\n wrap(pool, 'acquire', acquireWithCallbacksPatcher);\n return pool;\n };\n }\n\n private _acquireWithCallbacksPatcher(original: AcquireFn) {\n const isDisabled = (): boolean => this._isDisabled;\n return function wrapped_acquire(\n this: genericPool.Pool<unknown>,\n cb: (err: unknown, client: unknown) => unknown,\n priority: number,\n ) {\n // only used for v2 - v2.3\n if (isDisabled()) {\n return original.call(this, cb, priority);\n }\n\n return startSpanManual(\n {\n name: 'generic-pool.acquire',\n attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.otel.generic_pool' },\n },\n span => {\n original.call(\n this,\n (err: unknown, client: unknown) => {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n }\n span.end();\n // Not checking whether cb is a function because\n // the original code doesn't do that either.\n // The callback's return value is unused by generic-pool, so we don't return it.\n if (cb) {\n cb(err, client);\n }\n },\n priority,\n );\n },\n );\n };\n }\n}\n"],"names":[],"mappings":";;;AAqBA,MAAM,WAAA,GAAc,cAAA;AACpB,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AAA,WACF;AAAA,QACF;AAAA,OACF;AAAA,IACF,CAAA;AAAA,EACF;AACF;;;;"}
@@ -1,51 +1,12 @@
1
- import { SpanStatusCode } from '@opentelemetry/api';
2
1
  import { GraphQLInstrumentation } from './vendored/instrumentation.js';
3
- import { spanToJSON, getRootSpan, defineIntegration } from '@sentry/core';
4
- import { generateInstrumentOnce, addOriginToSpan } from '@sentry/node-core';
5
- import { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '@sentry/opentelemetry';
2
+ import { defineIntegration } from '@sentry/core';
3
+ import { generateInstrumentOnce } from '@sentry/node-core';
6
4
 
7
5
  const INTEGRATION_NAME = "Graphql";
8
6
  const instrumentGraphql = generateInstrumentOnce(
9
7
  INTEGRATION_NAME,
10
8
  GraphQLInstrumentation,
11
- (_options) => {
12
- const options = getOptionsWithDefaults(_options);
13
- return {
14
- ...options,
15
- responseHook(span, result) {
16
- addOriginToSpan(span, "auto.graphql.otel.graphql");
17
- const resultWithMaybeError = result;
18
- if (resultWithMaybeError.errors?.length && !spanToJSON(span).status) {
19
- span.setStatus({ code: SpanStatusCode.ERROR });
20
- }
21
- const attributes = spanToJSON(span).data;
22
- const operationType = attributes["graphql.operation.type"];
23
- const operationName = attributes["graphql.operation.name"];
24
- if (options.useOperationNameForRootSpan && operationType) {
25
- const rootSpan = getRootSpan(span);
26
- const rootSpanAttributes = spanToJSON(rootSpan).data;
27
- const existingOperations = rootSpanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION] || [];
28
- const newOperation = operationName ? `${operationType} ${operationName}` : `${operationType}`;
29
- if (Array.isArray(existingOperations)) {
30
- existingOperations.push(newOperation);
31
- rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, existingOperations);
32
- } else if (typeof existingOperations === "string") {
33
- rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, [existingOperations, newOperation]);
34
- } else {
35
- rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, newOperation);
36
- }
37
- if (!spanToJSON(rootSpan).data["original-description"]) {
38
- rootSpan.setAttribute("original-description", spanToJSON(rootSpan).description);
39
- }
40
- rootSpan.updateName(
41
- `${spanToJSON(rootSpan).data["original-description"]} (${getGraphqlOperationNamesFromAttribute(
42
- existingOperations
43
- )})`
44
- );
45
- }
46
- }
47
- };
48
- }
9
+ (_options) => getOptionsWithDefaults(_options)
49
10
  );
50
11
  const _graphqlIntegration = ((options = {}) => {
51
12
  return {
@@ -64,17 +25,6 @@ function getOptionsWithDefaults(options) {
64
25
  ...options
65
26
  };
66
27
  }
67
- function getGraphqlOperationNamesFromAttribute(attr) {
68
- if (Array.isArray(attr)) {
69
- const sorted = attr.slice().sort();
70
- if (sorted.length <= 5) {
71
- return sorted.join(", ");
72
- } else {
73
- return `${sorted.slice(0, 5).join(", ")}, +${sorted.length - 5}`;
74
- }
75
- }
76
- return `${attr}`;
77
- }
78
28
 
79
29
  export { graphqlIntegration, instrumentGraphql };
80
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/graphql/index.ts"],"sourcesContent":["import type { AttributeValue } from '@opentelemetry/api';\nimport { SpanStatusCode } from '@opentelemetry/api';\nimport { GraphQLInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, getRootSpan, spanToJSON } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '@sentry/opentelemetry';\n\ninterface GraphqlOptions {\n /**\n * Do not create spans for resolvers.\n *\n * Defaults to true.\n */\n ignoreResolveSpans?: boolean;\n\n /**\n * Don't create spans for the execution of the default resolver on object properties.\n *\n * When a resolver function is not defined on the schema for a field, graphql will\n * use the default resolver which just looks for a property with that name on the object.\n * If the property is not a function, it's not very interesting to trace.\n * This option can reduce noise and number of spans created.\n *\n * Defaults to true.\n */\n ignoreTrivialResolveSpans?: boolean;\n\n /**\n * If this is enabled, a http.server root span containing this span will automatically be renamed to include the operation name.\n * Set this to `false` if you do not want this behavior, and want to keep the default http.server span name.\n *\n * Defaults to true.\n */\n useOperationNameForRootSpan?: boolean;\n}\n\nconst INTEGRATION_NAME = 'Graphql';\n\nexport const instrumentGraphql = generateInstrumentOnce(\n INTEGRATION_NAME,\n GraphQLInstrumentation,\n (_options: GraphqlOptions) => {\n const options = getOptionsWithDefaults(_options);\n\n return {\n ...options,\n responseHook(span, result) {\n addOriginToSpan(span, 'auto.graphql.otel.graphql');\n\n // We want to ensure spans are marked as errored if there are errors in the result\n // We only do that if the span is not already marked with a status\n const resultWithMaybeError = result as { errors?: { message: string }[] };\n if (resultWithMaybeError.errors?.length && !spanToJSON(span).status) {\n span.setStatus({ code: SpanStatusCode.ERROR });\n }\n\n const attributes = spanToJSON(span).data;\n\n // If operation.name is not set, we fall back to use operation.type only\n const operationType = attributes['graphql.operation.type'];\n const operationName = attributes['graphql.operation.name'];\n\n if (options.useOperationNameForRootSpan && operationType) {\n const rootSpan = getRootSpan(span);\n const rootSpanAttributes = spanToJSON(rootSpan).data;\n\n const existingOperations = rootSpanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION] || [];\n\n const newOperation = operationName ? `${operationType} ${operationName}` : `${operationType}`;\n\n // We keep track of each operation on the root span\n // This can either be a string, or an array of strings (if there are multiple operations)\n if (Array.isArray(existingOperations)) {\n (existingOperations as string[]).push(newOperation);\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, existingOperations);\n } else if (typeof existingOperations === 'string') {\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, [existingOperations, newOperation]);\n } else {\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, newOperation);\n }\n\n if (!spanToJSON(rootSpan).data['original-description']) {\n rootSpan.setAttribute('original-description', spanToJSON(rootSpan).description);\n }\n // Important for e.g. @sentry/aws-serverless because this would otherwise overwrite the name again\n rootSpan.updateName(\n `${spanToJSON(rootSpan).data['original-description']} (${getGraphqlOperationNamesFromAttribute(\n existingOperations,\n )})`,\n );\n }\n },\n };\n },\n);\n\nconst _graphqlIntegration = ((options: GraphqlOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // We set defaults here, too, because otherwise we'd update the instrumentation config\n // to the config without defaults, as `generateInstrumentOnce` automatically calls `setConfig(options)`\n // when being called the second time\n instrumentGraphql(getOptionsWithDefaults(options));\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [graphql](https://www.npmjs.com/package/graphql) library.\n *\n * For more information, see the [`graphqlIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/graphql/).\n *\n * @param {GraphqlOptions} options Configuration options for the GraphQL integration.\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.graphqlIntegration()],\n * });\n */\nexport const graphqlIntegration = defineIntegration(_graphqlIntegration);\n\nfunction getOptionsWithDefaults(options?: GraphqlOptions): GraphqlOptions {\n return {\n ignoreResolveSpans: true,\n ignoreTrivialResolveSpans: true,\n useOperationNameForRootSpan: true,\n ...options,\n };\n}\n\n// copy from packages/opentelemetry/utils\nfunction getGraphqlOperationNamesFromAttribute(attr: AttributeValue): string {\n if (Array.isArray(attr)) {\n // oxlint-disable-next-line typescript/require-array-sort-compare\n const sorted = attr.slice().sort();\n\n // Up to 5 items, we just add all of them\n if (sorted.length <= 5) {\n return sorted.join(', ');\n } else {\n // Else, we add the first 5 and the diff of other operations\n return `${sorted.slice(0, 5).join(', ')}, +${sorted.length - 5}`;\n }\n }\n\n return `${attr}`;\n}\n"],"names":[],"mappings":";;;;;;AAqC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A,GAAS,IAAA,CAAK,KAAA,EAAM,CAAE,IAAA,EAAK;AAGjC,IAAA,IAAI,MAAA,CAAO,UAAU,CAAA,EAAG;AACtB,MAAA,OAAO,MAAA,CAAO,KAAK,IAAI,CAAA;AAAA,IACzB,CAAA,MAAO;AAEL,MAAA,OAAO,CAAA,EAAG,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,GAAA,EAAM,MAAA,CAAO,MAAA,GAAS,CAAC,CAAA,CAAA;AAAA,IAChE;AAAA,EACF;AAEA,EAAA,OAAO,GAAG,IAAI,CAAA,CAAA;AAChB;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/graphql/index.ts"],"sourcesContent":["import { GraphQLInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\ninterface GraphqlOptions {\n /**\n * Do not create spans for resolvers.\n *\n * Defaults to true.\n */\n ignoreResolveSpans?: boolean;\n\n /**\n * Don't create spans for the execution of the default resolver on object properties.\n *\n * When a resolver function is not defined on the schema for a field, graphql will\n * use the default resolver which just looks for a property with that name on the object.\n * If the property is not a function, it's not very interesting to trace.\n * This option can reduce noise and number of spans created.\n *\n * Defaults to true.\n */\n ignoreTrivialResolveSpans?: boolean;\n\n /**\n * If this is enabled, a http.server root span containing this span will automatically be renamed to include the operation name.\n * Set this to `false` if you do not want this behavior, and want to keep the default http.server span name.\n *\n * Defaults to true.\n */\n useOperationNameForRootSpan?: boolean;\n}\n\nconst INTEGRATION_NAME = 'Graphql';\n\nexport const instrumentGraphql = generateInstrumentOnce(\n INTEGRATION_NAME,\n GraphQLInstrumentation,\n (_options: GraphqlOptions) => getOptionsWithDefaults(_options),\n);\n\nconst _graphqlIntegration = ((options: GraphqlOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // We set defaults here, too, because otherwise we'd update the instrumentation config\n // to the config without defaults, as `generateInstrumentOnce` automatically calls `setConfig(options)`\n // when being called the second time\n instrumentGraphql(getOptionsWithDefaults(options));\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [graphql](https://www.npmjs.com/package/graphql) library.\n *\n * For more information, see the [`graphqlIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/graphql/).\n *\n * @param {GraphqlOptions} options Configuration options for the GraphQL integration.\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.graphqlIntegration()],\n * });\n */\nexport const graphqlIntegration = defineIntegration(_graphqlIntegration);\n\nfunction getOptionsWithDefaults(options?: GraphqlOptions): GraphqlOptions {\n return {\n ignoreResolveSpans: true,\n ignoreTrivialResolveSpans: true,\n useOperationNameForRootSpan: true,\n ...options,\n };\n}\n"],"names":[],"mappings":";;;;AAkCA,MAAM,gBAAA,GAAmB,SAAA;AAElB,MAAM,iBAAA,GAAoB,sBAAA;AAAA,EAC/B,gBAAA;AAAA,EACA,sBAAA;AAAA,EACA,CAAC,QAAA,KAA6B,sBAAA,CAAuB,QAAQ;AAC/D;AAEA,MAAM,mBAAA,IAAuB,CAAC,OAAA,GAA0B,EAAC,KAAM;AAC7D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAIV,MAAA,iBAAA,CAAkB,sBAAA,CAAuB,OAAO,CAAC,CAAA;AAAA,IACnD;AAAA,GACF;AACF,CAAA,CAAA;AAiBO,MAAM,kBAAA,GAAqB,kBAAkB,mBAAmB;AAEvE,SAAS,uBAAuB,OAAA,EAA0C;AACxE,EAAA,OAAO;AAAA,IACL,kBAAA,EAAoB,IAAA;AAAA,IACpB,yBAAA,EAA2B,IAAA;AAAA,IAC3B,2BAAA,EAA6B,IAAA;AAAA,IAC7B,GAAG;AAAA,GACL;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"enum.js","sources":["../../../../../../src/integrations/tracing/graphql/vendored/enum.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-graphql\n * - Upstream version: @opentelemetry/instrumentation-graphql@0.66.0\n */\n/* eslint-disable */\n\nexport enum AllowedOperationTypes {\n QUERY = 'query',\n MUTATION = 'mutation',\n SUBSCRIPTION = 'subscription',\n}\n\nexport enum TokenKind {\n SOF = '<SOF>',\n EOF = '<EOF>',\n BANG = '!',\n DOLLAR = '$',\n AMP = '&',\n PAREN_L = '(',\n PAREN_R = ')',\n SPREAD = '...',\n COLON = ':',\n EQUALS = '=',\n AT = '@',\n BRACKET_L = '[',\n BRACKET_R = ']',\n BRACE_L = '{',\n PIPE = '|',\n BRACE_R = '}',\n NAME = 'Name',\n INT = 'Int',\n FLOAT = 'Float',\n STRING = 'String',\n BLOCK_STRING = 'BlockString',\n COMMENT = 'Comment',\n}\n\nexport enum SpanNames {\n EXECUTE = 'graphql.execute',\n PARSE = 'graphql.parse',\n RESOLVE = 'graphql.resolve',\n VALIDATE = 'graphql.validate',\n SCHEMA_VALIDATE = 'graphql.validateSchema',\n SCHEMA_PARSE = 'graphql.parseSchema',\n}\n"],"names":["AllowedOperationTypes","TokenKind","SpanNames"],"mappings":"AAqBO,IAAK,qBAAA,qBAAAA,sBAAAA,KAAL;AACL,EAAAA,uBAAA,OAAA,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UAAAA,KAAL;AACL,EAAAA,WAAA,SAAA,CAAA,GAAU,iBAAA;AACV,EAAAA,WAAA,OAAA,CAAA,GAAQ,eAAA;AACR,EAAAA,WAAA,SAAA,CAAA,GAAU,iBAAA;AACV,EAAAA,WAAA,UAAA,CAAA,GAAW,kBAAA;AACX,EAAAA,WAAA,iBAAA,CAAA,GAAkB,wBAAA;AAClB,EAAAA,WAAA,cAAA,CAAA,GAAe,qBAAA;AANL,EAAA,OAAAA,UAAAA;AAAA,CAAA,EAAA,SAAA,IAAA,EAAA;;;;"}
1
+ {"version":3,"file":"enum.js","sources":["../../../../../../src/integrations/tracing/graphql/vendored/enum.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-graphql\n * - Upstream version: @opentelemetry/instrumentation-graphql@0.66.0\n */\n\nexport enum AllowedOperationTypes {\n QUERY = 'query',\n MUTATION = 'mutation',\n SUBSCRIPTION = 'subscription',\n}\n\nexport enum TokenKind {\n SOF = '<SOF>',\n EOF = '<EOF>',\n BANG = '!',\n DOLLAR = '$',\n AMP = '&',\n PAREN_L = '(',\n PAREN_R = ')',\n SPREAD = '...',\n COLON = ':',\n EQUALS = '=',\n AT = '@',\n BRACKET_L = '[',\n BRACKET_R = ']',\n BRACE_L = '{',\n PIPE = '|',\n BRACE_R = '}',\n NAME = 'Name',\n INT = 'Int',\n FLOAT = 'Float',\n STRING = 'String',\n BLOCK_STRING = 'BlockString',\n COMMENT = 'Comment',\n}\n\nexport enum SpanNames {\n EXECUTE = 'graphql.execute',\n PARSE = 'graphql.parse',\n RESOLVE = 'graphql.resolve',\n VALIDATE = 'graphql.validate',\n SCHEMA_VALIDATE = 'graphql.validateSchema',\n SCHEMA_PARSE = 'graphql.parseSchema',\n}\n"],"names":["AllowedOperationTypes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AtBA,EAAA,OAAAA,UAAAA;AAAA,CAAA,EAAA,SAAA,IAAA,EAAA;AAyBL,IAAK,SAAA,qBAAAC,UAAAA,KAAL;AACL,EAAAA,WAAA,SAAA,CAAA,GAAU,iBAAA;AACV,EAAAA,WAAA,OAAA,CAAA,GAAQ,eAAA;AACR,EAAAA,WAAA,SAAA,CAAA,GAAU,iBAAA;AACV,EAAAA,WAAA,UAAA,CAAA,GAAW,kBAAA;AACX,EAAAA,WAAA,iBAAA,CAAA,GAAkB,wBAAA;AAClB,EAAAA,WAAA,cAAA,CAAA,GAAe,qBAAA;AANL,EAAA,OAAAA,UAAAA;AAAA,CAAA,EAAA,SAAA,IAAA,EAAA;;;;"}
@@ -6,8 +6,6 @@ var AttributeNames = /* @__PURE__ */ ((AttributeNames2) => {
6
6
  AttributeNames2["PARENT_NAME"] = "graphql.parent.name";
7
7
  AttributeNames2["OPERATION_TYPE"] = "graphql.operation.type";
8
8
  AttributeNames2["OPERATION_NAME"] = "graphql.operation.name";
9
- AttributeNames2["VARIABLES"] = "graphql.variables.";
10
- AttributeNames2["ERROR_VALIDATION_NAME"] = "graphql.validation.error";
11
9
  return AttributeNames2;
12
10
  })(AttributeNames || {});
13
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"AttributeNames.js","sources":["../../../../../../../src/integrations/tracing/graphql/vendored/enums/AttributeNames.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-graphql\n * - Upstream version: @opentelemetry/instrumentation-graphql@0.66.0\n */\n/* eslint-disable */\n\nexport enum AttributeNames {\n SOURCE = 'graphql.source',\n FIELD_NAME = 'graphql.field.name',\n FIELD_PATH = 'graphql.field.path',\n FIELD_TYPE = 'graphql.field.type',\n PARENT_NAME = 'graphql.parent.name',\n OPERATION_TYPE = 'graphql.operation.type',\n OPERATION_NAME = 'graphql.operation.name',\n VARIABLES = 'graphql.variables.',\n ERROR_VALIDATION_NAME = 'graphql.validation.error',\n}\n"],"names":["AttributeNames"],"mappings":"AAqBO,IAAK,cAAA,qBAAAA,eAAAA,KAAL;AACL,EAAAA,gBAAA,QAAA,CAAA,GAAS,gBAAA;AACT,EAAAA,gBAAA,YAAA,CAAA,GAAa,oBAAA;AACb,EAAAA,gBAAA,YAAA,CAAA,GAAa,oBAAA;AACb,EAAAA,gBAAA,YAAA,CAAA,GAAa,oBAAA;AACb,EAAAA,gBAAA,aAAA,CAAA,GAAc,qBAAA;AACd,EAAAA,gBAAA,gBAAA,CAAA,GAAiB,wBAAA;AACjB,EAAAA,gBAAA,gBAAA,CAAA,GAAiB,wBAAA;AACjB,EAAAA,gBAAA,WAAA,CAAA,GAAY,oBAAA;AACZ,EAAAA,gBAAA,uBAAA,CAAA,GAAwB,0BAAA;AATd,EAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;;;;"}
1
+ {"version":3,"file":"AttributeNames.js","sources":["../../../../../../../src/integrations/tracing/graphql/vendored/enums/AttributeNames.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-graphql\n * - Upstream version: @opentelemetry/instrumentation-graphql@0.66.0\n */\n\nexport enum AttributeNames {\n SOURCE = 'graphql.source',\n FIELD_NAME = 'graphql.field.name',\n FIELD_PATH = 'graphql.field.path',\n FIELD_TYPE = 'graphql.field.type',\n PARENT_NAME = 'graphql.parent.name',\n OPERATION_TYPE = 'graphql.operation.type',\n OPERATION_NAME = 'graphql.operation.name',\n}\n"],"names":["AttributeNames"],"mappings":"AASO,IAAK,cAAA,qBAAAA,eAAAA,KAAL;AACL,EAAAA,gBAAA,QAAA,CAAA,GAAS,gBAAA;AACT,EAAAA,gBAAA,YAAA,CAAA,GAAa,oBAAA;AACb,EAAAA,gBAAA,YAAA,CAAA,GAAa,oBAAA;AACb,EAAAA,gBAAA,YAAA,CAAA,GAAa,oBAAA;AACb,EAAAA,gBAAA,aAAA,CAAA,GAAc,qBAAA;AACd,EAAAA,gBAAA,gBAAA,CAAA,GAAiB,wBAAA;AACjB,EAAAA,gBAAA,gBAAA,CAAA,GAAiB,wBAAA;AAPP,EAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;;;;"}
@@ -1,18 +1,16 @@
1
- import { context, trace } from '@opentelemetry/api';
2
1
  import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped, safeExecuteInTheMiddle } from '@opentelemetry/instrumentation';
3
2
  import { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile.js';
4
3
  import { SpanNames } from './enum.js';
5
4
  import { AttributeNames } from './enums/AttributeNames.js';
6
5
  import { OTEL_GRAPHQL_DATA_SYMBOL } from './symbols.js';
7
6
  import { OPERATION_NOT_SUPPORTED } from './internal-types.js';
8
- import { getOperation, endSpan, isPromise, addSpanSource, addInputVariableAttributes, wrapFieldResolver, wrapFields } from './utils.js';
9
- import { SDK_VERSION } from '@sentry/core';
7
+ import { getOperation, endSpan, isPromise, addSpanSource, wrapFieldResolver, wrapFields } from './utils.js';
8
+ import { SDK_VERSION, withActiveSpan, spanToJSON, SPAN_STATUS_ERROR, getRootSpan, startInactiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
9
+ import { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '@sentry/opentelemetry';
10
10
 
11
11
  const PACKAGE_NAME = "@sentry/instrumentation-graphql";
12
+ const ORIGIN = "auto.graphql.otel.graphql";
12
13
  const DEFAULT_CONFIG = {
13
- mergeItems: false,
14
- depth: -1,
15
- allowValues: false,
16
14
  ignoreResolveSpans: false
17
15
  };
18
16
  const supportedVersions = [">=14.0.0 <17"];
@@ -125,7 +123,7 @@ class GraphQLInstrumentation extends InstrumentationBase {
125
123
  span,
126
124
  fields: {}
127
125
  };
128
- return context.with(trace.setSpan(context.active(), span), () => {
126
+ return withActiveSpan(span, () => {
129
127
  return safeExecuteInTheMiddle(
130
128
  () => {
131
129
  return original.apply(this, [processedArgs]);
@@ -139,7 +137,6 @@ class GraphQLInstrumentation extends InstrumentationBase {
139
137
  };
140
138
  }
141
139
  _handleExecutionResult(span, err, result) {
142
- const config = this.getConfig();
143
140
  if (result === void 0 || err) {
144
141
  endSpan(span, err);
145
142
  return;
@@ -147,40 +144,55 @@ class GraphQLInstrumentation extends InstrumentationBase {
147
144
  if (isPromise(result)) {
148
145
  result.then(
149
146
  (resultData) => {
150
- if (typeof config.responseHook !== "function") {
151
- endSpan(span);
152
- return;
153
- }
154
- this._executeResponseHook(span, resultData);
147
+ this._updateSpanFromResult(span, resultData);
148
+ endSpan(span);
155
149
  },
156
150
  (error) => {
157
151
  endSpan(span, error);
158
152
  }
159
153
  );
160
154
  } else {
161
- if (typeof config.responseHook !== "function") {
162
- endSpan(span);
163
- return;
164
- }
165
- this._executeResponseHook(span, result);
155
+ this._updateSpanFromResult(span, result);
156
+ endSpan(span);
166
157
  }
167
158
  }
168
- _executeResponseHook(span, result) {
169
- const { responseHook } = this.getConfig();
170
- if (!responseHook) {
159
+ /**
160
+ * Applies Sentry-specific span mutations based on the GraphQL execution result:
161
+ * - Marks the execute span as errored if the result contains errors (and no status was set yet)
162
+ * - Optionally renames the containing root span to include the GraphQL operation name(s)
163
+ */
164
+ _updateSpanFromResult(span, result) {
165
+ if (result.errors?.length && !spanToJSON(span).status) {
166
+ span.setStatus({ code: SPAN_STATUS_ERROR });
167
+ }
168
+ if (!this.getConfig().useOperationNameForRootSpan) {
171
169
  return;
172
170
  }
173
- safeExecuteInTheMiddle(
174
- () => {
175
- responseHook(span, result);
176
- },
177
- (err) => {
178
- if (err) {
179
- this._diag.error("Error running response hook", err);
180
- }
181
- endSpan(span, void 0);
182
- },
183
- true
171
+ const attributes = spanToJSON(span).data;
172
+ const operationType = attributes[AttributeNames.OPERATION_TYPE];
173
+ const operationName = attributes[AttributeNames.OPERATION_NAME];
174
+ if (!operationType) {
175
+ return;
176
+ }
177
+ const rootSpan = getRootSpan(span);
178
+ const rootSpanAttributes = spanToJSON(rootSpan).data;
179
+ const existingOperations = rootSpanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION] || [];
180
+ const newOperation = operationName ? `${operationType} ${operationName}` : `${operationType}`;
181
+ if (Array.isArray(existingOperations)) {
182
+ existingOperations.push(newOperation);
183
+ rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, existingOperations);
184
+ } else if (typeof existingOperations === "string") {
185
+ rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, [existingOperations, newOperation]);
186
+ } else {
187
+ rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, newOperation);
188
+ }
189
+ if (!spanToJSON(rootSpan).data["original-description"]) {
190
+ rootSpan.setAttribute("original-description", spanToJSON(rootSpan).description);
191
+ }
192
+ rootSpan.updateName(
193
+ `${spanToJSON(rootSpan).data["original-description"]} (${getGraphqlOperationNamesFromAttribute(
194
+ existingOperations
195
+ )})`
184
196
  );
185
197
  }
186
198
  _patchParse() {
@@ -200,9 +212,8 @@ class GraphQLInstrumentation extends InstrumentationBase {
200
212
  };
201
213
  }
202
214
  _parse(obj, original, source, options) {
203
- const config = this.getConfig();
204
- const span = this.tracer.startSpan(SpanNames.PARSE);
205
- return context.with(trace.setSpan(context.active(), span), () => {
215
+ const span = startInactiveSpan({ name: SpanNames.PARSE });
216
+ return withActiveSpan(span, () => {
206
217
  return safeExecuteInTheMiddle(
207
218
  () => {
208
219
  return original.call(obj, source, options);
@@ -213,7 +224,7 @@ class GraphQLInstrumentation extends InstrumentationBase {
213
224
  if (!operation) {
214
225
  span.updateName(SpanNames.SCHEMA_PARSE);
215
226
  } else if (result.loc) {
216
- addSpanSource(span, result.loc, config.allowValues);
227
+ addSpanSource(span, result.loc);
217
228
  }
218
229
  }
219
230
  endSpan(span, err);
@@ -222,30 +233,26 @@ class GraphQLInstrumentation extends InstrumentationBase {
222
233
  });
223
234
  }
224
235
  _validate(obj, original, schema, documentAST, rules, typeInfo, options) {
225
- const span = this.tracer.startSpan(SpanNames.VALIDATE, {});
226
- return context.with(trace.setSpan(context.active(), span), () => {
236
+ const span = startInactiveSpan({ name: SpanNames.VALIDATE });
237
+ return withActiveSpan(span, () => {
227
238
  return safeExecuteInTheMiddle(
228
239
  () => {
229
240
  return original.call(obj, schema, documentAST, rules, options, typeInfo);
230
241
  },
231
- (err, errors) => {
242
+ (err, _errors) => {
232
243
  if (!documentAST.loc) {
233
244
  span.updateName(SpanNames.SCHEMA_VALIDATE);
234
245
  }
235
- if (errors && errors.length) {
236
- span.recordException({
237
- name: AttributeNames.ERROR_VALIDATION_NAME,
238
- message: JSON.stringify(errors)
239
- });
240
- }
241
246
  endSpan(span, err);
242
247
  }
243
248
  );
244
249
  });
245
250
  }
246
251
  _createExecuteSpan(operation, processedArgs) {
247
- const config = this.getConfig();
248
- const span = this.tracer.startSpan(SpanNames.EXECUTE, {});
252
+ const span = startInactiveSpan({
253
+ name: SpanNames.EXECUTE,
254
+ attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN }
255
+ });
249
256
  if (operation) {
250
257
  const { operation: operationType, name: nameNode } = operation;
251
258
  span.setAttribute(AttributeNames.OPERATION_TYPE, operationType);
@@ -265,10 +272,7 @@ class GraphQLInstrumentation extends InstrumentationBase {
265
272
  span.setAttribute(AttributeNames.OPERATION_NAME, operationName);
266
273
  }
267
274
  if (processedArgs.document?.loc) {
268
- addSpanSource(span, processedArgs.document.loc, config.allowValues);
269
- }
270
- if (processedArgs.variableValues && config.allowValues) {
271
- addInputVariableAttributes(span, processedArgs.variableValues);
275
+ addSpanSource(span, processedArgs.document.loc);
272
276
  }
273
277
  return span;
274
278
  }
@@ -290,15 +294,10 @@ class GraphQLInstrumentation extends InstrumentationBase {
290
294
  }
291
295
  const isUsingDefaultResolver = fieldResolver == null;
292
296
  const fieldResolverForExecute = fieldResolver ?? defaultFieldResolved;
293
- fieldResolver = wrapFieldResolver(
294
- this.tracer,
295
- () => this.getConfig(),
296
- fieldResolverForExecute,
297
- isUsingDefaultResolver
298
- );
297
+ fieldResolver = wrapFieldResolver(() => this.getConfig(), fieldResolverForExecute, isUsingDefaultResolver);
299
298
  if (schema) {
300
- wrapFields(schema.getQueryType(), this.tracer, () => this.getConfig());
301
- wrapFields(schema.getMutationType(), this.tracer, () => this.getConfig());
299
+ wrapFields(schema.getQueryType(), () => this.getConfig());
300
+ wrapFields(schema.getMutationType(), () => this.getConfig());
302
301
  }
303
302
  return {
304
303
  schema,
@@ -312,6 +311,17 @@ class GraphQLInstrumentation extends InstrumentationBase {
312
311
  };
313
312
  }
314
313
  }
314
+ function getGraphqlOperationNamesFromAttribute(attr) {
315
+ if (Array.isArray(attr)) {
316
+ const sorted = attr.slice().sort();
317
+ if (sorted.length <= 5) {
318
+ return sorted.join(", ");
319
+ } else {
320
+ return `${sorted.slice(0, 5).join(", ")}, +${sorted.length - 5}`;
321
+ }
322
+ }
323
+ return `${attr}`;
324
+ }
315
325
 
316
326
  export { GraphQLInstrumentation };
317
327
  //# sourceMappingURL=instrumentation.js.map