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