@burdenoff/be-sdk 2026.1110.1 → 2026.1110.3

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 (469) hide show
  1. package/configs/eslint/index.js +1 -1
  2. package/configs/tsconfig/tsconfig.json +1 -1
  3. package/dist/EventQueueFactory-9NGZV9jl.js +1457 -0
  4. package/dist/EventQueueFactory-9NGZV9jl.js.map +1 -0
  5. package/dist/RedisStreamsConnection-CY8WySJy.js +283 -0
  6. package/dist/RedisStreamsConnection-CY8WySJy.js.map +1 -0
  7. package/dist/ai-credits/index.d.ts +2 -3
  8. package/dist/ai-credits/index.js +3 -4
  9. package/dist/ai-credits/index.js.map +1 -1
  10. package/dist/ai-credits-Ca-NNcVx.js +546 -0
  11. package/dist/ai-credits-Ca-NNcVx.js.map +1 -0
  12. package/dist/{assistant-session-CJZhF4D6.d.ts → assistant-session-DA5ZKJOr.d.ts} +4 -5
  13. package/dist/auth/index.d.ts +2 -77
  14. package/dist/auth/index.js +3 -7
  15. package/dist/auth/index.js.map +1 -1
  16. package/dist/auth-CEuBEBQN.js +228 -0
  17. package/dist/auth-CEuBEBQN.js.map +1 -0
  18. package/dist/cache/index.d.ts +2 -3
  19. package/dist/cache/index.js +3 -7
  20. package/dist/cache/index.js.map +1 -1
  21. package/dist/cache-CU0uLwcS.js +1837 -0
  22. package/dist/cache-CU0uLwcS.js.map +1 -0
  23. package/dist/captcha/index.d.ts +2 -1
  24. package/dist/captcha/index.js +3 -3
  25. package/dist/captcha/index.js.map +1 -1
  26. package/dist/captcha-BT7yh1YS.js +77 -0
  27. package/dist/captcha-BT7yh1YS.js.map +1 -0
  28. package/dist/client/internal-client.d.ts +4 -7
  29. package/dist/client/internal-client.js +172 -4
  30. package/dist/client/internal-client.js.map +1 -1
  31. package/dist/client-BgAEvDC2.d.ts +86 -0
  32. package/dist/client-DcZ3iGES.js +565 -0
  33. package/dist/client-DcZ3iGES.js.map +1 -0
  34. package/dist/collector-endpoint-iyQYeI50.js +50 -0
  35. package/dist/collector-endpoint-iyQYeI50.js.map +1 -0
  36. package/dist/context-CZnXf2yb.js +247 -0
  37. package/dist/context-CZnXf2yb.js.map +1 -0
  38. package/dist/crypto/index.d.ts +2 -1
  39. package/dist/crypto/index.js +3 -3
  40. package/dist/crypto/index.js.map +1 -1
  41. package/dist/crypto-DO9fM0FO.js +145 -0
  42. package/dist/crypto-DO9fM0FO.js.map +1 -0
  43. package/dist/database/index.d.ts +104 -108
  44. package/dist/database/index.js +468 -6
  45. package/dist/database/index.js.map +1 -1
  46. package/dist/dataloader/index.d.ts +2 -1
  47. package/dist/dataloader/index.js +3 -3
  48. package/dist/dataloader/index.js.map +1 -1
  49. package/dist/dataloader-DwpT3YoS.js +294 -0
  50. package/dist/dataloader-DwpT3YoS.js.map +1 -0
  51. package/dist/deployed-environment-p_Tdl3sT.js +38 -0
  52. package/dist/deployed-environment-p_Tdl3sT.js.map +1 -0
  53. package/dist/dist-BGKdXVy3.js +1718 -0
  54. package/dist/dist-BGKdXVy3.js.map +1 -0
  55. package/dist/env-DdaoGjIt.js +74 -0
  56. package/dist/env-DdaoGjIt.js.map +1 -0
  57. package/dist/event-queue/index.d.ts +2 -7
  58. package/dist/event-queue/index.js +7 -9
  59. package/dist/event-queue/index.js.map +1 -1
  60. package/dist/event-queue-Cw-YJPY_.js +1384 -0
  61. package/dist/event-queue-Cw-YJPY_.js.map +1 -0
  62. package/dist/{explicit-activity-scope-CCoxVwAr.d.ts → explicit-activity-scope-D8VeGGpt.d.ts} +1 -2
  63. package/dist/export/index.d.ts +2 -2
  64. package/dist/export/index.js +3 -14
  65. package/dist/export/index.js.map +1 -1
  66. package/dist/export-B6fphx8a.js +642 -0
  67. package/dist/export-B6fphx8a.js.map +1 -0
  68. package/dist/feature-flags/index.d.ts +2 -10
  69. package/dist/feature-flags/index.js +3 -6
  70. package/dist/feature-flags/index.js.map +1 -1
  71. package/dist/feature-flags-71oDkrUe.js +422 -0
  72. package/dist/feature-flags-71oDkrUe.js.map +1 -0
  73. package/dist/files/index.d.ts +2 -3
  74. package/dist/files/index.js +3 -4
  75. package/dist/files/index.js.map +1 -1
  76. package/dist/files-DjH0099H.js +830 -0
  77. package/dist/files-DjH0099H.js.map +1 -0
  78. package/dist/gateway/index.d.ts +4 -6
  79. package/dist/gateway/index.js +7 -13
  80. package/dist/gateway/index.js.map +1 -1
  81. package/dist/gateway/security/index.d.ts +2 -2
  82. package/dist/gateway/security/index.js +3 -5
  83. package/dist/gateway/security/index.js.map +1 -1
  84. package/dist/gateway-DBFmxWks.js +50 -0
  85. package/dist/gateway-DBFmxWks.js.map +1 -0
  86. package/dist/graph/index.d.ts +3 -10
  87. package/dist/graph/index.js +4 -13
  88. package/dist/graph/index.js.map +1 -1
  89. package/dist/graph-DDYgIryR.js +2152 -0
  90. package/dist/graph-DDYgIryR.js.map +1 -0
  91. package/dist/graph-emitter-CdOXP7Tn.js +621 -0
  92. package/dist/graph-emitter-CdOXP7Tn.js.map +1 -0
  93. package/dist/graphql/index.d.ts +3 -2
  94. package/dist/graphql/index.js +4 -6
  95. package/dist/graphql/index.js.map +1 -1
  96. package/dist/graphql/services/index.d.ts +2 -24
  97. package/dist/graphql/services/index.js +3 -4
  98. package/dist/graphql/services/index.js.map +1 -1
  99. package/dist/graphql-DHAHHcww.js +161 -0
  100. package/dist/graphql-DHAHHcww.js.map +1 -0
  101. package/dist/graphql-DNkMkGBZ.d.ts +21 -0
  102. package/dist/i18n/index.d.ts +3 -3
  103. package/dist/i18n/index.js +3 -4
  104. package/dist/i18n/index.js.map +1 -1
  105. package/dist/i18n-BBMYFd0P.js +860 -0
  106. package/dist/i18n-BBMYFd0P.js.map +1 -0
  107. package/dist/import-optional-peer-B82VYxeX.js +18 -0
  108. package/dist/import-optional-peer-B82VYxeX.js.map +1 -0
  109. package/dist/index-3KOZ1zN9.d.ts +233 -0
  110. package/dist/index-BBqooJ52.d.ts +45 -0
  111. package/dist/index-BGzMYJsm.d.ts +209 -0
  112. package/dist/index-BKwHQtHQ.d.ts +63 -0
  113. package/dist/index-BMIMnp6T.d.ts +8 -0
  114. package/dist/index-BQDsNAMR.d.ts +81 -0
  115. package/dist/index-BVOL7458.d.ts +10 -0
  116. package/dist/index-BcqQs-Uq.d.ts +69 -0
  117. package/dist/index-BeVtqGO-.d.ts +208 -0
  118. package/dist/index-BiTzGUZP.d.ts +114 -0
  119. package/dist/index-BqYfCQSP.d.ts +500 -0
  120. package/dist/index-C0qLquY0.d.ts +150 -0
  121. package/dist/index-C5uEKchX.d.ts +60 -0
  122. package/dist/index-CDOqxSIi.d.ts +37 -0
  123. package/dist/index-CG6wj66Y.d.ts +148 -0
  124. package/dist/index-CIgoeobA.d.ts +145 -0
  125. package/dist/index-CPQDMSFS.d.ts +103 -0
  126. package/dist/index-CSRcgkVi.d.ts +23 -0
  127. package/dist/index-CZTnQIRU.d.ts +341 -0
  128. package/dist/index-CaM9JUcc.d.ts +144 -0
  129. package/dist/index-CkT2aUr3.d.ts +704 -0
  130. package/dist/index-CliOgq6L.d.ts +203 -0
  131. package/dist/index-CnzbJZP7.d.ts +999 -0
  132. package/dist/index-D6UeLAye.d.ts +63 -0
  133. package/dist/index-DGgh9DWn.d.ts +59 -0
  134. package/dist/index-DY3dNhMN.d.ts +420 -0
  135. package/dist/index-DZC-2o9R.d.ts +207 -0
  136. package/dist/index-DqbGqfAy.d.ts +127 -0
  137. package/dist/index-Dt1HJPTX.d.ts +12 -0
  138. package/dist/index-DtI6aBtB.d.ts +22 -0
  139. package/dist/index-FKohsiex.d.ts +38 -0
  140. package/dist/index-FbXPfen7.d.ts +132 -0
  141. package/dist/index-MArCb8Aq.d.ts +306 -0
  142. package/dist/index-N-huORcj.d.ts +303 -0
  143. package/dist/index-YOShAwkq.d.ts +45 -0
  144. package/dist/index-bZKZUvBu.d.ts +646 -0
  145. package/dist/index-yBSjMY32.d.ts +24 -0
  146. package/dist/index.d.ts +501 -544
  147. package/dist/index.js +1820 -2171
  148. package/dist/index.js.map +1 -1
  149. package/dist/init/index.d.ts +2 -2
  150. package/dist/init/index.js +3 -16
  151. package/dist/init/index.js.map +1 -1
  152. package/dist/init-Dy3KhT6Y.js +325 -0
  153. package/dist/init-Dy3KhT6Y.js.map +1 -0
  154. package/dist/instrumentation/index.d.ts +3 -4
  155. package/dist/instrumentation/index.js +5 -5
  156. package/dist/instrumentation/index.js.map +1 -1
  157. package/dist/instrumentation-xkkmDgJ0.js +1678 -0
  158. package/dist/instrumentation-xkkmDgJ0.js.map +1 -0
  159. package/dist/lake/index.d.ts +50 -54
  160. package/dist/lake/index.js +169 -193
  161. package/dist/lake/index.js.map +1 -1
  162. package/dist/layer/index.d.ts +3 -2
  163. package/dist/layer/index.js +4 -5
  164. package/dist/layer/index.js.map +1 -1
  165. package/dist/layer-BZBZZWeV.d.ts +69 -0
  166. package/dist/layer-Bcix-WCl.js +105 -0
  167. package/dist/layer-Bcix-WCl.js.map +1 -0
  168. package/dist/layer-CEKy6cm8.js +252 -0
  169. package/dist/layer-CEKy6cm8.js.map +1 -0
  170. package/dist/lifecycle/index.d.ts +2 -1
  171. package/dist/lifecycle/index.js +3 -4
  172. package/dist/lifecycle/index.js.map +1 -1
  173. package/dist/lifecycle-DeoLSX0U.js +76 -0
  174. package/dist/lifecycle-DeoLSX0U.js.map +1 -0
  175. package/dist/logger/index.d.ts +2 -3
  176. package/dist/logger/index.js +3 -3
  177. package/dist/logger/index.js.map +1 -1
  178. package/dist/logger-B6rCpb7D.js +290 -0
  179. package/dist/logger-B6rCpb7D.js.map +1 -0
  180. package/dist/metrics/index.d.ts +13 -14
  181. package/dist/metrics/index.js +3 -4
  182. package/dist/metrics/index.js.map +1 -1
  183. package/dist/metrics-BrLwNUrb.js +52 -0
  184. package/dist/metrics-BrLwNUrb.js.map +1 -0
  185. package/dist/metrics-collector-C2eShrlW.js +922 -0
  186. package/dist/metrics-collector-C2eShrlW.js.map +1 -0
  187. package/dist/middleware/index.d.ts +3 -3
  188. package/dist/middleware/index.js +3 -4
  189. package/dist/middleware/index.js.map +1 -1
  190. package/dist/middleware-CUxJVUpD.js +1243 -0
  191. package/dist/middleware-CUxJVUpD.js.map +1 -0
  192. package/dist/middleware-Cq0zFMGp.js +253 -0
  193. package/dist/middleware-Cq0zFMGp.js.map +1 -0
  194. package/dist/notifications/index.d.ts +2 -5
  195. package/dist/notifications/index.js +3 -6
  196. package/dist/notifications/index.js.map +1 -1
  197. package/dist/notifications-CdETrtFK.js +869 -0
  198. package/dist/notifications-CdETrtFK.js.map +1 -0
  199. package/dist/observability/index.d.ts +2 -3
  200. package/dist/observability/index.js +3 -4
  201. package/dist/observability/index.js.map +1 -1
  202. package/dist/observability-DBDXipTU.js +272 -0
  203. package/dist/observability-DBDXipTU.js.map +1 -0
  204. package/dist/platform/index.d.ts +2 -1
  205. package/dist/platform/index.js +3 -5
  206. package/dist/platform/index.js.map +1 -1
  207. package/dist/platform-DZwczW7v.js +1510 -0
  208. package/dist/platform-DZwczW7v.js.map +1 -0
  209. package/dist/prisma/generator/index.d.ts +1 -1
  210. package/dist/prisma/generator/index.js +97 -84
  211. package/dist/prisma/generator/index.js.map +1 -1
  212. package/dist/prisma/index.d.ts +4 -7
  213. package/dist/prisma/index.js +5 -12
  214. package/dist/prisma/index.js.map +1 -1
  215. package/dist/prisma-BzOOdt79.js +863 -0
  216. package/dist/prisma-BzOOdt79.js.map +1 -0
  217. package/dist/prisma-extension-Cfl09swM.d.ts +172 -0
  218. package/dist/product-alias/index.d.ts +2 -1
  219. package/dist/product-alias/index.js +3 -3
  220. package/dist/product-alias/index.js.map +1 -1
  221. package/dist/product-alias-BPqtskMq.js +273 -0
  222. package/dist/product-alias-BPqtskMq.js.map +1 -0
  223. package/dist/rbac/index.d.ts +2 -122
  224. package/dist/rbac/index.js +3 -6
  225. package/dist/rbac/index.js.map +1 -1
  226. package/dist/rbac-BB9l9Xph.js +1486 -0
  227. package/dist/rbac-BB9l9Xph.js.map +1 -0
  228. package/dist/resource-caps/index.d.ts +66 -72
  229. package/dist/resource-caps/index.js +430 -5
  230. package/dist/resource-caps/index.js.map +1 -1
  231. package/dist/rolldown-runtime-ad2WFvuA.js +17 -0
  232. package/dist/sdk-Dju9o-sq.js +124 -0
  233. package/dist/sdk-Dju9o-sq.js.map +1 -0
  234. package/dist/security-DIG-95Ic.js +1647 -0
  235. package/dist/security-DIG-95Ic.js.map +1 -0
  236. package/dist/server/index.d.ts +7 -164
  237. package/dist/server/index.js +2000 -1507
  238. package/dist/server/index.js.map +1 -1
  239. package/dist/service-jwt-Bu-WNA_-.js +80 -0
  240. package/dist/service-jwt-Bu-WNA_-.js.map +1 -0
  241. package/dist/services-BWzfz7vG.js +102 -0
  242. package/dist/services-BWzfz7vG.js.map +1 -0
  243. package/dist/sharding/index.d.ts +41 -44
  244. package/dist/sharding/index.js +156 -137
  245. package/dist/sharding/index.js.map +1 -1
  246. package/dist/sharing/index.d.ts +2 -1
  247. package/dist/sharing/index.js +3 -4
  248. package/dist/sharing/index.js.map +1 -1
  249. package/dist/sharing-CflDsSJ-.js +911 -0
  250. package/dist/sharing-CflDsSJ-.js.map +1 -0
  251. package/dist/stub-BqwKn4eh.js +630 -0
  252. package/dist/stub-BqwKn4eh.js.map +1 -0
  253. package/dist/tags/index.d.ts +2 -3
  254. package/dist/tags/index.js +3 -4
  255. package/dist/tags/index.js.map +1 -1
  256. package/dist/tags-B5xpbgsk.js +868 -0
  257. package/dist/{chunk-PBZFAAOM.js.map → tags-B5xpbgsk.js.map} +1 -1
  258. package/dist/telemetry/index.d.ts +64 -76
  259. package/dist/telemetry/index.js +369 -201
  260. package/dist/telemetry/index.js.map +1 -1
  261. package/dist/temporal/index.d.ts +2 -148
  262. package/dist/temporal/index.js +3 -5
  263. package/dist/temporal/index.js.map +1 -1
  264. package/dist/temporal-B534uYK8.js +706 -0
  265. package/dist/temporal-B534uYK8.js.map +1 -0
  266. package/dist/tracker/index.d.ts +5 -11
  267. package/dist/tracker/index.js +5 -20
  268. package/dist/tracker/index.js.map +1 -1
  269. package/dist/tracker-BQVoEFUo.js +839 -0
  270. package/dist/tracker-BQVoEFUo.js.map +1 -0
  271. package/dist/types-BYMYND1L.js +44 -0
  272. package/dist/types-BYMYND1L.js.map +1 -0
  273. package/dist/types-C6EKaS3V.d.ts +106 -0
  274. package/dist/types-CWybW61E.d.ts +323 -0
  275. package/dist/types-C_yfu3XK.d.ts +34 -0
  276. package/dist/types-Cj2RWXbz.js +90 -0
  277. package/dist/types-Cj2RWXbz.js.map +1 -0
  278. package/dist/types-DgaQqvxo.d.ts +70 -0
  279. package/dist/usage/index.d.ts +2 -213
  280. package/dist/usage/index.js +3 -15
  281. package/dist/usage/index.js.map +1 -1
  282. package/dist/usage-BKFZiWQn.js +682 -0
  283. package/dist/usage-BKFZiWQn.js.map +1 -0
  284. package/dist/utils/index.d.ts +2 -1
  285. package/dist/utils/index.js +3 -3
  286. package/dist/utils/index.js.map +1 -1
  287. package/dist/utils-DL85Tnbn.js +500 -0
  288. package/dist/utils-DL85Tnbn.js.map +1 -0
  289. package/dist/validation/index.d.ts +2 -2
  290. package/dist/validation/index.js +3 -3
  291. package/dist/validation/index.js.map +1 -1
  292. package/dist/validation-CPUITdMk.js +762 -0
  293. package/dist/validation-CPUITdMk.js.map +1 -0
  294. package/dist/workspace-extension-COrC0dYi.js +979 -0
  295. package/dist/workspace-extension-COrC0dYi.js.map +1 -0
  296. package/dist/{workspace-extension-BGwTOV_r.d.ts → workspace-extension-DTFTdGVF.d.ts} +43 -45
  297. package/package.json +7 -10
  298. package/dist/EventQueueFactory-PP534MBQ.js +0 -8
  299. package/dist/EventQueueFactory-PP534MBQ.js.map +0 -1
  300. package/dist/chunk-4XIBXZ6J.js +0 -276
  301. package/dist/chunk-4XIBXZ6J.js.map +0 -1
  302. package/dist/chunk-554Z4C2K.js +0 -1006
  303. package/dist/chunk-554Z4C2K.js.map +0 -1
  304. package/dist/chunk-5CAFHK2Z.js +0 -107
  305. package/dist/chunk-5CAFHK2Z.js.map +0 -1
  306. package/dist/chunk-63ZXJ42X.js +0 -451
  307. package/dist/chunk-63ZXJ42X.js.map +0 -1
  308. package/dist/chunk-6XEXJATV.js +0 -304
  309. package/dist/chunk-6XEXJATV.js.map +0 -1
  310. package/dist/chunk-726AR6Q7.js +0 -1532
  311. package/dist/chunk-726AR6Q7.js.map +0 -1
  312. package/dist/chunk-7EISSMFP.js +0 -617
  313. package/dist/chunk-7EISSMFP.js.map +0 -1
  314. package/dist/chunk-A5F6Z5UE.js +0 -21
  315. package/dist/chunk-A5F6Z5UE.js.map +0 -1
  316. package/dist/chunk-A6DE32ZS.js +0 -1507
  317. package/dist/chunk-A6DE32ZS.js.map +0 -1
  318. package/dist/chunk-BJQOGOVW.js +0 -602
  319. package/dist/chunk-BJQOGOVW.js.map +0 -1
  320. package/dist/chunk-CFXWH2IS.js +0 -52
  321. package/dist/chunk-CFXWH2IS.js.map +0 -1
  322. package/dist/chunk-DIOS6L7M.js +0 -690
  323. package/dist/chunk-DIOS6L7M.js.map +0 -1
  324. package/dist/chunk-DJNHR37J.js +0 -1185
  325. package/dist/chunk-DJNHR37J.js.map +0 -1
  326. package/dist/chunk-DRWH5XCJ.js +0 -876
  327. package/dist/chunk-DRWH5XCJ.js.map +0 -1
  328. package/dist/chunk-E4QNLVY4.js +0 -909
  329. package/dist/chunk-E4QNLVY4.js.map +0 -1
  330. package/dist/chunk-E6OAFS7A.js +0 -1346
  331. package/dist/chunk-E6OAFS7A.js.map +0 -1
  332. package/dist/chunk-EBDHIL7V.js +0 -774
  333. package/dist/chunk-EBDHIL7V.js.map +0 -1
  334. package/dist/chunk-ELU7VL3E.js +0 -245
  335. package/dist/chunk-ELU7VL3E.js.map +0 -1
  336. package/dist/chunk-FZRODKIN.js +0 -31
  337. package/dist/chunk-FZRODKIN.js.map +0 -1
  338. package/dist/chunk-GCIB76AJ.js +0 -882
  339. package/dist/chunk-GCIB76AJ.js.map +0 -1
  340. package/dist/chunk-HC6MPUIH.js +0 -1571
  341. package/dist/chunk-HC6MPUIH.js.map +0 -1
  342. package/dist/chunk-I3KOWRT3.js +0 -89
  343. package/dist/chunk-I3KOWRT3.js.map +0 -1
  344. package/dist/chunk-ID3WR4JS.js +0 -509
  345. package/dist/chunk-ID3WR4JS.js.map +0 -1
  346. package/dist/chunk-JVMAQOA3.js +0 -521
  347. package/dist/chunk-JVMAQOA3.js.map +0 -1
  348. package/dist/chunk-K56L7NUR.js +0 -1444
  349. package/dist/chunk-K56L7NUR.js.map +0 -1
  350. package/dist/chunk-KH4TRQCO.js +0 -1063
  351. package/dist/chunk-KH4TRQCO.js.map +0 -1
  352. package/dist/chunk-KJOSPVB2.js +0 -57
  353. package/dist/chunk-KJOSPVB2.js.map +0 -1
  354. package/dist/chunk-KO2ZXZ7W.js +0 -61
  355. package/dist/chunk-KO2ZXZ7W.js.map +0 -1
  356. package/dist/chunk-KS2HQCJR.js +0 -56
  357. package/dist/chunk-KS2HQCJR.js.map +0 -1
  358. package/dist/chunk-LA5KPWZ2.js +0 -413
  359. package/dist/chunk-LA5KPWZ2.js.map +0 -1
  360. package/dist/chunk-MESLAC5W.js +0 -574
  361. package/dist/chunk-MESLAC5W.js.map +0 -1
  362. package/dist/chunk-MWPYA2HD.js +0 -94
  363. package/dist/chunk-MWPYA2HD.js.map +0 -1
  364. package/dist/chunk-NUB5GQTU.js +0 -270
  365. package/dist/chunk-NUB5GQTU.js.map +0 -1
  366. package/dist/chunk-O2JMZHNH.js +0 -1908
  367. package/dist/chunk-O2JMZHNH.js.map +0 -1
  368. package/dist/chunk-OBBCR6WY.js +0 -277
  369. package/dist/chunk-OBBCR6WY.js.map +0 -1
  370. package/dist/chunk-OBZQ4AJC.js +0 -272
  371. package/dist/chunk-OBZQ4AJC.js.map +0 -1
  372. package/dist/chunk-OXNCBE7P.js +0 -971
  373. package/dist/chunk-OXNCBE7P.js.map +0 -1
  374. package/dist/chunk-PBZFAAOM.js +0 -941
  375. package/dist/chunk-PYD44IHJ.js +0 -728
  376. package/dist/chunk-PYD44IHJ.js.map +0 -1
  377. package/dist/chunk-QVPIACWD.js +0 -679
  378. package/dist/chunk-QVPIACWD.js.map +0 -1
  379. package/dist/chunk-QWNNFE4P.js +0 -41
  380. package/dist/chunk-QWNNFE4P.js.map +0 -1
  381. package/dist/chunk-RU266375.js +0 -327
  382. package/dist/chunk-RU266375.js.map +0 -1
  383. package/dist/chunk-RYTSVGGA.js +0 -1624
  384. package/dist/chunk-RYTSVGGA.js.map +0 -1
  385. package/dist/chunk-RZOFS2BQ.js +0 -225
  386. package/dist/chunk-RZOFS2BQ.js.map +0 -1
  387. package/dist/chunk-SBS4S2PJ.js +0 -100
  388. package/dist/chunk-SBS4S2PJ.js.map +0 -1
  389. package/dist/chunk-SPRG6G6G.js +0 -530
  390. package/dist/chunk-SPRG6G6G.js.map +0 -1
  391. package/dist/chunk-STWFX5E2.js +0 -233
  392. package/dist/chunk-STWFX5E2.js.map +0 -1
  393. package/dist/chunk-UNASM5VJ.js +0 -419
  394. package/dist/chunk-UNASM5VJ.js.map +0 -1
  395. package/dist/chunk-VAT66FJA.js +0 -245
  396. package/dist/chunk-VAT66FJA.js.map +0 -1
  397. package/dist/chunk-VFCMR5GX.js +0 -49
  398. package/dist/chunk-VFCMR5GX.js.map +0 -1
  399. package/dist/chunk-VGAHZKNJ.js +0 -66
  400. package/dist/chunk-VGAHZKNJ.js.map +0 -1
  401. package/dist/chunk-VTJTAAXC.js +0 -627
  402. package/dist/chunk-VTJTAAXC.js.map +0 -1
  403. package/dist/chunk-VXVLKRU6.js +0 -758
  404. package/dist/chunk-VXVLKRU6.js.map +0 -1
  405. package/dist/chunk-WWUU5ETI.js +0 -163
  406. package/dist/chunk-WWUU5ETI.js.map +0 -1
  407. package/dist/chunk-XE4OXN2W.js +0 -10
  408. package/dist/chunk-XE4OXN2W.js.map +0 -1
  409. package/dist/chunk-XOJORS75.js +0 -1853
  410. package/dist/chunk-XOJORS75.js.map +0 -1
  411. package/dist/chunk-YMZEUTD2.js +0 -110
  412. package/dist/chunk-YMZEUTD2.js.map +0 -1
  413. package/dist/chunk-ZZK3WEDI.js +0 -181
  414. package/dist/chunk-ZZK3WEDI.js.map +0 -1
  415. package/dist/client-CCXpAZ2r.d.ts +0 -89
  416. package/dist/client-DSI_760t.d.ts +0 -36
  417. package/dist/client-JU6T3UPB.js +0 -11
  418. package/dist/client-JU6T3UPB.js.map +0 -1
  419. package/dist/dist-2X4Q7PJA.js +0 -1491
  420. package/dist/dist-2X4Q7PJA.js.map +0 -1
  421. package/dist/env-4UWSUS64.js +0 -4
  422. package/dist/env-4UWSUS64.js.map +0 -1
  423. package/dist/graph-emitter-r5TylDBm.d.ts +0 -47
  424. package/dist/graphql-CMHMQjvd.d.ts +0 -23
  425. package/dist/i18n-Qm2AkPC-.d.ts +0 -33
  426. package/dist/index--yvpa6ay.d.ts +0 -83
  427. package/dist/index-4gKQKZ2B.d.ts +0 -71
  428. package/dist/index-5x0XMKXN.d.ts +0 -149
  429. package/dist/index-B70b5mYS.d.ts +0 -33
  430. package/dist/index-B8KrxO4j.d.ts +0 -755
  431. package/dist/index-BOuDKnqD.d.ts +0 -201
  432. package/dist/index-BTMt4OjA.d.ts +0 -201
  433. package/dist/index-BejbszA7.d.ts +0 -39
  434. package/dist/index-BkeOYZye.d.ts +0 -198
  435. package/dist/index-BuAj5nXg.d.ts +0 -83
  436. package/dist/index-BvkVcW8I.d.ts +0 -349
  437. package/dist/index-CWmH_-RZ.d.ts +0 -247
  438. package/dist/index-CbgWNcus.d.ts +0 -258
  439. package/dist/index-CmfPeQza.d.ts +0 -166
  440. package/dist/index-CmpG-zak.d.ts +0 -607
  441. package/dist/index-CoMKgL-p.d.ts +0 -12
  442. package/dist/index-D8HGwglK.d.ts +0 -541
  443. package/dist/index-DCaVm66D.d.ts +0 -1101
  444. package/dist/index-DE2w7E0d.d.ts +0 -83
  445. package/dist/index-DSOpj8DI.d.ts +0 -17
  446. package/dist/index-DW9q22GH.d.ts +0 -75
  447. package/dist/index-DnjJ9CwI.d.ts +0 -347
  448. package/dist/index-DwMJZ8PP.d.ts +0 -317
  449. package/dist/index-PaojfSdd.d.ts +0 -71
  450. package/dist/index-aHtYvc3i.d.ts +0 -284
  451. package/dist/index-e_18DzAg.d.ts +0 -18
  452. package/dist/index-ffmipXSA.d.ts +0 -55
  453. package/dist/index-joONjwLt.d.ts +0 -33
  454. package/dist/index-kssw5ziY.d.ts +0 -250
  455. package/dist/index-lFffh5-G.d.ts +0 -125
  456. package/dist/index-pxYge_6k.d.ts +0 -79
  457. package/dist/layer-Cv9vSwBx.d.ts +0 -70
  458. package/dist/pino-logger-H4HPW5P6.js +0 -5
  459. package/dist/pino-logger-H4HPW5P6.js.map +0 -1
  460. package/dist/prisma-extension-gYhYriA0.d.ts +0 -174
  461. package/dist/sdk-L75WWUP3.js +0 -156
  462. package/dist/sdk-L75WWUP3.js.map +0 -1
  463. package/dist/shutdown-registry-CW9LryO8.d.ts +0 -10
  464. package/dist/types-Bo2wkjSP.d.ts +0 -35
  465. package/dist/types-DVpvrAhd.d.ts +0 -71
  466. package/dist/types-DgJ4lDYA.d.ts +0 -108
  467. package/dist/types-USOv09qy.d.ts +0 -327
  468. package/dist/workspace-guard-NXVYYBVJ.js +0 -5
  469. package/dist/workspace-guard-NXVYYBVJ.js.map +0 -1
@@ -1,1624 +0,0 @@
1
- import { updateInstrumentationConfig, resetMetricsRegistry, resetInstrumentationConfig, isMetricsRegistryInitialized, isInstrumentationConfigInitialized, isFeatureEnabled, initializeMetricsRegistry, initializeInstrumentationConfig, getMetricsRegistry, getInstrumentationConfig, createUpDownCounter, createHistogram, createGauge, createCounter, buildTracingConfig, buildMetricsConfig, buildInstrumentationConfig, buildGraphQLConfig, buildFeatureFlags, buildDatabaseConfig, MetricsRegistry, ENV_VARS, DEFAULT_TRACING_CONFIG, DEFAULT_METRICS_CONFIG, DEFAULT_LOGGING_CONFIG, DEFAULT_HTTP_CONFIG, DEFAULT_GRAPHQL_CONFIG, DEFAULT_FEATURE_FLAGS, DEFAULT_EVENT_QUEUE_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_CACHE_CONFIG } from './chunk-GCIB76AJ.js';
2
- import { logger } from './chunk-RU266375.js';
3
- import { __export, __name } from './chunk-XE4OXN2W.js';
4
- import { createRequire } from 'module';
5
-
6
- // src/instrumentation/index.ts
7
- var instrumentation_exports = {};
8
- __export(instrumentation_exports, {
9
- DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
10
- DEFAULT_DATABASE_CONFIG: () => DEFAULT_DATABASE_CONFIG,
11
- DEFAULT_EVENT_QUEUE_CONFIG: () => DEFAULT_EVENT_QUEUE_CONFIG,
12
- DEFAULT_FEATURE_FLAGS: () => DEFAULT_FEATURE_FLAGS,
13
- DEFAULT_GRAPHQL_CONFIG: () => DEFAULT_GRAPHQL_CONFIG,
14
- DEFAULT_HTTP_CONFIG: () => DEFAULT_HTTP_CONFIG,
15
- DEFAULT_LOGGING_CONFIG: () => DEFAULT_LOGGING_CONFIG,
16
- DEFAULT_METRICS_CONFIG: () => DEFAULT_METRICS_CONFIG,
17
- DEFAULT_TRACING_CONFIG: () => DEFAULT_TRACING_CONFIG,
18
- ENV_VARS: () => ENV_VARS,
19
- Instrument: () => Instrument,
20
- Log: () => Log,
21
- Metric: () => Metric,
22
- MetricsRegistry: () => MetricsRegistry,
23
- STANDARD_METRICS: () => STANDARD_METRICS,
24
- SpanKind: () => SpanKind,
25
- SpanStatus: () => SpanStatus,
26
- Trace: () => Trace,
27
- Tracer: () => Tracer,
28
- buildDatabaseConfig: () => buildDatabaseConfig,
29
- buildFeatureFlags: () => buildFeatureFlags,
30
- buildGraphQLConfig: () => buildGraphQLConfig,
31
- buildInstrumentationConfig: () => buildInstrumentationConfig,
32
- buildMetricsConfig: () => buildMetricsConfig,
33
- buildTracingConfig: () => buildTracingConfig,
34
- createApolloInlineTracePlugin: () => createApolloInlineTracePlugin,
35
- createCounter: () => createCounter,
36
- createGauge: () => createGauge,
37
- createGraphQLInstrumentationPlugin: () => createGraphQLInstrumentationPlugin,
38
- createHistogram: () => createHistogram,
39
- createPrometheusPlugin: () => createPrometheusPlugin,
40
- createUpDownCounter: () => createUpDownCounter,
41
- extractOperationInfo: () => extractOperationInfo,
42
- extractTraceContext: () => extractTraceContext,
43
- getGraphQLOperationFromContext: () => getGraphQLOperationFromContext,
44
- getGraphQLSpanFromContext: () => getGraphQLSpanFromContext,
45
- getInstrumentationConfig: () => getInstrumentationConfig,
46
- getLogger: () => getLogger,
47
- getMetricsRegistry: () => getMetricsRegistry,
48
- getTraceContext: () => getTraceContext,
49
- getTracer: () => getTracer,
50
- initializeInstrumentation: () => initializeInstrumentation,
51
- initializeInstrumentationConfig: () => initializeInstrumentationConfig,
52
- initializeMetricsRegistry: () => initializeMetricsRegistry,
53
- initializeTracer: () => initializeTracer,
54
- injectTraceContext: () => injectTraceContext,
55
- instrumentResolver: () => instrumentResolver,
56
- instrumentResolverMap: () => instrumentResolverMap,
57
- instrumented: () => instrumented,
58
- isApolloInlineTraceAvailable: () => isApolloInlineTraceAvailable,
59
- isFeatureEnabled: () => isFeatureEnabled,
60
- isInstrumentationConfigInitialized: () => isInstrumentationConfigInitialized,
61
- isInstrumentationInitialized: () => isInstrumentationInitialized,
62
- isMetricsRegistryInitialized: () => isMetricsRegistryInitialized,
63
- isPrometheusAvailable: () => isPrometheusAvailable,
64
- isTracerInitialized: () => isTracerInitialized,
65
- logger: () => logger,
66
- resetInstrumentation: () => resetInstrumentation,
67
- resetInstrumentationConfig: () => resetInstrumentationConfig,
68
- resetMetricsRegistry: () => resetMetricsRegistry,
69
- setupInstrumentation: () => setupInstrumentation,
70
- startSpan: () => startSpan,
71
- traced: () => traced,
72
- updateInstrumentationConfig: () => updateInstrumentationConfig,
73
- withSpan: () => withSpan
74
- });
75
-
76
- // src/instrumentation/tracer.ts
77
- var SpanStatus = /* @__PURE__ */ (function(SpanStatus2) {
78
- SpanStatus2[SpanStatus2["UNSET"] = 0] = "UNSET";
79
- SpanStatus2[SpanStatus2["OK"] = 1] = "OK";
80
- SpanStatus2[SpanStatus2["ERROR"] = 2] = "ERROR";
81
- return SpanStatus2;
82
- })({});
83
- var SpanKind = /* @__PURE__ */ (function(SpanKind2) {
84
- SpanKind2[SpanKind2["INTERNAL"] = 0] = "INTERNAL";
85
- SpanKind2[SpanKind2["SERVER"] = 1] = "SERVER";
86
- SpanKind2[SpanKind2["CLIENT"] = 2] = "CLIENT";
87
- SpanKind2[SpanKind2["PRODUCER"] = 3] = "PRODUCER";
88
- SpanKind2[SpanKind2["CONSUMER"] = 4] = "CONSUMER";
89
- return SpanKind2;
90
- })({});
91
- function generateTraceId() {
92
- const bytes = new Uint8Array(16);
93
- crypto.getRandomValues(bytes);
94
- return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
95
- }
96
- __name(generateTraceId, "generateTraceId");
97
- function generateSpanId() {
98
- const bytes = new Uint8Array(8);
99
- crypto.getRandomValues(bytes);
100
- return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
101
- }
102
- __name(generateSpanId, "generateSpanId");
103
- var InMemorySpan = class InMemorySpan2 {
104
- static {
105
- __name(this, "InMemorySpan");
106
- }
107
- name;
108
- traceId;
109
- spanId;
110
- parentSpanId;
111
- kind;
112
- startTime;
113
- endTime;
114
- status = 0;
115
- attributes = {};
116
- events = [];
117
- isRecording = true;
118
- onEnd;
119
- constructor(name, kind = 0, parentContext, onEnd) {
120
- this.name = name;
121
- this.kind = kind;
122
- this.startTime = Date.now();
123
- this.spanId = generateSpanId();
124
- this.onEnd = onEnd;
125
- if (parentContext) {
126
- this.traceId = parentContext.traceId;
127
- this.parentSpanId = parentContext.spanId;
128
- } else {
129
- this.traceId = generateTraceId();
130
- }
131
- }
132
- setAttribute(key, value) {
133
- if (this.isRecording) {
134
- this.attributes[key] = value;
135
- }
136
- return this;
137
- }
138
- setAttributes(attributes) {
139
- if (this.isRecording) {
140
- Object.assign(this.attributes, attributes);
141
- }
142
- return this;
143
- }
144
- setStatus(status, message) {
145
- this.status = status;
146
- if (message) {
147
- this.attributes["status.message"] = message;
148
- }
149
- return this;
150
- }
151
- recordException(error) {
152
- this.status = 2;
153
- this.attributes["error"] = true;
154
- this.attributes["error.type"] = error.name;
155
- this.attributes["error.message"] = error.message;
156
- if (error.stack) {
157
- this.attributes["error.stack"] = error.stack;
158
- }
159
- this.addEvent("exception", {
160
- "exception.type": error.name,
161
- "exception.message": error.message
162
- });
163
- return this;
164
- }
165
- addEvent(name, attributes) {
166
- if (this.isRecording) {
167
- this.events.push({
168
- name,
169
- timestamp: Date.now(),
170
- attributes
171
- });
172
- }
173
- return this;
174
- }
175
- end() {
176
- if (!this.isRecording) return;
177
- this.endTime = Date.now();
178
- this.isRecording = false;
179
- if (this.onEnd) {
180
- this.onEnd(this);
181
- }
182
- }
183
- getSpanContext() {
184
- return {
185
- traceId: this.traceId,
186
- spanId: this.spanId,
187
- traceFlags: this.status === 2 ? 1 : 0
188
- };
189
- }
190
- };
191
- var NoOpSpan = class NoOpSpan2 {
192
- static {
193
- __name(this, "NoOpSpan");
194
- }
195
- name = "";
196
- traceId = "";
197
- spanId = "";
198
- kind = 0;
199
- startTime = 0;
200
- status = 0;
201
- attributes = {};
202
- events = [];
203
- isRecording = false;
204
- setAttribute() {
205
- return this;
206
- }
207
- setAttributes() {
208
- return this;
209
- }
210
- setStatus() {
211
- return this;
212
- }
213
- recordException() {
214
- return this;
215
- }
216
- addEvent() {
217
- return this;
218
- }
219
- end() {
220
- }
221
- getSpanContext() {
222
- return {
223
- traceId: "",
224
- spanId: "",
225
- traceFlags: 0
226
- };
227
- }
228
- };
229
- var Tracer = class {
230
- static {
231
- __name(this, "Tracer");
232
- }
233
- serviceName;
234
- activeSpans = /* @__PURE__ */ new Map();
235
- currentSpan = null;
236
- spanListeners = [];
237
- constructor(serviceName) {
238
- this.serviceName = serviceName;
239
- }
240
- /**
241
- * Check if tracing is enabled
242
- */
243
- isEnabled() {
244
- return isInstrumentationConfigInitialized() && isFeatureEnabled("tracing");
245
- }
246
- /**
247
- * Start a new span
248
- */
249
- startSpan(name, kind = 0, parentContext) {
250
- if (!this.isEnabled()) {
251
- return new NoOpSpan();
252
- }
253
- const config = getInstrumentationConfig();
254
- if (config.tracing.ignoredOperations?.includes(name)) {
255
- return new NoOpSpan();
256
- }
257
- const parent = parentContext || this.currentSpan?.getSpanContext();
258
- const span = new InMemorySpan(name, kind, parent, (completedSpan) => {
259
- this.onSpanEnd(completedSpan);
260
- });
261
- span.setAttributes({
262
- "service.name": this.serviceName,
263
- "service.version": config.tracing.serviceVersion || "1.0.0",
264
- "deployment.environment": config.tracing.environment || "development"
265
- });
266
- if (config.tracing.resourceAttributes) {
267
- span.setAttributes(config.tracing.resourceAttributes);
268
- }
269
- this.activeSpans.set(span.spanId, span);
270
- this.currentSpan = span;
271
- return span;
272
- }
273
- /**
274
- * Start a span from operation context
275
- */
276
- startSpanFromContext(context, kind = 0) {
277
- const span = this.startSpan(context.operationName, kind);
278
- if (span.isRecording) {
279
- span.setAttributes({
280
- "operation.type": context.operationType,
281
- ...context.actorId && {
282
- "actor.id": context.actorId
283
- },
284
- ...context.tenantId && {
285
- "tenant.id": context.tenantId
286
- },
287
- ...context.workspaceId && {
288
- "workspace.id": context.workspaceId
289
- },
290
- ...context.requestId && {
291
- "request.id": context.requestId
292
- },
293
- ...context.attributes
294
- });
295
- }
296
- return span;
297
- }
298
- /**
299
- * Get current active span
300
- */
301
- getCurrentSpan() {
302
- return this.currentSpan;
303
- }
304
- /**
305
- * Get current trace context for logging
306
- */
307
- getTraceContext() {
308
- if (!this.currentSpan || !this.isEnabled()) {
309
- return {};
310
- }
311
- const spanContext = this.currentSpan.getSpanContext();
312
- return {
313
- traceId: spanContext.traceId,
314
- spanId: spanContext.spanId,
315
- traceFlags: spanContext.traceFlags,
316
- parentSpanId: this.currentSpan.parentSpanId
317
- };
318
- }
319
- /**
320
- * Set current span (for context propagation)
321
- */
322
- setCurrentSpan(span) {
323
- this.currentSpan = span;
324
- }
325
- /**
326
- * Run a function within a span
327
- */
328
- async withSpan(name, fn, kind = 0, parentContext) {
329
- const span = this.startSpan(name, kind, parentContext);
330
- try {
331
- const result = await fn(span);
332
- span.setStatus(1);
333
- return result;
334
- } catch (error) {
335
- if (error instanceof Error) {
336
- span.recordException(error);
337
- }
338
- throw error;
339
- } finally {
340
- span.end();
341
- }
342
- }
343
- /**
344
- * Run a synchronous function within a span
345
- */
346
- withSpanSync(name, fn, kind = 0, parentContext) {
347
- const span = this.startSpan(name, kind, parentContext);
348
- try {
349
- const result = fn(span);
350
- span.setStatus(1);
351
- return result;
352
- } catch (error) {
353
- if (error instanceof Error) {
354
- span.recordException(error);
355
- }
356
- throw error;
357
- } finally {
358
- span.end();
359
- }
360
- }
361
- /**
362
- * Add a listener for completed spans
363
- */
364
- addSpanListener(listener) {
365
- this.spanListeners.push(listener);
366
- }
367
- /**
368
- * Remove a span listener
369
- */
370
- removeSpanListener(listener) {
371
- const index = this.spanListeners.indexOf(listener);
372
- if (index !== -1) {
373
- this.spanListeners.splice(index, 1);
374
- }
375
- }
376
- /**
377
- * Handle span completion
378
- */
379
- onSpanEnd(span) {
380
- this.activeSpans.delete(span.spanId);
381
- if (this.currentSpan?.spanId === span.spanId) {
382
- if (span.parentSpanId) {
383
- this.currentSpan = this.activeSpans.get(span.parentSpanId) || null;
384
- } else {
385
- this.currentSpan = null;
386
- }
387
- }
388
- const config = getInstrumentationConfig();
389
- if (config.tracing.exporterType === "console") {
390
- this.logSpan(span);
391
- }
392
- for (const listener of this.spanListeners) {
393
- try {
394
- listener(span);
395
- } catch (error) {
396
- logger.error("[Tracer] Error in span listener:", error);
397
- }
398
- }
399
- }
400
- /**
401
- * Log span to console (for debugging)
402
- */
403
- logSpan(span) {
404
- const duration = span.endTime ? span.endTime - span.startTime : 0;
405
- logger.debug("[Tracer] Span completed", {
406
- name: span.name,
407
- traceId: span.traceId,
408
- spanId: span.spanId,
409
- parentSpanId: span.parentSpanId,
410
- kind: SpanKind[span.kind],
411
- status: SpanStatus[span.status],
412
- duration: `${duration}ms`,
413
- attributes: span.attributes,
414
- eventCount: span.events.length
415
- });
416
- }
417
- /**
418
- * Get active span count
419
- */
420
- getActiveSpanCount() {
421
- return this.activeSpans.size;
422
- }
423
- /**
424
- * Clear all active spans (for testing)
425
- */
426
- clearActiveSpans() {
427
- this.activeSpans.clear();
428
- this.currentSpan = null;
429
- }
430
- };
431
- var globalTracer = null;
432
- function initializeTracer(serviceName) {
433
- globalTracer = new Tracer(serviceName);
434
- return globalTracer;
435
- }
436
- __name(initializeTracer, "initializeTracer");
437
- function getTracer() {
438
- if (!globalTracer) {
439
- globalTracer = new Tracer("unknown-service");
440
- }
441
- return globalTracer;
442
- }
443
- __name(getTracer, "getTracer");
444
- function isTracerInitialized() {
445
- return globalTracer !== null;
446
- }
447
- __name(isTracerInitialized, "isTracerInitialized");
448
- function startSpan(name, kind = 0, parentContext) {
449
- return getTracer().startSpan(name, kind, parentContext);
450
- }
451
- __name(startSpan, "startSpan");
452
- async function withSpan(name, fn, kind = 0) {
453
- return getTracer().withSpan(name, fn, kind);
454
- }
455
- __name(withSpan, "withSpan");
456
- function getTraceContext() {
457
- return getTracer().getTraceContext();
458
- }
459
- __name(getTraceContext, "getTraceContext");
460
- function extractTraceContext(headers) {
461
- const traceparent = headers["traceparent"];
462
- if (!traceparent) return void 0;
463
- const value = Array.isArray(traceparent) ? traceparent[0] : traceparent;
464
- if (!value) return void 0;
465
- const parts = value.split("-");
466
- if (parts.length !== 4) return void 0;
467
- const [, traceId, spanId, traceFlags] = parts;
468
- if (!traceId || !spanId || traceId.length !== 32 || spanId.length !== 16) {
469
- return void 0;
470
- }
471
- return {
472
- traceId,
473
- spanId,
474
- traceFlags: parseInt(traceFlags || "0", 16),
475
- isRemote: true
476
- };
477
- }
478
- __name(extractTraceContext, "extractTraceContext");
479
- function injectTraceContext(headers, spanContext) {
480
- const context = spanContext || getTracer().getCurrentSpan()?.getSpanContext();
481
- if (!context || !context.traceId || !context.spanId) return;
482
- headers["traceparent"] = `00-${context.traceId}-${context.spanId}-${context.traceFlags.toString(16).padStart(2, "0")}`;
483
- }
484
- __name(injectTraceContext, "injectTraceContext");
485
-
486
- // src/telemetry/logger-state.ts
487
- var activeTelemetryLogger;
488
- function setActiveTelemetryLogger(logger2) {
489
- activeTelemetryLogger = logger2;
490
- }
491
- __name(setActiveTelemetryLogger, "setActiveTelemetryLogger");
492
- function getActiveTelemetryLogger() {
493
- return activeTelemetryLogger;
494
- }
495
- __name(getActiveTelemetryLogger, "getActiveTelemetryLogger");
496
-
497
- // src/instrumentation/types.ts
498
- var STANDARD_METRICS = {
499
- // HTTP metrics
500
- HTTP_REQUEST_DURATION: {
501
- name: "http_request_duration_ms",
502
- description: "HTTP request duration in milliseconds",
503
- type: "histogram",
504
- unit: "ms",
505
- labelKeys: [
506
- "method",
507
- "route",
508
- "status_code"
509
- ],
510
- boundaries: [
511
- 5,
512
- 10,
513
- 25,
514
- 50,
515
- 100,
516
- 250,
517
- 500,
518
- 1e3,
519
- 2500,
520
- 5e3,
521
- 1e4
522
- ]
523
- },
524
- HTTP_REQUEST_TOTAL: {
525
- name: "http_requests_total",
526
- description: "Total number of HTTP requests",
527
- type: "counter",
528
- labelKeys: [
529
- "method",
530
- "route",
531
- "status_code"
532
- ]
533
- },
534
- HTTP_REQUEST_SIZE: {
535
- name: "http_request_size_bytes",
536
- description: "HTTP request size in bytes",
537
- type: "histogram",
538
- unit: "bytes",
539
- labelKeys: [
540
- "method",
541
- "route"
542
- ],
543
- boundaries: [
544
- 100,
545
- 1e3,
546
- 1e4,
547
- 1e5,
548
- 1e6
549
- ]
550
- },
551
- HTTP_RESPONSE_SIZE: {
552
- name: "http_response_size_bytes",
553
- description: "HTTP response size in bytes",
554
- type: "histogram",
555
- unit: "bytes",
556
- labelKeys: [
557
- "method",
558
- "route"
559
- ],
560
- boundaries: [
561
- 100,
562
- 1e3,
563
- 1e4,
564
- 1e5,
565
- 1e6
566
- ]
567
- },
568
- // GraphQL metrics
569
- GRAPHQL_OPERATION_DURATION: {
570
- name: "graphql_operation_duration_ms",
571
- description: "GraphQL operation duration in milliseconds",
572
- type: "histogram",
573
- unit: "ms",
574
- labelKeys: [
575
- "operation_type",
576
- "operation_name"
577
- ],
578
- boundaries: [
579
- 5,
580
- 10,
581
- 25,
582
- 50,
583
- 100,
584
- 250,
585
- 500,
586
- 1e3,
587
- 2500,
588
- 5e3
589
- ]
590
- },
591
- GRAPHQL_OPERATION_TOTAL: {
592
- name: "graphql_operations_total",
593
- description: "Total number of GraphQL operations",
594
- type: "counter",
595
- labelKeys: [
596
- "operation_type",
597
- "operation_name",
598
- "status"
599
- ]
600
- },
601
- GRAPHQL_RESOLVER_DURATION: {
602
- name: "graphql_resolver_duration_ms",
603
- description: "GraphQL resolver duration in milliseconds",
604
- type: "histogram",
605
- unit: "ms",
606
- labelKeys: [
607
- "type_name",
608
- "field_name"
609
- ],
610
- boundaries: [
611
- 1,
612
- 5,
613
- 10,
614
- 25,
615
- 50,
616
- 100,
617
- 250,
618
- 500
619
- ]
620
- },
621
- // Database metrics
622
- DB_QUERY_DURATION: {
623
- name: "db_query_duration_ms",
624
- description: "Database query duration in milliseconds",
625
- type: "histogram",
626
- unit: "ms",
627
- labelKeys: [
628
- "operation",
629
- "model"
630
- ],
631
- boundaries: [
632
- 1,
633
- 5,
634
- 10,
635
- 25,
636
- 50,
637
- 100,
638
- 250,
639
- 500,
640
- 1e3
641
- ]
642
- },
643
- DB_QUERY_TOTAL: {
644
- name: "db_queries_total",
645
- description: "Total number of database queries",
646
- type: "counter",
647
- labelKeys: [
648
- "operation",
649
- "model",
650
- "status"
651
- ]
652
- },
653
- DB_CONNECTION_POOL_SIZE: {
654
- name: "db_connection_pool_size",
655
- description: "Database connection pool size",
656
- type: "gauge",
657
- labelKeys: [
658
- "state"
659
- ]
660
- },
661
- // Cache metrics
662
- CACHE_OPERATION_DURATION: {
663
- name: "cache_operation_duration_ms",
664
- description: "Cache operation duration in milliseconds",
665
- type: "histogram",
666
- unit: "ms",
667
- labelKeys: [
668
- "operation"
669
- ],
670
- boundaries: [
671
- 0.1,
672
- 0.5,
673
- 1,
674
- 2,
675
- 5,
676
- 10,
677
- 25,
678
- 50
679
- ]
680
- },
681
- CACHE_HIT_TOTAL: {
682
- name: "cache_hits_total",
683
- description: "Total number of cache hits",
684
- type: "counter",
685
- labelKeys: [
686
- "cache_type"
687
- ]
688
- },
689
- CACHE_MISS_TOTAL: {
690
- name: "cache_misses_total",
691
- description: "Total number of cache misses",
692
- type: "counter",
693
- labelKeys: [
694
- "cache_type"
695
- ]
696
- },
697
- // Business metrics
698
- OPERATION_DURATION: {
699
- name: "operation_duration_ms",
700
- description: "Business operation duration in milliseconds",
701
- type: "histogram",
702
- unit: "ms",
703
- labelKeys: [
704
- "operation",
705
- "status"
706
- ],
707
- boundaries: [
708
- 10,
709
- 50,
710
- 100,
711
- 250,
712
- 500,
713
- 1e3,
714
- 2500,
715
- 5e3,
716
- 1e4
717
- ]
718
- },
719
- OPERATION_TOTAL: {
720
- name: "operations_total",
721
- description: "Total number of business operations",
722
- type: "counter",
723
- labelKeys: [
724
- "operation",
725
- "status"
726
- ]
727
- },
728
- ACTIVE_OPERATIONS: {
729
- name: "active_operations",
730
- description: "Number of currently active operations",
731
- type: "upDownCounter",
732
- labelKeys: [
733
- "operation"
734
- ]
735
- },
736
- // Resource-cap metrics (BOFF-4809)
737
- RESOURCE_CAPS_PLAN_RESOLUTION: {
738
- name: "resource_caps.plan_resolution_total",
739
- description: "Total number of billing plan resolutions for resource caps",
740
- type: "counter",
741
- labelKeys: [
742
- "result",
743
- "reason"
744
- ]
745
- },
746
- RESOURCE_CAPS_ENFORCEMENT: {
747
- name: "resource_caps.enforcement_total",
748
- description: "Total number of resource cap enforcement checks",
749
- type: "counter",
750
- labelKeys: [
751
- "resource",
752
- "plan_tier",
753
- "result"
754
- ]
755
- },
756
- RESOURCE_CAPS_CLIENTLESS_FALLBACK: {
757
- name: "resource_caps.clientless_fallback_total",
758
- description: "Total number of times resource caps fell back because no billing source was configured at bootstrap",
759
- type: "counter",
760
- labelKeys: []
761
- }
762
- };
763
-
764
- // src/instrumentation/graphql-plugin.ts
765
- var require2 = createRequire(import.meta.url);
766
- var prometheusPluginFactory = void 0;
767
- var prometheusLoadAttempted = false;
768
- function loadPrometheusPlugin() {
769
- if (prometheusLoadAttempted) {
770
- return prometheusPluginFactory ?? null;
771
- }
772
- prometheusLoadAttempted = true;
773
- try {
774
- const module = require2("@graphql-yoga/plugin-prometheus");
775
- prometheusPluginFactory = module.usePrometheus;
776
- if (prometheusPluginFactory) {
777
- logger.info("[Instrumentation] Successfully loaded @graphql-yoga/plugin-prometheus");
778
- } else {
779
- logger.warn("[Instrumentation] @graphql-yoga/plugin-prometheus loaded but usePrometheus not found");
780
- }
781
- return prometheusPluginFactory ?? null;
782
- } catch (error) {
783
- logger.warn("[Instrumentation] Failed to load @graphql-yoga/plugin-prometheus:", error);
784
- prometheusPluginFactory = null;
785
- return null;
786
- }
787
- }
788
- __name(loadPrometheusPlugin, "loadPrometheusPlugin");
789
- function createPrometheusPlugin(options) {
790
- if (isInstrumentationConfigInitialized() && !isFeatureEnabled("metrics")) {
791
- logger.debug("[Instrumentation] Metrics disabled, skipping Prometheus plugin");
792
- return null;
793
- }
794
- const pluginFactory = loadPrometheusPlugin();
795
- if (!pluginFactory) {
796
- logger.debug("[Instrumentation] @graphql-yoga/plugin-prometheus not installed, metrics not available");
797
- return null;
798
- }
799
- const config = {
800
- // Expose metrics endpoint (set to false to disable, e.g., for push mode)
801
- endpoint: options?.endpoint ?? "/metrics",
802
- // Skip introspection queries from metrics
803
- skipIntrospection: options?.skipIntrospection ?? true,
804
- // Metrics configuration
805
- metrics: {
806
- // HTTP-level metrics
807
- graphql_yoga_http_duration: options?.httpDuration ?? true,
808
- // Operation-level metrics
809
- graphql_envelop_request_duration: options?.requestDuration ?? true,
810
- graphql_envelop_request_time_summary: options?.requestDuration ?? true,
811
- graphql_envelop_request: options?.requestCount ?? true,
812
- graphql_envelop_error_result: options?.errorCount ?? true,
813
- graphql_envelop_deprecated_field: options?.deprecatedFields ?? true,
814
- // Execution phase metrics
815
- graphql_envelop_phase_parse: options?.parsePhase ?? true,
816
- graphql_envelop_phase_validate: options?.validatePhase ?? true,
817
- graphql_envelop_phase_context: options?.contextPhase ?? true,
818
- graphql_envelop_phase_execute: options?.executePhase ?? true,
819
- graphql_envelop_phase_subscribe: true,
820
- // Schema change tracking
821
- graphql_envelop_schema_change: true,
822
- // Resolver-level metrics (disabled by default due to performance overhead)
823
- graphql_envelop_execute_resolver: options?.resolverMetrics ?? false
824
- },
825
- // If resolver metrics enabled, optionally filter which resolvers to instrument
826
- ...options?.instrumentResolvers && {
827
- instrumentResolvers: options.instrumentResolvers
828
- }
829
- };
830
- logger.debug("[Instrumentation] Using Prometheus metrics plugin", {
831
- endpoint: config.endpoint,
832
- resolverMetrics: options?.resolverMetrics ?? false
833
- });
834
- return pluginFactory(config);
835
- }
836
- __name(createPrometheusPlugin, "createPrometheusPlugin");
837
- function isPrometheusAvailable() {
838
- return loadPrometheusPlugin() !== null;
839
- }
840
- __name(isPrometheusAvailable, "isPrometheusAvailable");
841
- var apolloInlineTracePluginFactory = void 0;
842
- var apolloInlineTraceLoadAttempted = false;
843
- function loadApolloInlineTracePlugin() {
844
- if (apolloInlineTraceLoadAttempted) {
845
- return apolloInlineTracePluginFactory ?? null;
846
- }
847
- apolloInlineTraceLoadAttempted = true;
848
- try {
849
- const module = require2("@graphql-yoga/plugin-apollo-inline-trace");
850
- apolloInlineTracePluginFactory = module.useApolloInlineTrace;
851
- return apolloInlineTracePluginFactory ?? null;
852
- } catch {
853
- apolloInlineTracePluginFactory = null;
854
- return null;
855
- }
856
- }
857
- __name(loadApolloInlineTracePlugin, "loadApolloInlineTracePlugin");
858
- function createApolloInlineTracePlugin(_options) {
859
- if (isInstrumentationConfigInitialized() && !isFeatureEnabled("tracing")) {
860
- logger.debug("[Instrumentation] Tracing disabled, skipping Apollo inline trace plugin");
861
- return null;
862
- }
863
- const pluginFactory = loadApolloInlineTracePlugin();
864
- if (!pluginFactory) {
865
- logger.debug("[Instrumentation] @graphql-yoga/plugin-apollo-inline-trace not installed, using fallback tracing");
866
- return null;
867
- }
868
- logger.debug("[Instrumentation] Using Apollo Federation inline trace plugin");
869
- return pluginFactory();
870
- }
871
- __name(createApolloInlineTracePlugin, "createApolloInlineTracePlugin");
872
- function isApolloInlineTraceAvailable() {
873
- return loadApolloInlineTracePlugin() !== null;
874
- }
875
- __name(isApolloInlineTraceAvailable, "isApolloInlineTraceAvailable");
876
- function createGraphQLMetrics() {
877
- const def = STANDARD_METRICS;
878
- return {
879
- operationDuration: createHistogram(def["GRAPHQL_OPERATION_DURATION"]?.name || "graphql_operation_duration_ms", def["GRAPHQL_OPERATION_DURATION"]?.description || "GraphQL operation duration", def["GRAPHQL_OPERATION_DURATION"]?.boundaries),
880
- operationTotal: createCounter(def["GRAPHQL_OPERATION_TOTAL"]?.name || "graphql_operations_total", def["GRAPHQL_OPERATION_TOTAL"]?.description || "Total GraphQL operations"),
881
- operationErrors: createCounter("graphql_operation_errors_total", "Total GraphQL operation errors"),
882
- resolverDuration: createHistogram(def["GRAPHQL_RESOLVER_DURATION"]?.name || "graphql_resolver_duration_ms", def["GRAPHQL_RESOLVER_DURATION"]?.description || "GraphQL resolver duration", def["GRAPHQL_RESOLVER_DURATION"]?.boundaries),
883
- resolverTotal: createCounter("graphql_resolvers_total", "Total GraphQL resolver calls")
884
- };
885
- }
886
- __name(createGraphQLMetrics, "createGraphQLMetrics");
887
- var graphqlMetrics = null;
888
- function getGraphQLMetrics() {
889
- if (!graphqlMetrics) {
890
- graphqlMetrics = createGraphQLMetrics();
891
- }
892
- return graphqlMetrics;
893
- }
894
- __name(getGraphQLMetrics, "getGraphQLMetrics");
895
- function extractOperationInfo(args) {
896
- let operationType = "query";
897
- let operationName = args.operationName || null;
898
- const definitions = args.document?.definitions;
899
- if (definitions && definitions.length > 0) {
900
- for (const def of definitions) {
901
- if (def.kind === "OperationDefinition") {
902
- operationType = def.operation || "query";
903
- if (!operationName && def.name?.value) {
904
- operationName = def.name.value;
905
- }
906
- break;
907
- }
908
- }
909
- }
910
- return {
911
- operationType,
912
- operationName,
913
- document: args.document?.loc?.source?.body,
914
- variables: args.variableValues
915
- };
916
- }
917
- __name(extractOperationInfo, "extractOperationInfo");
918
- function shouldIgnoreOperation(operationName) {
919
- if (!isInstrumentationConfigInitialized()) return false;
920
- const config = getInstrumentationConfig();
921
- const ignoredOps = config.graphql.ignoredOperations || [];
922
- return operationName ? ignoredOps.includes(operationName) : false;
923
- }
924
- __name(shouldIgnoreOperation, "shouldIgnoreOperation");
925
- function createGraphQLInstrumentationPlugin() {
926
- return {
927
- onExecute({ args }) {
928
- if (!isFeatureEnabled("graphql")) {
929
- return void 0;
930
- }
931
- const operationInfo = extractOperationInfo(args);
932
- if (shouldIgnoreOperation(operationInfo.operationName)) {
933
- return void 0;
934
- }
935
- const startTime = Date.now();
936
- const config = getInstrumentationConfig();
937
- const metrics = getGraphQLMetrics();
938
- let span;
939
- if (isFeatureEnabled("tracing")) {
940
- const tracer = getTracer();
941
- const spanName = operationInfo.operationName ? `GraphQL ${operationInfo.operationType} ${operationInfo.operationName}` : `GraphQL ${operationInfo.operationType}`;
942
- span = tracer.startSpan(spanName, SpanKind.SERVER);
943
- span.setAttributes({
944
- "graphql.operation.type": operationInfo.operationType,
945
- "graphql.operation.name": operationInfo.operationName || "anonymous"
946
- });
947
- if (config.graphql.includeDocument && operationInfo.document) {
948
- span.setAttribute("graphql.document", operationInfo.document.substring(0, 2e3));
949
- }
950
- if (config.graphql.includeVariables && operationInfo.variables) {
951
- try {
952
- span.setAttribute("graphql.variables", JSON.stringify(operationInfo.variables).substring(0, 500));
953
- } catch {
954
- }
955
- }
956
- }
957
- if (isFeatureEnabled("logging")) {
958
- logger.debug("[GraphQL] Operation started", {
959
- type: operationInfo.operationType,
960
- name: operationInfo.operationName || "anonymous"
961
- });
962
- }
963
- const context = args.contextValue;
964
- if (context) {
965
- context._instrumentation = {
966
- span,
967
- startTime,
968
- operationInfo
969
- };
970
- }
971
- return {
972
- onExecuteDone({ result }) {
973
- const duration = Date.now() - startTime;
974
- const hasErrors = result && typeof result === "object" && "errors" in result && Array.isArray(result.errors) && result.errors.length > 0;
975
- if (isFeatureEnabled("metrics")) {
976
- const labels = {
977
- operation_type: operationInfo.operationType,
978
- operation_name: operationInfo.operationName || "anonymous"
979
- };
980
- metrics.operationDuration.record(duration, labels);
981
- metrics.operationTotal.inc({
982
- ...labels,
983
- status: hasErrors ? "error" : "success"
984
- });
985
- if (hasErrors) {
986
- metrics.operationErrors.inc(labels);
987
- }
988
- }
989
- if (span) {
990
- span.setAttribute("graphql.duration_ms", duration);
991
- if (hasErrors) {
992
- span.setStatus(SpanStatus.ERROR, "GraphQL operation had errors");
993
- const errors = result.errors;
994
- if (errors && errors.length > 0) {
995
- span.setAttribute("graphql.error_count", errors.length);
996
- span.addEvent("graphql.errors", {
997
- errors: errors.map((e) => e.message || "Unknown error").join("; ")
998
- });
999
- }
1000
- } else {
1001
- span.setStatus(SpanStatus.OK);
1002
- }
1003
- if (config.graphql.includeResult) {
1004
- try {
1005
- span.setAttribute("graphql.result", JSON.stringify(result).substring(0, 500));
1006
- } catch {
1007
- }
1008
- }
1009
- span.end();
1010
- }
1011
- if (isFeatureEnabled("logging")) {
1012
- if (hasErrors) {
1013
- logger.warn("[GraphQL] Operation completed with errors", {
1014
- type: operationInfo.operationType,
1015
- name: operationInfo.operationName || "anonymous",
1016
- duration: `${duration}ms`,
1017
- errorCount: (result.errors || []).length
1018
- });
1019
- } else {
1020
- logger.debug("[GraphQL] Operation completed", {
1021
- type: operationInfo.operationType,
1022
- name: operationInfo.operationName || "anonymous",
1023
- duration: `${duration}ms`
1024
- });
1025
- }
1026
- }
1027
- }
1028
- };
1029
- }
1030
- };
1031
- }
1032
- __name(createGraphQLInstrumentationPlugin, "createGraphQLInstrumentationPlugin");
1033
- function instrumentResolver(name, resolver, options) {
1034
- const [typeName, fieldName] = name.includes(".") ? name.split(".", 2) : [
1035
- "Unknown",
1036
- name
1037
- ];
1038
- return async (...args) => {
1039
- if (!isFeatureEnabled("graphql")) {
1040
- return resolver(...args);
1041
- }
1042
- const config = getInstrumentationConfig();
1043
- const startTime = Date.now();
1044
- const metrics = getGraphQLMetrics();
1045
- let span;
1046
- if (isFeatureEnabled("tracing") && config.graphql.includeResolvers) {
1047
- const tracer = getTracer();
1048
- span = tracer.startSpan(`Resolver: ${name}`, SpanKind.INTERNAL);
1049
- span.setAttributes({
1050
- "graphql.resolver.type": typeName || "Unknown",
1051
- "graphql.resolver.field": fieldName || name,
1052
- ...options?.attributes
1053
- });
1054
- if (options?.includeArgs && args.length > 1) {
1055
- try {
1056
- span.setAttribute("graphql.resolver.args", JSON.stringify(args[1]).substring(0, 500));
1057
- } catch {
1058
- }
1059
- }
1060
- }
1061
- try {
1062
- const result = await resolver(...args);
1063
- if (span) {
1064
- span.setStatus(SpanStatus.OK);
1065
- if (options?.includeResult) {
1066
- try {
1067
- span.setAttribute("graphql.resolver.result", JSON.stringify(result).substring(0, 500));
1068
- } catch {
1069
- }
1070
- }
1071
- }
1072
- return result;
1073
- } catch (error) {
1074
- if (span && error instanceof Error) {
1075
- span.recordException(error);
1076
- }
1077
- throw error;
1078
- } finally {
1079
- const duration = Date.now() - startTime;
1080
- if (span) {
1081
- span.end();
1082
- }
1083
- if (isFeatureEnabled("metrics")) {
1084
- metrics.resolverDuration.record(duration, {
1085
- type_name: typeName || "Unknown",
1086
- field_name: fieldName || name
1087
- });
1088
- metrics.resolverTotal.inc({
1089
- type_name: typeName || "Unknown",
1090
- field_name: fieldName || name
1091
- });
1092
- }
1093
- }
1094
- };
1095
- }
1096
- __name(instrumentResolver, "instrumentResolver");
1097
- function instrumentResolverMap(resolverMap, options) {
1098
- const result = {};
1099
- for (const [typeName, fields] of Object.entries(resolverMap)) {
1100
- if (options?.excludeTypes?.includes(typeName)) {
1101
- result[typeName] = fields;
1102
- continue;
1103
- }
1104
- if (options?.includeTypes && !options.includeTypes.includes(typeName)) {
1105
- result[typeName] = fields;
1106
- continue;
1107
- }
1108
- result[typeName] = {};
1109
- for (const [fieldName, resolver] of Object.entries(fields)) {
1110
- const fullName = `${typeName}.${fieldName}`;
1111
- if (options?.excludeFields?.includes(fullName)) {
1112
- result[typeName][fieldName] = resolver;
1113
- continue;
1114
- }
1115
- result[typeName][fieldName] = instrumentResolver(fullName, resolver);
1116
- }
1117
- }
1118
- return result;
1119
- }
1120
- __name(instrumentResolverMap, "instrumentResolverMap");
1121
- function getGraphQLOperationFromContext(context) {
1122
- const instrumentedContext = context;
1123
- return instrumentedContext?._instrumentation?.operationInfo;
1124
- }
1125
- __name(getGraphQLOperationFromContext, "getGraphQLOperationFromContext");
1126
- function getGraphQLSpanFromContext(context) {
1127
- const instrumentedContext = context;
1128
- return instrumentedContext?._instrumentation?.span;
1129
- }
1130
- __name(getGraphQLSpanFromContext, "getGraphQLSpanFromContext");
1131
-
1132
- // src/instrumentation/decorators.ts
1133
- function Trace(options = {}) {
1134
- return function(target, propertyKey, descriptor) {
1135
- const originalMethod = descriptor.value;
1136
- if (typeof originalMethod !== "function") {
1137
- return descriptor;
1138
- }
1139
- const className = target.constructor.name;
1140
- const methodName = String(propertyKey);
1141
- const spanName = options.name || `${className}.${methodName}`;
1142
- descriptor.value = async function(...args) {
1143
- if (!isFeatureEnabled("tracing")) {
1144
- return originalMethod.apply(this, args);
1145
- }
1146
- if (options.skip) {
1147
- const shouldSkip = typeof options.skip === "function" ? options.skip(args) : options.skip;
1148
- if (shouldSkip) {
1149
- return originalMethod.apply(this, args);
1150
- }
1151
- }
1152
- const tracer = getTracer();
1153
- const span = tracer.startSpan(spanName, options.kind || SpanKind.INTERNAL);
1154
- span.setAttributes({
1155
- "code.function": methodName,
1156
- "code.namespace": className,
1157
- ...options.attributes
1158
- });
1159
- if (options.extractAttributes) {
1160
- try {
1161
- const extractedAttrs = options.extractAttributes(args);
1162
- span.setAttributes(extractedAttrs);
1163
- } catch {
1164
- }
1165
- }
1166
- if (options.includeArgs) {
1167
- try {
1168
- span.setAttribute("method.args", JSON.stringify(args).substring(0, 1e3));
1169
- } catch {
1170
- }
1171
- }
1172
- try {
1173
- const result = await originalMethod.apply(this, args);
1174
- if (options.includeResult) {
1175
- try {
1176
- span.setAttribute("method.result", JSON.stringify(result).substring(0, 1e3));
1177
- } catch {
1178
- }
1179
- }
1180
- span.setStatus(SpanStatus.OK);
1181
- return result;
1182
- } catch (error) {
1183
- if (error instanceof Error) {
1184
- span.recordException(error);
1185
- }
1186
- throw error;
1187
- } finally {
1188
- span.end();
1189
- }
1190
- };
1191
- return descriptor;
1192
- };
1193
- }
1194
- __name(Trace, "Trace");
1195
- function Metric(options = {}) {
1196
- return function(target, propertyKey, descriptor) {
1197
- const originalMethod = descriptor.value;
1198
- if (typeof originalMethod !== "function") {
1199
- return descriptor;
1200
- }
1201
- const className = target.constructor.name;
1202
- const methodName = String(propertyKey);
1203
- const baseName = options.name || `${className.toLowerCase()}_${methodName.toLowerCase()}`;
1204
- const durationHistogram = createHistogram(`${baseName}_duration_ms`, `Duration of ${className}.${methodName} in milliseconds`, options.boundaries);
1205
- const totalCounter = createCounter(`${baseName}_total`, `Total calls to ${className}.${methodName}`);
1206
- const errorCounter = createCounter(`${baseName}_errors_total`, `Total errors in ${className}.${methodName}`);
1207
- descriptor.value = async function(...args) {
1208
- if (!isFeatureEnabled("metrics")) {
1209
- return originalMethod.apply(this, args);
1210
- }
1211
- const startTime = Date.now();
1212
- let result;
1213
- let hasError = false;
1214
- try {
1215
- result = await originalMethod.apply(this, args);
1216
- return result;
1217
- } catch (error) {
1218
- hasError = true;
1219
- throw error;
1220
- } finally {
1221
- const duration = Date.now() - startTime;
1222
- let labels = {};
1223
- if (options.labels) {
1224
- labels = typeof options.labels === "function" ? options.labels(args, result) : options.labels;
1225
- }
1226
- if (options.recordDuration !== false) {
1227
- durationHistogram.record(duration, labels);
1228
- }
1229
- if (options.recordCount !== false) {
1230
- totalCounter.inc({
1231
- ...labels,
1232
- status: hasError ? "error" : "success"
1233
- });
1234
- }
1235
- if (hasError) {
1236
- errorCounter.inc(labels);
1237
- }
1238
- }
1239
- };
1240
- return descriptor;
1241
- };
1242
- }
1243
- __name(Metric, "Metric");
1244
- function Log(options = {}) {
1245
- return function(target, propertyKey, descriptor) {
1246
- const originalMethod = descriptor.value;
1247
- if (typeof originalMethod !== "function") {
1248
- return descriptor;
1249
- }
1250
- const className = target.constructor.name;
1251
- const methodName = String(propertyKey);
1252
- const level = options.level || "debug";
1253
- const logEntry = options.logEntry !== false;
1254
- const logExit = options.logExit !== false;
1255
- const logError = options.logError !== false;
1256
- descriptor.value = async function(...args) {
1257
- if (!isFeatureEnabled("logging")) {
1258
- return originalMethod.apply(this, args);
1259
- }
1260
- const baseMessage = options.message || `${className}.${methodName}`;
1261
- if (logEntry) {
1262
- const entryData = {
1263
- class: className,
1264
- method: methodName
1265
- };
1266
- if (options.includeArgs) {
1267
- entryData["args"] = args;
1268
- }
1269
- logger[level](`[Enter] ${baseMessage}`, entryData);
1270
- }
1271
- const startTime = Date.now();
1272
- try {
1273
- const result = await originalMethod.apply(this, args);
1274
- if (logExit) {
1275
- const duration = Date.now() - startTime;
1276
- const exitData = {
1277
- class: className,
1278
- method: methodName,
1279
- duration: `${duration}ms`
1280
- };
1281
- if (options.includeResult) {
1282
- exitData["result"] = result;
1283
- }
1284
- logger[level](`[Exit] ${baseMessage}`, exitData);
1285
- }
1286
- return result;
1287
- } catch (error) {
1288
- if (logError) {
1289
- const duration = Date.now() - startTime;
1290
- logger.error(`[Error] ${baseMessage}`, {
1291
- class: className,
1292
- method: methodName,
1293
- duration: `${duration}ms`,
1294
- error: error instanceof Error ? error.message : String(error)
1295
- });
1296
- }
1297
- throw error;
1298
- }
1299
- };
1300
- return descriptor;
1301
- };
1302
- }
1303
- __name(Log, "Log");
1304
- function shouldSkipInstrumentation(skipOption, args) {
1305
- if (!skipOption) {
1306
- return false;
1307
- }
1308
- return typeof skipOption === "function" ? skipOption(args) : skipOption;
1309
- }
1310
- __name(shouldSkipInstrumentation, "shouldSkipInstrumentation");
1311
- function startInstrumentationSpan(traceOpts, operationName, operationType, methodName, className, args) {
1312
- if (traceOpts === null || !isFeatureEnabled("tracing")) {
1313
- return null;
1314
- }
1315
- const tracer = getTracer();
1316
- const span = tracer.startSpan(traceOpts?.["name"] || operationName, traceOpts?.["kind"] || SpanKind.INTERNAL);
1317
- span.setAttributes({
1318
- "operation.type": operationType,
1319
- "code.function": methodName,
1320
- "code.namespace": className,
1321
- ...traceOpts?.["attributes"]
1322
- });
1323
- if (traceOpts?.["extractAttributes"]) {
1324
- try {
1325
- const extractFn = traceOpts["extractAttributes"];
1326
- span.setAttributes(extractFn(args));
1327
- } catch {
1328
- }
1329
- }
1330
- return span;
1331
- }
1332
- __name(startInstrumentationSpan, "startInstrumentationSpan");
1333
- function logInstrumentationEntry(logOpts, operationName, operationType, args) {
1334
- if (logOpts === null || !isFeatureEnabled("logging")) {
1335
- return;
1336
- }
1337
- if (logOpts?.["logEntry"] === false) {
1338
- return;
1339
- }
1340
- const level = logOpts?.["level"] || "debug";
1341
- logger[level](`[Enter] ${operationName}`, {
1342
- operation: operationName,
1343
- type: operationType,
1344
- ...logOpts?.["includeArgs"] ? {
1345
- args
1346
- } : {}
1347
- });
1348
- }
1349
- __name(logInstrumentationEntry, "logInstrumentationEntry");
1350
- function handleInstrumentationSuccess(span, traceOpts, result) {
1351
- if (!span) {
1352
- return;
1353
- }
1354
- span.setStatus(SpanStatus.OK);
1355
- if (traceOpts?.["includeResult"]) {
1356
- try {
1357
- span.setAttribute("result", JSON.stringify(result).substring(0, 500));
1358
- } catch {
1359
- }
1360
- }
1361
- }
1362
- __name(handleInstrumentationSuccess, "handleInstrumentationSuccess");
1363
- function handleInstrumentationError(span, logOpts, operationName, operationType, error, startTime) {
1364
- if (span && error instanceof Error) {
1365
- span.recordException(error);
1366
- }
1367
- if (logOpts !== null && isFeatureEnabled("logging") && logOpts?.["logError"] !== false) {
1368
- logger.error(`[Error] ${operationName}`, {
1369
- operation: operationName,
1370
- type: operationType,
1371
- error: error instanceof Error ? error.message : String(error),
1372
- duration: `${Date.now() - startTime}ms`
1373
- });
1374
- }
1375
- }
1376
- __name(handleInstrumentationError, "handleInstrumentationError");
1377
- function recordInstrumentationMetrics(metricOpts, durationHistogram, totalCounter, errorCounter, duration, args, result, hasError) {
1378
- if (metricOpts === null || !isFeatureEnabled("metrics")) {
1379
- return;
1380
- }
1381
- const labelsFn = metricOpts?.["labels"];
1382
- const labelsObj = metricOpts?.["labels"];
1383
- const labels = typeof metricOpts?.["labels"] === "function" ? labelsFn?.(args, result) : labelsObj || {};
1384
- if (durationHistogram && metricOpts?.["recordDuration"] !== false) {
1385
- durationHistogram.record(duration, labels);
1386
- }
1387
- if (totalCounter && metricOpts?.["recordCount"] !== false) {
1388
- totalCounter.inc({
1389
- ...labels,
1390
- status: hasError ? "error" : "success"
1391
- });
1392
- }
1393
- if (errorCounter && hasError) {
1394
- errorCounter.inc(labels);
1395
- }
1396
- }
1397
- __name(recordInstrumentationMetrics, "recordInstrumentationMetrics");
1398
- function logInstrumentationExit(logOpts, operationName, operationType, duration, result, hasError) {
1399
- if (logOpts === null || !isFeatureEnabled("logging")) {
1400
- return;
1401
- }
1402
- if (logOpts?.["logExit"] === false || hasError) {
1403
- return;
1404
- }
1405
- const level = logOpts?.["level"] || "debug";
1406
- logger[level](`[Exit] ${operationName}`, {
1407
- operation: operationName,
1408
- type: operationType,
1409
- duration: `${duration}ms`,
1410
- ...logOpts?.["includeResult"] ? {
1411
- result
1412
- } : {}
1413
- });
1414
- }
1415
- __name(logInstrumentationExit, "logInstrumentationExit");
1416
- function Instrument(options = {}) {
1417
- return function(target, propertyKey, descriptor) {
1418
- const originalMethod = descriptor.value;
1419
- if (typeof originalMethod !== "function") {
1420
- return descriptor;
1421
- }
1422
- const className = target.constructor.name;
1423
- const methodName = String(propertyKey);
1424
- const operationName = options.operationName || `${className}.${methodName}`;
1425
- const operationType = options.operationType || "internal";
1426
- let traceOpts;
1427
- if (options.trace === true) {
1428
- traceOpts = {};
1429
- } else if (options.trace === false || options.trace === void 0) {
1430
- traceOpts = null;
1431
- } else {
1432
- traceOpts = options.trace;
1433
- }
1434
- let metricOpts;
1435
- if (options.metrics === true) {
1436
- metricOpts = {};
1437
- } else if (options.metrics === false || options.metrics === void 0) {
1438
- metricOpts = null;
1439
- } else {
1440
- metricOpts = options.metrics;
1441
- }
1442
- let logOpts;
1443
- if (options.log === true) {
1444
- logOpts = {};
1445
- } else if (options.log === false || options.log === void 0) {
1446
- logOpts = null;
1447
- } else {
1448
- logOpts = options.log;
1449
- }
1450
- let durationHistogram = null;
1451
- let totalCounter = null;
1452
- let errorCounter = null;
1453
- if (metricOpts !== null) {
1454
- const baseName = metricOpts?.["name"] || `${className.toLowerCase()}_${methodName.toLowerCase()}`;
1455
- durationHistogram = createHistogram(`${baseName}_duration_ms`, `Duration of ${operationName} in ms`);
1456
- totalCounter = createCounter(`${baseName}_total`, `Total calls to ${operationName}`);
1457
- errorCounter = createCounter(`${baseName}_errors_total`, `Total errors in ${operationName}`);
1458
- }
1459
- descriptor.value = async function(...args) {
1460
- if (shouldSkipInstrumentation(options.skip, args)) {
1461
- return originalMethod.apply(this, args);
1462
- }
1463
- const startTime = Date.now();
1464
- let hasError = false;
1465
- let result;
1466
- const span = startInstrumentationSpan(traceOpts, operationName, operationType, methodName, className, args);
1467
- logInstrumentationEntry(logOpts, operationName, operationType, args);
1468
- try {
1469
- result = await originalMethod.apply(this, args);
1470
- handleInstrumentationSuccess(span, traceOpts, result);
1471
- return result;
1472
- } catch (error) {
1473
- hasError = true;
1474
- handleInstrumentationError(span, logOpts, operationName, operationType, error, startTime);
1475
- throw error;
1476
- } finally {
1477
- const duration = Date.now() - startTime;
1478
- if (span) {
1479
- span.end();
1480
- }
1481
- recordInstrumentationMetrics(metricOpts, durationHistogram, totalCounter, errorCounter, duration, args, result, hasError);
1482
- logInstrumentationExit(logOpts, operationName, operationType, duration, result, hasError);
1483
- }
1484
- };
1485
- return descriptor;
1486
- };
1487
- }
1488
- __name(Instrument, "Instrument");
1489
- function traced(name, fn, options) {
1490
- return async (...args) => {
1491
- if (!isFeatureEnabled("tracing")) {
1492
- return fn(...args);
1493
- }
1494
- const tracer = getTracer();
1495
- const span = tracer.startSpan(name, options?.kind || SpanKind.INTERNAL);
1496
- if (options?.attributes) {
1497
- span.setAttributes(options.attributes);
1498
- }
1499
- try {
1500
- const result = await fn(...args);
1501
- span.setStatus(SpanStatus.OK);
1502
- return result;
1503
- } catch (error) {
1504
- if (error instanceof Error) {
1505
- span.recordException(error);
1506
- }
1507
- throw error;
1508
- } finally {
1509
- span.end();
1510
- }
1511
- };
1512
- }
1513
- __name(traced, "traced");
1514
- function instrumented(name, fn, options) {
1515
- const operationType = options?.operationType || "internal";
1516
- const durationHistogram = options?.metrics !== false ? createHistogram(`${name.toLowerCase()}_duration_ms`, `Duration of ${name} in ms`) : null;
1517
- const totalCounter = options?.metrics !== false ? createCounter(`${name.toLowerCase()}_total`, `Total calls to ${name}`) : null;
1518
- return async (...args) => {
1519
- const startTime = Date.now();
1520
- let span = null;
1521
- let hasError = false;
1522
- if (options?.trace !== false && isFeatureEnabled("tracing")) {
1523
- span = getTracer().startSpan(name, SpanKind.INTERNAL);
1524
- span.setAttribute("operation.type", operationType);
1525
- }
1526
- if (options?.log !== false && isFeatureEnabled("logging")) {
1527
- logger.debug(`[Enter] ${name}`, {
1528
- operation: name,
1529
- type: operationType
1530
- });
1531
- }
1532
- try {
1533
- const result = await fn(...args);
1534
- if (span) span.setStatus(SpanStatus.OK);
1535
- return result;
1536
- } catch (error) {
1537
- hasError = true;
1538
- if (span && error instanceof Error) span.recordException(error);
1539
- throw error;
1540
- } finally {
1541
- const duration = Date.now() - startTime;
1542
- if (span) span.end();
1543
- if (durationHistogram && isFeatureEnabled("metrics")) {
1544
- durationHistogram.record(duration, {
1545
- status: hasError ? "error" : "success"
1546
- });
1547
- }
1548
- if (totalCounter && isFeatureEnabled("metrics")) {
1549
- totalCounter.inc({
1550
- status: hasError ? "error" : "success"
1551
- });
1552
- }
1553
- if (options?.log !== false && isFeatureEnabled("logging")) {
1554
- if (hasError) {
1555
- logger.error(`[Error] ${name}`, {
1556
- operation: name,
1557
- duration: `${duration}ms`
1558
- });
1559
- } else {
1560
- logger.debug(`[Exit] ${name}`, {
1561
- operation: name,
1562
- duration: `${duration}ms`
1563
- });
1564
- }
1565
- }
1566
- }
1567
- };
1568
- }
1569
- __name(instrumented, "instrumented");
1570
-
1571
- // src/instrumentation/index.ts
1572
- function getLogger() {
1573
- return getActiveTelemetryLogger() ?? logger;
1574
- }
1575
- __name(getLogger, "getLogger");
1576
- function initializeInstrumentation(serviceName, options) {
1577
- initializeInstrumentationConfig(serviceName, options);
1578
- initializeTracer(serviceName);
1579
- initializeMetricsRegistry(serviceName);
1580
- return {
1581
- tracer: getTracer(),
1582
- metrics: getMetricsRegistry(),
1583
- config: getInstrumentationConfig()
1584
- };
1585
- }
1586
- __name(initializeInstrumentation, "initializeInstrumentation");
1587
- function isInstrumentationInitialized() {
1588
- return isInstrumentationConfigInitialized() && isTracerInitialized() && isMetricsRegistryInitialized();
1589
- }
1590
- __name(isInstrumentationInitialized, "isInstrumentationInitialized");
1591
- function resetInstrumentation() {
1592
- resetInstrumentationConfig();
1593
- resetMetricsRegistry();
1594
- }
1595
- __name(resetInstrumentation, "resetInstrumentation");
1596
- function setupInstrumentation(serviceName, options) {
1597
- const { tracer, metrics, config } = initializeInstrumentation(serviceName, options);
1598
- const plugins = [];
1599
- const useApollo = options?.useApolloInlineTrace ?? true;
1600
- if (useApollo) {
1601
- const apolloPlugin = createApolloInlineTracePlugin();
1602
- if (apolloPlugin) {
1603
- plugins.push(apolloPlugin);
1604
- }
1605
- }
1606
- const usePrometheus = options?.usePrometheus ?? true;
1607
- if (usePrometheus) {
1608
- const prometheusPlugin = createPrometheusPlugin(options?.prometheus);
1609
- if (prometheusPlugin) {
1610
- plugins.push(prometheusPlugin);
1611
- }
1612
- }
1613
- return {
1614
- tracer,
1615
- metrics,
1616
- config,
1617
- plugins
1618
- };
1619
- }
1620
- __name(setupInstrumentation, "setupInstrumentation");
1621
-
1622
- export { Instrument, Log, Metric, STANDARD_METRICS, SpanKind, SpanStatus, Trace, Tracer, createApolloInlineTracePlugin, createGraphQLInstrumentationPlugin, createPrometheusPlugin, extractOperationInfo, extractTraceContext, getGraphQLOperationFromContext, getGraphQLSpanFromContext, getLogger, getTraceContext, getTracer, initializeInstrumentation, initializeTracer, injectTraceContext, instrumentResolver, instrumentResolverMap, instrumentation_exports, instrumented, isApolloInlineTraceAvailable, isInstrumentationInitialized, isPrometheusAvailable, isTracerInitialized, resetInstrumentation, setActiveTelemetryLogger, setupInstrumentation, startSpan, traced, withSpan };
1623
- //# sourceMappingURL=chunk-RYTSVGGA.js.map
1624
- //# sourceMappingURL=chunk-RYTSVGGA.js.map