@geekmidas/telescope 10.0.0-alpha.99 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (480) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +18 -28
  3. package/dist/InMemoryMetricsStorage-BbKCL3YL.d.mts +47 -0
  4. package/dist/InMemoryMetricsStorage-BbKCL3YL.d.mts.map +1 -0
  5. package/dist/InMemoryMetricsStorage-C4drxT7G.mjs +247 -0
  6. package/dist/InMemoryMetricsStorage-C4drxT7G.mjs.map +1 -0
  7. package/dist/InMemoryMetricsStorage-D0njWUSi.cjs +252 -0
  8. package/dist/InMemoryMetricsStorage-D0njWUSi.cjs.map +1 -0
  9. package/dist/InMemoryMetricsStorage-TvPdZjL0.d.cts +47 -0
  10. package/dist/InMemoryMetricsStorage-TvPdZjL0.d.cts.map +1 -0
  11. package/dist/{MetricsAggregator-BJdIvfEv.d.mts → MetricsAggregator-4SqelGcG.d.cts} +6 -3
  12. package/dist/MetricsAggregator-4SqelGcG.d.cts.map +1 -0
  13. package/dist/MetricsAggregator-B7lUICdH.cjs +363 -0
  14. package/dist/MetricsAggregator-B7lUICdH.cjs.map +1 -0
  15. package/dist/{MetricsAggregator-CnC3oT5q.d.cts → MetricsAggregator-DZrW8ls6.d.mts} +6 -3
  16. package/dist/MetricsAggregator-DZrW8ls6.d.mts.map +1 -0
  17. package/dist/MetricsAggregator-S3DQWNas.mjs +357 -0
  18. package/dist/MetricsAggregator-S3DQWNas.mjs.map +1 -0
  19. package/dist/MetricsStorage-B86e4131.d.cts +60 -0
  20. package/dist/MetricsStorage-B86e4131.d.cts.map +1 -0
  21. package/dist/MetricsStorage-BWyP2_12.d.mts +60 -0
  22. package/dist/MetricsStorage-BWyP2_12.d.mts.map +1 -0
  23. package/dist/MetricsStorage-BypQXWiv.mjs +0 -0
  24. package/dist/MetricsStorage-Or8pVCe4.cjs +0 -0
  25. package/dist/Telescope-Cs3fv8jt.cjs +395 -0
  26. package/dist/Telescope-Cs3fv8jt.cjs.map +1 -0
  27. package/dist/{Telescope-BVfDvVvY.d.mts → Telescope-D4nmwDRA.d.cts} +7 -4
  28. package/dist/Telescope-D4nmwDRA.d.cts.map +1 -0
  29. package/dist/Telescope-Dh5av3FC.mjs +389 -0
  30. package/dist/Telescope-Dh5av3FC.mjs.map +1 -0
  31. package/dist/{Telescope-DeqSHfuB.d.cts → Telescope-Dl6VSfxd.d.mts} +7 -4
  32. package/dist/Telescope-Dl6VSfxd.d.mts.map +1 -0
  33. package/dist/Telescope.cjs +4 -385
  34. package/dist/Telescope.d.cts +3 -1
  35. package/dist/Telescope.d.mts +3 -1
  36. package/dist/Telescope.mjs +4 -384
  37. package/dist/adapters/index.d.cts +2 -2
  38. package/dist/adapters/index.d.mts +2 -2
  39. package/dist/adapters/index.mjs +0 -1
  40. package/dist/adapters/lambda.cjs +10 -9
  41. package/dist/adapters/lambda.cjs.map +1 -1
  42. package/dist/adapters/lambda.d.cts +13 -9
  43. package/dist/adapters/lambda.d.cts.map +1 -1
  44. package/dist/adapters/lambda.d.mts +13 -9
  45. package/dist/adapters/lambda.d.mts.map +1 -1
  46. package/dist/adapters/lambda.mjs +4 -3
  47. package/dist/adapters/lambda.mjs.map +1 -1
  48. package/dist/adapters/middy.cjs +4 -236
  49. package/dist/adapters/middy.d.cts +5 -60
  50. package/dist/adapters/middy.d.mts +5 -60
  51. package/dist/adapters/middy.mjs +3 -234
  52. package/dist/adapters/types.d.cts +2 -162
  53. package/dist/adapters/types.d.mts +2 -162
  54. package/dist/adapters/types.mjs +0 -1
  55. package/dist/{rolldown-runtime-VH7oDXx4.cjs → chunk-CUT6urMc.cjs} +10 -8
  56. package/dist/core--quSp5Qr.d.mts +78 -0
  57. package/dist/core--quSp5Qr.d.mts.map +1 -0
  58. package/dist/core-B4Jpia5H.d.cts +78 -0
  59. package/dist/core-B4Jpia5H.d.cts.map +1 -0
  60. package/dist/core-CtVHRJGv.cjs +199 -0
  61. package/dist/core-CtVHRJGv.cjs.map +1 -0
  62. package/dist/core-D6hJ6exL.mjs +139 -0
  63. package/dist/core-D6hJ6exL.mjs.map +1 -0
  64. package/dist/core.cjs +22 -22
  65. package/dist/core.d.cts +4 -4
  66. package/dist/core.d.mts +4 -4
  67. package/dist/core.mjs +4 -3
  68. package/dist/hono--uKQ7Jgi.d.mts +71 -0
  69. package/dist/hono--uKQ7Jgi.d.mts.map +1 -0
  70. package/dist/hono-C4EgpbKQ.cjs +160 -0
  71. package/dist/hono-C4EgpbKQ.cjs.map +1 -0
  72. package/dist/hono-CemCKU87.d.cts +71 -0
  73. package/dist/hono-CemCKU87.d.cts.map +1 -0
  74. package/dist/hono-DxhvnVbF.mjs +136 -0
  75. package/dist/hono-DxhvnVbF.mjs.map +1 -0
  76. package/dist/http-BiNtg85L.d.mts +107 -0
  77. package/dist/http-BiNtg85L.d.mts.map +1 -0
  78. package/dist/http-DQzgLczm.mjs +159 -0
  79. package/dist/http-DQzgLczm.mjs.map +1 -0
  80. package/dist/http-D_Z8sYXZ.cjs +219 -0
  81. package/dist/http-D_Z8sYXZ.cjs.map +1 -0
  82. package/dist/http-Dvca6fC3.d.cts +107 -0
  83. package/dist/http-Dvca6fC3.d.cts.map +1 -0
  84. package/dist/index-BL32-cvv.d.cts +1 -0
  85. package/dist/index-CsuikFeJ.d.mts +1 -0
  86. package/dist/index.cjs +9 -8
  87. package/dist/index.d.cts +6 -5
  88. package/dist/index.d.mts +6 -5
  89. package/dist/index.mjs +7 -5
  90. package/dist/instrumentation/core.cjs +11 -147
  91. package/dist/instrumentation/core.d.cts +3 -74
  92. package/dist/instrumentation/core.d.mts +3 -74
  93. package/dist/instrumentation/core.mjs +2 -137
  94. package/dist/instrumentation/hono.cjs +6 -174
  95. package/dist/instrumentation/hono.d.cts +2 -86
  96. package/dist/instrumentation/hono.d.mts +2 -86
  97. package/dist/instrumentation/hono.mjs +3 -170
  98. package/dist/instrumentation/http.cjs +11 -189
  99. package/dist/instrumentation/http.d.cts +2 -119
  100. package/dist/instrumentation/http.d.mts +2 -119
  101. package/dist/instrumentation/http.mjs +2 -178
  102. package/dist/instrumentation/index.cjs +47 -56
  103. package/dist/instrumentation/index.d.cts +9 -11
  104. package/dist/instrumentation/index.d.mts +9 -11
  105. package/dist/instrumentation/index.mjs +9 -10
  106. package/dist/instrumentation/middleware.cjs +6 -164
  107. package/dist/instrumentation/middleware.d.cts +2 -83
  108. package/dist/instrumentation/middleware.d.mts +2 -83
  109. package/dist/instrumentation/middleware.mjs +3 -160
  110. package/dist/instrumentation/otel.cjs +3 -137
  111. package/dist/instrumentation/otel.d.cts +2 -97
  112. package/dist/instrumentation/otel.d.mts +2 -97
  113. package/dist/instrumentation/otel.mjs +3 -136
  114. package/dist/instrumentation/setup.cjs +4 -142
  115. package/dist/instrumentation/setup.d.cts +3 -139
  116. package/dist/instrumentation/setup.d.mts +3 -139
  117. package/dist/instrumentation/setup.mjs +3 -139
  118. package/dist/instrumentation/tracing.cjs +10 -114
  119. package/dist/instrumentation/tracing.d.cts +2 -49
  120. package/dist/instrumentation/tracing.d.mts +2 -49
  121. package/dist/instrumentation/tracing.mjs +2 -105
  122. package/dist/logger/console.cjs +12 -18
  123. package/dist/logger/console.cjs.map +1 -1
  124. package/dist/logger/console.d.cts +10 -7
  125. package/dist/logger/console.d.cts.map +1 -1
  126. package/dist/logger/console.d.mts +10 -7
  127. package/dist/logger/console.d.mts.map +1 -1
  128. package/dist/logger/console.mjs +11 -17
  129. package/dist/logger/console.mjs.map +1 -1
  130. package/dist/logger/pino.cjs +5 -6
  131. package/dist/logger/pino.cjs.map +1 -1
  132. package/dist/logger/pino.d.cts +10 -6
  133. package/dist/logger/pino.d.cts.map +1 -1
  134. package/dist/logger/pino.d.mts +10 -6
  135. package/dist/logger/pino.d.mts.map +1 -1
  136. package/dist/logger/pino.mjs +3 -2
  137. package/dist/logger/pino.mjs.map +1 -1
  138. package/dist/memory--BK4iWiv.d.cts +40 -0
  139. package/dist/memory--BK4iWiv.d.cts.map +1 -0
  140. package/dist/memory-6S9H-IF5.mjs +123 -0
  141. package/dist/memory-6S9H-IF5.mjs.map +1 -0
  142. package/dist/memory-B0d_n1g5.cjs +129 -0
  143. package/dist/memory-B0d_n1g5.cjs.map +1 -0
  144. package/dist/memory-DCirEVFW.d.mts +40 -0
  145. package/dist/memory-DCirEVFW.d.mts.map +1 -0
  146. package/dist/metrics/MetricsAggregator.cjs +2 -354
  147. package/dist/metrics/MetricsAggregator.d.cts +2 -1
  148. package/dist/metrics/MetricsAggregator.d.mts +2 -1
  149. package/dist/metrics/MetricsAggregator.mjs +2 -353
  150. package/dist/metrics/index.cjs +4 -3
  151. package/dist/metrics/index.d.cts +4 -2
  152. package/dist/metrics/index.d.mts +4 -2
  153. package/dist/metrics/index.mjs +4 -2
  154. package/dist/metrics/storage/InMemoryMetricsStorage.cjs +3 -240
  155. package/dist/metrics/storage/InMemoryMetricsStorage.d.cts +4 -43
  156. package/dist/metrics/storage/InMemoryMetricsStorage.d.mts +4 -43
  157. package/dist/metrics/storage/InMemoryMetricsStorage.mjs +3 -239
  158. package/dist/metrics/storage/MetricsStorage.cjs +1 -0
  159. package/dist/metrics/storage/MetricsStorage.d.cts +3 -56
  160. package/dist/metrics/storage/MetricsStorage.d.mts +3 -56
  161. package/dist/metrics/storage/MetricsStorage.mjs +1 -1
  162. package/dist/metrics/storage/index.cjs +6 -6
  163. package/dist/metrics/storage/index.d.cts +3 -3
  164. package/dist/metrics/storage/index.d.mts +3 -3
  165. package/dist/metrics/storage/index.mjs +5 -4
  166. package/dist/metrics/storage/types.cjs +2 -34
  167. package/dist/metrics/storage/types.d.cts +2 -207
  168. package/dist/metrics/storage/types.d.mts +2 -207
  169. package/dist/metrics/storage/types.mjs +2 -33
  170. package/dist/metrics-D5YT-Rnq.mjs +0 -0
  171. package/dist/metrics-fhD3l3C3.cjs +0 -0
  172. package/dist/middleware-B2jFUukM.cjs +184 -0
  173. package/dist/middleware-B2jFUukM.cjs.map +1 -0
  174. package/dist/middleware-BTDncHwm.mjs +160 -0
  175. package/dist/middleware-BTDncHwm.mjs.map +1 -0
  176. package/dist/middleware-CA84nsNN.d.cts +74 -0
  177. package/dist/middleware-CA84nsNN.d.cts.map +1 -0
  178. package/dist/middleware-DAceVpfw.d.mts +74 -0
  179. package/dist/middleware-DAceVpfw.d.mts.map +1 -0
  180. package/dist/middy-B6Btl8XE.d.mts +64 -0
  181. package/dist/middy-B6Btl8XE.d.mts.map +1 -0
  182. package/dist/middy-BTR3cyvk.mjs +236 -0
  183. package/dist/middy-BTR3cyvk.mjs.map +1 -0
  184. package/dist/middy-Bq0defVg.d.cts +64 -0
  185. package/dist/middy-Bq0defVg.d.cts.map +1 -0
  186. package/dist/middy-y5Zp27eG.cjs +247 -0
  187. package/dist/middy-y5Zp27eG.cjs.map +1 -0
  188. package/dist/otel-1bJPb2Z7.d.mts +101 -0
  189. package/dist/otel-1bJPb2Z7.d.mts.map +1 -0
  190. package/dist/otel-C1HqHA2O.cjs +136 -0
  191. package/dist/otel-C1HqHA2O.cjs.map +1 -0
  192. package/dist/otel-SBVoVEHr.d.cts +101 -0
  193. package/dist/otel-SBVoVEHr.d.cts.map +1 -0
  194. package/dist/otel-wulj5B-X.mjs +130 -0
  195. package/dist/otel-wulj5B-X.mjs.map +1 -0
  196. package/dist/otlp/hono.cjs +15 -9
  197. package/dist/otlp/hono.cjs.map +1 -1
  198. package/dist/otlp/hono.d.cts +13 -3
  199. package/dist/otlp/hono.d.cts.map +1 -1
  200. package/dist/otlp/hono.d.mts +13 -3
  201. package/dist/otlp/hono.d.mts.map +1 -1
  202. package/dist/otlp/hono.mjs +11 -5
  203. package/dist/otlp/hono.mjs.map +1 -1
  204. package/dist/otlp/index.cjs +11 -11
  205. package/dist/otlp/index.d.cts +7 -4
  206. package/dist/otlp/index.d.mts +7 -4
  207. package/dist/otlp/index.mjs +5 -4
  208. package/dist/otlp/receiver.cjs +4 -88
  209. package/dist/otlp/receiver.d.cts +7 -59
  210. package/dist/otlp/receiver.d.mts +7 -59
  211. package/dist/otlp/receiver.mjs +4 -87
  212. package/dist/otlp/transformer.cjs +5 -214
  213. package/dist/otlp/transformer.d.cts +3 -1
  214. package/dist/otlp/transformer.d.mts +3 -1
  215. package/dist/otlp/transformer.mjs +3 -211
  216. package/dist/otlp/types.cjs +5 -57
  217. package/dist/otlp/types.d.cts +1 -1
  218. package/dist/otlp/types.d.mts +1 -1
  219. package/dist/otlp/types.mjs +2 -53
  220. package/dist/receiver-Cj1lbAOO.cjs +94 -0
  221. package/dist/receiver-Cj1lbAOO.cjs.map +1 -0
  222. package/dist/receiver-CxVd_9CB.mjs +89 -0
  223. package/dist/receiver-CxVd_9CB.mjs.map +1 -0
  224. package/dist/receiver-DLICx5uU.d.cts +63 -0
  225. package/dist/receiver-DLICx5uU.d.cts.map +1 -0
  226. package/dist/receiver-UeZT-H8u.d.mts +63 -0
  227. package/dist/receiver-UeZT-H8u.d.mts.map +1 -0
  228. package/dist/redact-BzkITCNW.mjs +83 -0
  229. package/dist/redact-BzkITCNW.mjs.map +1 -0
  230. package/dist/redact-DVaSSPZT.cjs +95 -0
  231. package/dist/redact-DVaSSPZT.cjs.map +1 -0
  232. package/dist/redact.cjs +3 -84
  233. package/dist/redact.d.cts +8 -4
  234. package/dist/redact.d.cts.map +1 -1
  235. package/dist/redact.d.mts +8 -4
  236. package/dist/redact.d.mts.map +1 -1
  237. package/dist/redact.mjs +2 -80
  238. package/dist/server/hono.cjs +54 -33
  239. package/dist/server/hono.cjs.map +1 -1
  240. package/dist/server/hono.d.cts +14 -19
  241. package/dist/server/hono.d.cts.map +1 -1
  242. package/dist/server/hono.d.mts +14 -19
  243. package/dist/server/hono.d.mts.map +1 -1
  244. package/dist/server/hono.mjs +52 -31
  245. package/dist/server/hono.mjs.map +1 -1
  246. package/dist/setup-B9jM77Qk.mjs +98 -0
  247. package/dist/setup-B9jM77Qk.mjs.map +1 -0
  248. package/dist/setup-Bkxm4g6b.d.mts +87 -0
  249. package/dist/setup-Bkxm4g6b.d.mts.map +1 -0
  250. package/dist/setup-CYpff5B9.cjs +110 -0
  251. package/dist/setup-CYpff5B9.cjs.map +1 -0
  252. package/dist/setup-D58N1f9O.d.cts +87 -0
  253. package/dist/setup-D58N1f9O.d.cts.map +1 -0
  254. package/dist/storage/kysely.cjs +70 -82
  255. package/dist/storage/kysely.cjs.map +1 -1
  256. package/dist/storage/kysely.d.cts +20 -36
  257. package/dist/storage/kysely.d.cts.map +1 -1
  258. package/dist/storage/kysely.d.mts +20 -36
  259. package/dist/storage/kysely.d.mts.map +1 -1
  260. package/dist/storage/kysely.mjs +69 -81
  261. package/dist/storage/kysely.mjs.map +1 -1
  262. package/dist/storage/memory.cjs +2 -122
  263. package/dist/storage/memory.d.cts +3 -36
  264. package/dist/storage/memory.d.mts +3 -36
  265. package/dist/storage/memory.mjs +2 -121
  266. package/dist/tracing-BX8uY2nR.d.cts +53 -0
  267. package/dist/tracing-BX8uY2nR.d.cts.map +1 -0
  268. package/dist/tracing-Bt1zWRlb.cjs +167 -0
  269. package/dist/tracing-Bt1zWRlb.cjs.map +1 -0
  270. package/dist/tracing-Cijm_5NI.mjs +113 -0
  271. package/dist/tracing-Cijm_5NI.mjs.map +1 -0
  272. package/dist/tracing-PnECEbEu.d.mts +53 -0
  273. package/dist/tracing-PnECEbEu.d.mts.map +1 -0
  274. package/dist/transformer-BXQPhzql.mjs +215 -0
  275. package/dist/transformer-BXQPhzql.mjs.map +1 -0
  276. package/dist/transformer-CLGZ0EQc.cjs +232 -0
  277. package/dist/transformer-CLGZ0EQc.cjs.map +1 -0
  278. package/dist/{transformer-BtqjAs0b.d.cts → transformer-CTGsaVfV.d.mts} +8 -4
  279. package/dist/transformer-CTGsaVfV.d.mts.map +1 -0
  280. package/dist/{transformer-DI6t8-YA.d.mts → transformer-ICEbxpFf.d.cts} +8 -4
  281. package/dist/transformer-ICEbxpFf.d.cts.map +1 -0
  282. package/dist/{types-BVujq4zd.d.mts → types-B1EIa_cQ.d.mts} +4 -3
  283. package/dist/types-B1EIa_cQ.d.mts.map +1 -0
  284. package/dist/types-BRzW1NM8.d.cts +166 -0
  285. package/dist/types-BRzW1NM8.d.cts.map +1 -0
  286. package/dist/types-BS3Rx8Sk.d.cts +209 -0
  287. package/dist/types-BS3Rx8Sk.d.cts.map +1 -0
  288. package/dist/types-Bwm_jNU7.mjs +54 -0
  289. package/dist/types-Bwm_jNU7.mjs.map +1 -0
  290. package/dist/types-BzQ78Efw.d.mts +166 -0
  291. package/dist/types-BzQ78Efw.d.mts.map +1 -0
  292. package/dist/types-CbNGXnJE.d.mts +209 -0
  293. package/dist/types-CbNGXnJE.d.mts.map +1 -0
  294. package/dist/{types-DVETVdpa.d.cts → types-CmOB7CLO.d.cts} +7 -6
  295. package/dist/types-CmOB7CLO.d.cts.map +1 -0
  296. package/dist/{types-DVETVdpa.d.mts → types-DBc0q5KD.d.mts} +7 -6
  297. package/dist/types-DBc0q5KD.d.mts.map +1 -0
  298. package/dist/types-Dsh-DIO_.cjs +78 -0
  299. package/dist/types-Dsh-DIO_.cjs.map +1 -0
  300. package/dist/types-ZW-nfWf6.cjs +40 -0
  301. package/dist/types-ZW-nfWf6.cjs.map +1 -0
  302. package/dist/{types-BVujq4zd.d.cts → types-l7Rlb5Mg.d.cts} +4 -3
  303. package/dist/types-l7Rlb5Mg.d.cts.map +1 -0
  304. package/dist/types-ojhnLdwz.mjs +34 -0
  305. package/dist/types-ojhnLdwz.mjs.map +1 -0
  306. package/dist/types.d.cts +1 -1
  307. package/dist/types.d.mts +1 -1
  308. package/dist/types.mjs +0 -1
  309. package/dist/ui-assets-BEXqOQLe.cjs +48 -0
  310. package/dist/ui-assets-BEXqOQLe.cjs.map +1 -0
  311. package/dist/ui-assets-BhTDUsrM.mjs +30 -0
  312. package/dist/ui-assets-BhTDUsrM.mjs.map +1 -0
  313. package/dist/ui-assets.cjs +5 -0
  314. package/dist/ui-assets.d.cts +13 -0
  315. package/dist/ui-assets.d.cts.map +1 -0
  316. package/dist/ui-assets.d.mts +13 -0
  317. package/dist/ui-assets.d.mts.map +1 -0
  318. package/dist/ui-assets.mjs +3 -0
  319. package/package.json +46 -46
  320. package/src/Telescope.ts +561 -0
  321. package/src/__tests__/Telescope.spec.ts +438 -0
  322. package/src/__tests__/pino-transport.spec.ts +115 -0
  323. package/src/__tests__/redact.spec.ts +336 -0
  324. package/src/adapters/__tests__/lambda.spec.ts +318 -0
  325. package/src/adapters/__tests__/middy.spec.ts +741 -0
  326. package/src/adapters/index.ts +22 -0
  327. package/src/adapters/lambda.ts +432 -0
  328. package/src/adapters/middy.ts +402 -0
  329. package/src/adapters/types.ts +181 -0
  330. package/src/core.ts +51 -0
  331. package/src/index.ts +34 -0
  332. package/src/instrumentation/__tests__/core.spec.ts +248 -0
  333. package/src/instrumentation/__tests__/hono.spec.ts +348 -0
  334. package/src/instrumentation/__tests__/middleware.spec.ts +528 -0
  335. package/src/instrumentation/__tests__/otel.spec.ts +291 -0
  336. package/src/instrumentation/__tests__/tracing.spec.ts +208 -0
  337. package/src/instrumentation/core.ts +228 -0
  338. package/src/instrumentation/hono.ts +270 -0
  339. package/src/instrumentation/http.ts +306 -0
  340. package/src/instrumentation/index.ts +90 -0
  341. package/src/instrumentation/middleware.ts +297 -0
  342. package/src/instrumentation/otel.ts +271 -0
  343. package/src/instrumentation/setup.ts +246 -0
  344. package/src/instrumentation/tracing.ts +145 -0
  345. package/src/logger/__tests__/console.spec.ts +366 -0
  346. package/src/logger/__tests__/pino.spec.ts +217 -0
  347. package/src/logger/console.ts +230 -0
  348. package/src/logger/pino.ts +201 -0
  349. package/src/metrics/MetricsAggregator.ts +555 -0
  350. package/src/metrics/__tests__/MetricsAggregator.spec.ts +298 -0
  351. package/src/metrics/index.ts +2 -0
  352. package/src/metrics/storage/InMemoryMetricsStorage.ts +380 -0
  353. package/src/metrics/storage/MetricsStorage.ts +74 -0
  354. package/src/metrics/storage/index.ts +3 -0
  355. package/src/metrics/storage/types.ts +243 -0
  356. package/src/otlp/__tests__/receiver.spec.ts +367 -0
  357. package/src/otlp/__tests__/transformer.spec.ts +455 -0
  358. package/src/otlp/hono.ts +120 -0
  359. package/src/otlp/index.ts +22 -0
  360. package/src/otlp/receiver.ts +162 -0
  361. package/src/otlp/transformer.ts +367 -0
  362. package/src/otlp/types.ts +364 -0
  363. package/src/redact.ts +116 -0
  364. package/src/server/__tests__/hono.spec.ts +814 -0
  365. package/src/server/hono.ts +442 -0
  366. package/src/storage/__tests__/kysely.spec.ts +715 -0
  367. package/src/storage/__tests__/memory.spec.ts +694 -0
  368. package/src/storage/kysely.ts +599 -0
  369. package/src/storage/memory.ts +204 -0
  370. package/src/types.ts +447 -0
  371. package/src/ui-assets.ts +40 -0
  372. package/tsconfig.json +9 -0
  373. package/ui/CHANGELOG.md +7 -0
  374. package/ui/index.html +12 -0
  375. package/ui/node_modules/.bin/tsc +21 -0
  376. package/ui/node_modules/.bin/tsserver +21 -0
  377. package/ui/node_modules/.bin/vite +21 -0
  378. package/ui/package.json +24 -0
  379. package/ui/src/App.tsx +595 -0
  380. package/ui/src/api.ts +88 -0
  381. package/ui/src/components/ExceptionDetail.tsx +100 -0
  382. package/ui/src/components/FilterBar.tsx +162 -0
  383. package/ui/src/components/LogDetail.tsx +91 -0
  384. package/ui/src/components/RequestDetail.tsx +143 -0
  385. package/ui/src/main.tsx +10 -0
  386. package/ui/src/styles.css +11 -0
  387. package/ui/src/types.ts +63 -0
  388. package/ui/src/vite-env.d.ts +1 -0
  389. package/ui/src/vite-plugin-gkm-config.ts +54 -0
  390. package/ui/tsconfig.json +20 -0
  391. package/ui/tsconfig.tsbuildinfo +1 -0
  392. package/ui/vite.config.ts +13 -0
  393. package/dist/MetricsAggregator-BJdIvfEv.d.mts.map +0 -1
  394. package/dist/MetricsAggregator-CnC3oT5q.d.cts.map +0 -1
  395. package/dist/Telescope-BVfDvVvY.d.mts.map +0 -1
  396. package/dist/Telescope-DeqSHfuB.d.cts.map +0 -1
  397. package/dist/Telescope.cjs.map +0 -1
  398. package/dist/Telescope.mjs.map +0 -1
  399. package/dist/adapters/middy.cjs.map +0 -1
  400. package/dist/adapters/middy.d.cts.map +0 -1
  401. package/dist/adapters/middy.d.mts.map +0 -1
  402. package/dist/adapters/middy.mjs.map +0 -1
  403. package/dist/adapters/types.d.cts.map +0 -1
  404. package/dist/adapters/types.d.mts.map +0 -1
  405. package/dist/instrumentation/core.cjs.map +0 -1
  406. package/dist/instrumentation/core.d.cts.map +0 -1
  407. package/dist/instrumentation/core.d.mts.map +0 -1
  408. package/dist/instrumentation/core.mjs.map +0 -1
  409. package/dist/instrumentation/hono.cjs.map +0 -1
  410. package/dist/instrumentation/hono.d.cts.map +0 -1
  411. package/dist/instrumentation/hono.d.mts.map +0 -1
  412. package/dist/instrumentation/hono.mjs.map +0 -1
  413. package/dist/instrumentation/http.cjs.map +0 -1
  414. package/dist/instrumentation/http.d.cts.map +0 -1
  415. package/dist/instrumentation/http.d.mts.map +0 -1
  416. package/dist/instrumentation/http.mjs.map +0 -1
  417. package/dist/instrumentation/middleware.cjs.map +0 -1
  418. package/dist/instrumentation/middleware.d.cts.map +0 -1
  419. package/dist/instrumentation/middleware.d.mts.map +0 -1
  420. package/dist/instrumentation/middleware.mjs.map +0 -1
  421. package/dist/instrumentation/otel.cjs.map +0 -1
  422. package/dist/instrumentation/otel.d.cts.map +0 -1
  423. package/dist/instrumentation/otel.d.mts.map +0 -1
  424. package/dist/instrumentation/otel.mjs.map +0 -1
  425. package/dist/instrumentation/sampler.cjs +0 -54
  426. package/dist/instrumentation/sampler.cjs.map +0 -1
  427. package/dist/instrumentation/sampler.d.cts +0 -38
  428. package/dist/instrumentation/sampler.d.cts.map +0 -1
  429. package/dist/instrumentation/sampler.d.mts +0 -38
  430. package/dist/instrumentation/sampler.d.mts.map +0 -1
  431. package/dist/instrumentation/sampler.mjs +0 -52
  432. package/dist/instrumentation/sampler.mjs.map +0 -1
  433. package/dist/instrumentation/setup.cjs.map +0 -1
  434. package/dist/instrumentation/setup.d.cts.map +0 -1
  435. package/dist/instrumentation/setup.d.mts.map +0 -1
  436. package/dist/instrumentation/setup.mjs.map +0 -1
  437. package/dist/instrumentation/tracing.cjs.map +0 -1
  438. package/dist/instrumentation/tracing.d.cts.map +0 -1
  439. package/dist/instrumentation/tracing.d.mts.map +0 -1
  440. package/dist/instrumentation/tracing.mjs.map +0 -1
  441. package/dist/instrumentation/trust.cjs +0 -107
  442. package/dist/instrumentation/trust.cjs.map +0 -1
  443. package/dist/instrumentation/trust.d.cts +0 -57
  444. package/dist/instrumentation/trust.d.cts.map +0 -1
  445. package/dist/instrumentation/trust.d.mts +0 -57
  446. package/dist/instrumentation/trust.d.mts.map +0 -1
  447. package/dist/instrumentation/trust.mjs +0 -104
  448. package/dist/instrumentation/trust.mjs.map +0 -1
  449. package/dist/metrics/MetricsAggregator.cjs.map +0 -1
  450. package/dist/metrics/MetricsAggregator.mjs.map +0 -1
  451. package/dist/metrics/storage/InMemoryMetricsStorage.cjs.map +0 -1
  452. package/dist/metrics/storage/InMemoryMetricsStorage.d.cts.map +0 -1
  453. package/dist/metrics/storage/InMemoryMetricsStorage.d.mts.map +0 -1
  454. package/dist/metrics/storage/InMemoryMetricsStorage.mjs.map +0 -1
  455. package/dist/metrics/storage/MetricsStorage.d.cts.map +0 -1
  456. package/dist/metrics/storage/MetricsStorage.d.mts.map +0 -1
  457. package/dist/metrics/storage/types.cjs.map +0 -1
  458. package/dist/metrics/storage/types.d.cts.map +0 -1
  459. package/dist/metrics/storage/types.d.mts.map +0 -1
  460. package/dist/metrics/storage/types.mjs.map +0 -1
  461. package/dist/otlp/receiver.cjs.map +0 -1
  462. package/dist/otlp/receiver.d.cts.map +0 -1
  463. package/dist/otlp/receiver.d.mts.map +0 -1
  464. package/dist/otlp/receiver.mjs.map +0 -1
  465. package/dist/otlp/transformer.cjs.map +0 -1
  466. package/dist/otlp/transformer.mjs.map +0 -1
  467. package/dist/otlp/types.cjs.map +0 -1
  468. package/dist/otlp/types.mjs.map +0 -1
  469. package/dist/redact.cjs.map +0 -1
  470. package/dist/redact.mjs.map +0 -1
  471. package/dist/storage/memory.cjs.map +0 -1
  472. package/dist/storage/memory.d.cts.map +0 -1
  473. package/dist/storage/memory.d.mts.map +0 -1
  474. package/dist/storage/memory.mjs.map +0 -1
  475. package/dist/transformer-BtqjAs0b.d.cts.map +0 -1
  476. package/dist/transformer-DI6t8-YA.d.mts.map +0 -1
  477. package/dist/types-BVujq4zd.d.cts.map +0 -1
  478. package/dist/types-BVujq4zd.d.mts.map +0 -1
  479. package/dist/types-DVETVdpa.d.cts.map +0 -1
  480. package/dist/types-DVETVdpa.d.mts.map +0 -1
@@ -1,139 +1,3 @@
1
- import { SpanProcessorStrategy } from "../adapters/types.mjs";
2
- //#region src/instrumentation/setup.d.ts
3
- /**
4
- * Options for configuring telemetry
5
- */
6
- export interface TelemetryOptions {
7
- /**
8
- * Service name for resource identification
9
- */
10
- serviceName: string;
11
- /**
12
- * Service version
13
- */
14
- serviceVersion?: string;
15
- /**
16
- * The `service.namespace` resource attribute — the product an app is part
17
- * of, so several services from one workspace group together.
18
- */
19
- serviceNamespace?: string;
20
- /**
21
- * The stage this process runs as (`production`, `staging`, …). Sent as
22
- * `deployment.environment.name`, and as the older `deployment.environment`
23
- * many backends still filter on.
24
- */
25
- deploymentEnvironment?: string;
26
- /**
27
- * OTLP endpoint URL (e.g., 'http://localhost:3000/__telescope/v1').
28
- * Traces go to `<endpoint>/traces` and logs to `<endpoint>/logs`.
29
- *
30
- * If not provided, the standard `OTEL_EXPORTER_OTLP_ENDPOINT` (and its
31
- * per-signal `_TRACES_`/`_LOGS_` variants and `OTEL_EXPORTER_OTLP_HEADERS`)
32
- * configure the exporters, with the spec's `/v1/traces` and `/v1/logs`
33
- * paths. With neither, traces are written to the console.
34
- */
35
- endpoint?: string;
36
- /**
37
- * The fraction of new traces to sample, from 0 to 1. A span whose parent
38
- * in this process was sampled (or not) follows its parent, so a trace is
39
- * never cut in half; a caller's sampled flag is capped at this rate, so a
40
- * request cannot force a trace the stage would not keep (`traceSampler`).
41
- *
42
- * When left out, the standard `OTEL_TRACES_SAMPLER` and
43
- * `OTEL_TRACES_SAMPLER_ARG` decide — `parentbased_traceidratio` with `0.1`
44
- * is the same capped sampler at 0.1; with neither, every trace is sampled.
45
- */
46
- sampleRatio?: number;
47
- /**
48
- * Shut the SDK down and exit on `SIGTERM`.
49
- *
50
- * Turn it off when the process has its own graceful shutdown — exiting as
51
- * soon as telemetry is flushed would cut in-flight requests short.
52
- * @default true
53
- */
54
- handleSignals?: boolean;
55
- /**
56
- * Whether to instrument Pino for log correlation.
57
- *
58
- * It hooks module loading, so it sees nothing inside a bundle. A logger
59
- * from `@geekmidas/logger`'s `createLogger` sends its records through the
60
- * logs API itself; turn this off for one, or each record is sent twice
61
- * where pino can be hooked.
62
- * @default true
63
- */
64
- instrumentPino?: boolean;
65
- /**
66
- * Whether the http auto-instrumentation opens a span for each incoming
67
- * request.
68
- *
69
- * Turn it off when the server opens its own — `honoTelemetryMiddleware`,
70
- * as a `gkm build` server does — or each request is traced twice where
71
- * `node:http` can be hooked, and not at all in a bundle, where it cannot.
72
- * Outgoing requests are traced either way.
73
- * @default true
74
- */
75
- incomingHttpSpans?: boolean;
76
- /**
77
- * Whether to enable auto-instrumentation for common libraries
78
- * (http, fetch, express, etc.)
79
- * @default true
80
- */
81
- autoInstrument?: boolean;
82
- /**
83
- * Enable debug logging for OTel SDK
84
- * @default false
85
- */
86
- debug?: boolean;
87
- /**
88
- * Additional resource attributes
89
- */
90
- resourceAttributes?: Record<string, string>;
91
- /**
92
- * Headers to send with OTLP requests
93
- */
94
- headers?: Record<string, string>;
95
- /**
96
- * Span processor strategy.
97
- * - 'batch': Efficient batching for long-running servers (default)
98
- * - 'simple': Immediate export for serverless environments (Lambda, Edge)
99
- *
100
- * If not specified, automatically selected based on environment detection.
101
- */
102
- spanProcessorStrategy?: SpanProcessorStrategy;
103
- /**
104
- * Environment type for automatic configuration
105
- * @default 'server'
106
- */
107
- environment?: 'server' | 'lambda' | 'edge' | 'custom';
108
- }
109
- /** A `sampleRatio` outside 0–1, which no sampler can honour. */
110
- export declare class InvalidSampleRatio extends Error {
111
- readonly sampleRatio: number;
112
- constructor(sampleRatio: number);
113
- }
114
- /**
115
- * Set up OpenTelemetry instrumentation.
116
- * Call this BEFORE importing your application code.
117
- *
118
- * @example
119
- * ```typescript
120
- * // instrumentation.ts (create this file)
121
- * import { setupTelemetry } from '@geekmidas/telescope/instrumentation';
122
- *
123
- * setupTelemetry({
124
- * serviceName: 'my-api',
125
- * endpoint: 'http://localhost:3000/__telescope/v1',
126
- * });
127
- *
128
- * // Then in your entry point:
129
- * // import './instrumentation';
130
- * // import { app } from './app';
131
- * ```
132
- */
133
- export declare function setupTelemetry(options: TelemetryOptions): void;
134
- /**
135
- * Shut down telemetry (for testing or graceful shutdown)
136
- */
137
- export declare function shutdownTelemetry(): Promise<void>;
138
- //#endregion
139
- //# sourceMappingURL=setup.d.mts.map
1
+ import "../types-BzQ78Efw.mjs";
2
+ import { TelemetryOptions, setupTelemetry, shutdownTelemetry } from "../setup-Bkxm4g6b.mjs";
3
+ export { TelemetryOptions, setupTelemetry, shutdownTelemetry };
@@ -1,140 +1,4 @@
1
- import { createSpanProcessor, getRecommendedStrategy, setGlobalLogProcessor, setGlobalSpanProcessor } from "./core.mjs";
2
- import { traceSampler, traceSamplerFromEnv } from "./sampler.mjs";
3
- import { DiagConsoleLogger, DiagLogLevel, diag } from "@opentelemetry/api";
4
- import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
5
- import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
6
- import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
7
- import { PinoInstrumentation } from "@opentelemetry/instrumentation-pino";
8
- import { resourceFromAttributes } from "@opentelemetry/resources";
9
- import { BatchLogRecordProcessor } from "@opentelemetry/sdk-logs";
10
- import { NodeSDK } from "@opentelemetry/sdk-node";
11
- import { ConsoleSpanExporter } from "@opentelemetry/sdk-trace-node";
12
- import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions";
13
- //#region src/instrumentation/setup.ts
14
- let sdk = null;
15
- let onSigterm = null;
16
- /** A `sampleRatio` outside 0–1, which no sampler can honour. */
17
- var InvalidSampleRatio = class extends Error {
18
- sampleRatio;
19
- constructor(sampleRatio) {
20
- super(`sampleRatio must be a number from 0 (no traces) to 1 (every trace), got ${sampleRatio}. Pass a fraction such as 0.1 to keep one trace in ten.`);
21
- this.sampleRatio = sampleRatio;
22
- this.name = "InvalidSampleRatio";
23
- }
24
- };
25
- /** Whether the standard OTLP environment variables name a collector. */
26
- function otlpEndpointFromEnv(signal) {
27
- return Boolean(process.env[`OTEL_EXPORTER_OTLP_${signal}_ENDPOINT`] || process.env.OTEL_EXPORTER_OTLP_ENDPOINT);
28
- }
29
- /**
30
- * The sampler for an explicit ratio, or for the stage's rate in
31
- * `OTEL_TRACES_SAMPLER_ARG` — or undefined to let the SDK read any other
32
- * `OTEL_TRACES_SAMPLER` itself.
33
- */
34
- function samplerFor(sampleRatio) {
35
- if (sampleRatio === void 0) return traceSamplerFromEnv();
36
- if (!Number.isFinite(sampleRatio) || sampleRatio < 0 || sampleRatio > 1) throw new InvalidSampleRatio(sampleRatio);
37
- return traceSampler(sampleRatio);
38
- }
39
- /**
40
- * Set up OpenTelemetry instrumentation.
41
- * Call this BEFORE importing your application code.
42
- *
43
- * @example
44
- * ```typescript
45
- * // instrumentation.ts (create this file)
46
- * import { setupTelemetry } from '@geekmidas/telescope/instrumentation';
47
- *
48
- * setupTelemetry({
49
- * serviceName: 'my-api',
50
- * endpoint: 'http://localhost:3000/__telescope/v1',
51
- * });
52
- *
53
- * // Then in your entry point:
54
- * // import './instrumentation';
55
- * // import { app } from './app';
56
- * ```
57
- */
58
- function setupTelemetry(options) {
59
- if (sdk) return;
60
- const { serviceName, serviceVersion = "1.0.0", serviceNamespace, deploymentEnvironment, endpoint, sampleRatio, handleSignals = true, instrumentPino = true, incomingHttpSpans = true, autoInstrument = true, debug = false, resourceAttributes = {}, headers, spanProcessorStrategy, environment = "server" } = options;
61
- const sampler = samplerFor(sampleRatio);
62
- if (debug) diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
63
- const resource = resourceFromAttributes({
64
- [ATTR_SERVICE_NAME]: serviceName,
65
- [ATTR_SERVICE_VERSION]: serviceVersion,
66
- ...serviceNamespace && { "service.namespace": serviceNamespace },
67
- ...deploymentEnvironment && {
68
- "deployment.environment.name": deploymentEnvironment,
69
- "deployment.environment": deploymentEnvironment
70
- },
71
- ...resourceAttributes
72
- });
73
- const instrumentations = [];
74
- if (instrumentPino) instrumentations.push(new PinoInstrumentation({ logHook: (span, record) => {
75
- record.trace_id = span.spanContext().traceId;
76
- record.span_id = span.spanContext().spanId;
77
- record.trace_flags = span.spanContext().traceFlags;
78
- } }));
79
- if (autoInstrument) instrumentations.push(getNodeAutoInstrumentations({
80
- "@opentelemetry/instrumentation-fs": { enabled: false },
81
- "@opentelemetry/instrumentation-http": {
82
- disableIncomingRequestInstrumentation: !incomingHttpSpans,
83
- ignoreIncomingRequestHook: (request) => {
84
- const path = request.url || "";
85
- return path.includes("/__health") || path.includes("/__telescope") || path.includes("/favicon");
86
- }
87
- }
88
- }));
89
- let traceExporter;
90
- if (endpoint) traceExporter = new OTLPTraceExporter({
91
- url: `${endpoint}/traces`,
92
- headers: headers ?? {}
93
- });
94
- else if (otlpEndpointFromEnv("TRACES")) traceExporter = new OTLPTraceExporter(headers ? { headers } : {});
95
- else traceExporter = new ConsoleSpanExporter();
96
- const strategy = spanProcessorStrategy ?? getRecommendedStrategy(environment);
97
- const spanProcessor = createSpanProcessor(traceExporter, { strategy });
98
- setGlobalSpanProcessor(spanProcessor);
99
- let logProcessor;
100
- if (endpoint || otlpEndpointFromEnv("LOGS")) {
101
- const logExporter = endpoint ? new OTLPLogExporter({
102
- url: `${endpoint}/logs`,
103
- headers: headers ?? {}
104
- }) : new OTLPLogExporter(headers ? { headers } : {});
105
- logProcessor = new BatchLogRecordProcessor({ exporter: logExporter });
106
- setGlobalLogProcessor(logProcessor);
107
- }
108
- sdk = new NodeSDK({
109
- resource,
110
- traceExporter,
111
- spanProcessors: [spanProcessor],
112
- ...logProcessor && { logRecordProcessors: [logProcessor] },
113
- ...sampler && { sampler },
114
- instrumentations
115
- });
116
- sdk.start();
117
- if (handleSignals) {
118
- onSigterm = () => {
119
- sdk?.shutdown().then(() => {}).catch((_error) => {}).finally(() => process.exit(0));
120
- };
121
- process.on("SIGTERM", onSigterm);
122
- }
123
- }
124
- /**
125
- * Shut down telemetry (for testing or graceful shutdown)
126
- */
127
- async function shutdownTelemetry() {
128
- if (onSigterm) {
129
- process.off("SIGTERM", onSigterm);
130
- onSigterm = null;
131
- }
132
- if (sdk) {
133
- await sdk.shutdown();
134
- sdk = null;
135
- }
136
- }
137
- //#endregion
138
- export { InvalidSampleRatio, setupTelemetry, shutdownTelemetry };
1
+ import "../core-D6hJ6exL.mjs";
2
+ import { setupTelemetry, shutdownTelemetry } from "../setup-B9jM77Qk.mjs";
139
3
 
140
- //# sourceMappingURL=setup.mjs.map
4
+ export { setupTelemetry, shutdownTelemetry };
@@ -1,115 +1,11 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- let _opentelemetry_api = require("@opentelemetry/api");
3
- //#region src/instrumentation/tracing.ts
4
- /**
5
- * Get the currently active span
6
- */
7
- function getActiveSpan() {
8
- return _opentelemetry_api.trace.getActiveSpan();
9
- }
10
- /**
11
- * Set attributes on the active span
12
- */
13
- function setSpanAttributes(attributes) {
14
- const span = getActiveSpan();
15
- if (span) span.setAttributes(attributes);
16
- }
17
- /**
18
- * Create a new span as a child of the current span
19
- */
20
- function createSpan(name, attributes) {
21
- return _opentelemetry_api.trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
22
- }
23
- /**
24
- * Execute a function within a new span context
25
- *
26
- * @example
27
- * ```typescript
28
- * const result = await withSpan('processOrder', async (span) => {
29
- * span.setAttribute('order.id', orderId);
30
- * const order = await processOrder(orderId);
31
- * return order;
32
- * });
33
- * ```
34
- */
35
- async function withSpan(name, fn, attributes) {
36
- const span = _opentelemetry_api.trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
37
- try {
38
- const result = await _opentelemetry_api.context.with(_opentelemetry_api.trace.setSpan(_opentelemetry_api.context.active(), span), () => fn(span));
39
- span.setStatus({ code: _opentelemetry_api.SpanStatusCode.OK });
40
- return result;
41
- } catch (error) {
42
- span.setStatus({
43
- code: _opentelemetry_api.SpanStatusCode.ERROR,
44
- message: error instanceof Error ? error.message : "Unknown error"
45
- });
46
- span.recordException(error instanceof Error ? error : new Error(String(error)));
47
- throw error;
48
- } finally {
49
- span.end();
50
- }
51
- }
52
- /**
53
- * Synchronous version of withSpan
54
- */
55
- function withSpanSync(name, fn, attributes) {
56
- const span = _opentelemetry_api.trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
57
- try {
58
- const result = _opentelemetry_api.context.with(_opentelemetry_api.trace.setSpan(_opentelemetry_api.context.active(), span), () => fn(span));
59
- span.setStatus({ code: _opentelemetry_api.SpanStatusCode.OK });
60
- return result;
61
- } catch (error) {
62
- span.setStatus({
63
- code: _opentelemetry_api.SpanStatusCode.ERROR,
64
- message: error instanceof Error ? error.message : "Unknown error"
65
- });
66
- span.recordException(error instanceof Error ? error : new Error(String(error)));
67
- throw error;
68
- } finally {
69
- span.end();
70
- }
71
- }
72
- /**
73
- * Get the current trace ID (useful for log correlation)
74
- */
75
- function getTraceId() {
76
- return getActiveSpan()?.spanContext().traceId;
77
- }
78
- /**
79
- * Get the current span ID
80
- */
81
- function getSpanId() {
82
- return getActiveSpan()?.spanContext().spanId;
83
- }
84
- /**
85
- * Record an exception on the current span
86
- */
87
- function recordException(error) {
88
- const span = getActiveSpan();
89
- if (span) {
90
- span.recordException(error);
91
- span.setStatus({
92
- code: _opentelemetry_api.SpanStatusCode.ERROR,
93
- message: error.message
94
- });
95
- }
96
- }
97
- /**
98
- * Add an event to the current span
99
- */
100
- function addSpanEvent(name, attributes) {
101
- const span = getActiveSpan();
102
- if (span) span.addEvent(name, attributes);
103
- }
104
- //#endregion
105
- exports.addSpanEvent = addSpanEvent;
106
- exports.createSpan = createSpan;
107
- exports.getActiveSpan = getActiveSpan;
108
- exports.getSpanId = getSpanId;
109
- exports.getTraceId = getTraceId;
110
- exports.recordException = recordException;
111
- exports.setSpanAttributes = setSpanAttributes;
112
- exports.withSpan = withSpan;
113
- exports.withSpanSync = withSpanSync;
1
+ const require_tracing = require('../tracing-Bt1zWRlb.cjs');
114
2
 
115
- //# sourceMappingURL=tracing.cjs.map
3
+ exports.addSpanEvent = require_tracing.addSpanEvent;
4
+ exports.createSpan = require_tracing.createSpan;
5
+ exports.getActiveSpan = require_tracing.getActiveSpan;
6
+ exports.getSpanId = require_tracing.getSpanId;
7
+ exports.getTraceId = require_tracing.getTraceId;
8
+ exports.recordException = require_tracing.recordException;
9
+ exports.setSpanAttributes = require_tracing.setSpanAttributes;
10
+ exports.withSpan = require_tracing.withSpan;
11
+ exports.withSpanSync = require_tracing.withSpanSync;
@@ -1,49 +1,2 @@
1
- import { Attributes, Span } from "@opentelemetry/api";
2
- //#region src/instrumentation/tracing.d.ts
3
- /**
4
- * Get the currently active span
5
- */
6
- export declare function getActiveSpan(): Span | undefined;
7
- /**
8
- * Set attributes on the active span
9
- */
10
- export declare function setSpanAttributes(attributes: Attributes): void;
11
- /**
12
- * Create a new span as a child of the current span
13
- */
14
- export declare function createSpan(name: string, attributes?: Attributes): Span;
15
- /**
16
- * Execute a function within a new span context
17
- *
18
- * @example
19
- * ```typescript
20
- * const result = await withSpan('processOrder', async (span) => {
21
- * span.setAttribute('order.id', orderId);
22
- * const order = await processOrder(orderId);
23
- * return order;
24
- * });
25
- * ```
26
- */
27
- export declare function withSpan<T>(name: string, fn: (span: Span) => Promise<T>, attributes?: Attributes): Promise<T>;
28
- /**
29
- * Synchronous version of withSpan
30
- */
31
- export declare function withSpanSync<T>(name: string, fn: (span: Span) => T, attributes?: Attributes): T;
32
- /**
33
- * Get the current trace ID (useful for log correlation)
34
- */
35
- export declare function getTraceId(): string | undefined;
36
- /**
37
- * Get the current span ID
38
- */
39
- export declare function getSpanId(): string | undefined;
40
- /**
41
- * Record an exception on the current span
42
- */
43
- export declare function recordException(error: Error): void;
44
- /**
45
- * Add an event to the current span
46
- */
47
- export declare function addSpanEvent(name: string, attributes?: Attributes): void;
48
- //#endregion
49
- //# sourceMappingURL=tracing.d.cts.map
1
+ import { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync } from "../tracing-BX8uY2nR.cjs";
2
+ export { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync };
@@ -1,49 +1,2 @@
1
- import { Attributes, Span } from "@opentelemetry/api";
2
- //#region src/instrumentation/tracing.d.ts
3
- /**
4
- * Get the currently active span
5
- */
6
- export declare function getActiveSpan(): Span | undefined;
7
- /**
8
- * Set attributes on the active span
9
- */
10
- export declare function setSpanAttributes(attributes: Attributes): void;
11
- /**
12
- * Create a new span as a child of the current span
13
- */
14
- export declare function createSpan(name: string, attributes?: Attributes): Span;
15
- /**
16
- * Execute a function within a new span context
17
- *
18
- * @example
19
- * ```typescript
20
- * const result = await withSpan('processOrder', async (span) => {
21
- * span.setAttribute('order.id', orderId);
22
- * const order = await processOrder(orderId);
23
- * return order;
24
- * });
25
- * ```
26
- */
27
- export declare function withSpan<T>(name: string, fn: (span: Span) => Promise<T>, attributes?: Attributes): Promise<T>;
28
- /**
29
- * Synchronous version of withSpan
30
- */
31
- export declare function withSpanSync<T>(name: string, fn: (span: Span) => T, attributes?: Attributes): T;
32
- /**
33
- * Get the current trace ID (useful for log correlation)
34
- */
35
- export declare function getTraceId(): string | undefined;
36
- /**
37
- * Get the current span ID
38
- */
39
- export declare function getSpanId(): string | undefined;
40
- /**
41
- * Record an exception on the current span
42
- */
43
- export declare function recordException(error: Error): void;
44
- /**
45
- * Add an event to the current span
46
- */
47
- export declare function addSpanEvent(name: string, attributes?: Attributes): void;
48
- //#endregion
49
- //# sourceMappingURL=tracing.d.mts.map
1
+ import { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync } from "../tracing-PnECEbEu.mjs";
2
+ export { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync };
@@ -1,106 +1,3 @@
1
- import { SpanStatusCode, context, trace } from "@opentelemetry/api";
2
- //#region src/instrumentation/tracing.ts
3
- /**
4
- * Get the currently active span
5
- */
6
- function getActiveSpan() {
7
- return trace.getActiveSpan();
8
- }
9
- /**
10
- * Set attributes on the active span
11
- */
12
- function setSpanAttributes(attributes) {
13
- const span = getActiveSpan();
14
- if (span) span.setAttributes(attributes);
15
- }
16
- /**
17
- * Create a new span as a child of the current span
18
- */
19
- function createSpan(name, attributes) {
20
- return trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
21
- }
22
- /**
23
- * Execute a function within a new span context
24
- *
25
- * @example
26
- * ```typescript
27
- * const result = await withSpan('processOrder', async (span) => {
28
- * span.setAttribute('order.id', orderId);
29
- * const order = await processOrder(orderId);
30
- * return order;
31
- * });
32
- * ```
33
- */
34
- async function withSpan(name, fn, attributes) {
35
- const span = trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
36
- try {
37
- const result = await context.with(trace.setSpan(context.active(), span), () => fn(span));
38
- span.setStatus({ code: SpanStatusCode.OK });
39
- return result;
40
- } catch (error) {
41
- span.setStatus({
42
- code: SpanStatusCode.ERROR,
43
- message: error instanceof Error ? error.message : "Unknown error"
44
- });
45
- span.recordException(error instanceof Error ? error : new Error(String(error)));
46
- throw error;
47
- } finally {
48
- span.end();
49
- }
50
- }
51
- /**
52
- * Synchronous version of withSpan
53
- */
54
- function withSpanSync(name, fn, attributes) {
55
- const span = trace.getTracer("@geekmidas/telescope").startSpan(name, { attributes });
56
- try {
57
- const result = context.with(trace.setSpan(context.active(), span), () => fn(span));
58
- span.setStatus({ code: SpanStatusCode.OK });
59
- return result;
60
- } catch (error) {
61
- span.setStatus({
62
- code: SpanStatusCode.ERROR,
63
- message: error instanceof Error ? error.message : "Unknown error"
64
- });
65
- span.recordException(error instanceof Error ? error : new Error(String(error)));
66
- throw error;
67
- } finally {
68
- span.end();
69
- }
70
- }
71
- /**
72
- * Get the current trace ID (useful for log correlation)
73
- */
74
- function getTraceId() {
75
- return getActiveSpan()?.spanContext().traceId;
76
- }
77
- /**
78
- * Get the current span ID
79
- */
80
- function getSpanId() {
81
- return getActiveSpan()?.spanContext().spanId;
82
- }
83
- /**
84
- * Record an exception on the current span
85
- */
86
- function recordException(error) {
87
- const span = getActiveSpan();
88
- if (span) {
89
- span.recordException(error);
90
- span.setStatus({
91
- code: SpanStatusCode.ERROR,
92
- message: error.message
93
- });
94
- }
95
- }
96
- /**
97
- * Add an event to the current span
98
- */
99
- function addSpanEvent(name, attributes) {
100
- const span = getActiveSpan();
101
- if (span) span.addEvent(name, attributes);
102
- }
103
- //#endregion
104
- export { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync };
1
+ import { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync } from "../tracing-Cijm_5NI.mjs";
105
2
 
106
- //# sourceMappingURL=tracing.mjs.map
3
+ export { addSpanEvent, createSpan, getActiveSpan, getSpanId, getTraceId, recordException, setSpanAttributes, withSpan, withSpanSync };
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
+
2
2
  //#region src/logger/console.ts
3
3
  /**
4
4
  * A logger that sends logs to both Telescope and an optional underlying logger.
@@ -51,10 +51,8 @@ var TelescopeLogger = class TelescopeLogger {
51
51
  };
52
52
  message = msg ?? "";
53
53
  }
54
- if (this.logger) {
55
- if (typeof objOrMsg === "string") this.logger[level](objOrMsg);
56
- else this.logger[level](objOrMsg, msg, ...args);
57
- }
54
+ if (this.logger) if (typeof objOrMsg === "string") this.logger[level](objOrMsg);
55
+ else this.logger[level](objOrMsg, msg, ...args);
58
56
  this.telescope[level](message, context, this.requestId).catch(() => {});
59
57
  };
60
58
  return fn;
@@ -63,11 +61,9 @@ var TelescopeLogger = class TelescopeLogger {
63
61
  info = this.createLogFn("info");
64
62
  warn = this.createLogFn("warn");
65
63
  error = this.createLogFn("error");
66
- fatal = ((objOrMsg, msg, ...args) => {
67
- if (this.logger) {
68
- if (typeof objOrMsg === "string") this.logger.fatal(objOrMsg);
69
- else this.logger.fatal(objOrMsg, msg, ...args);
70
- }
64
+ fatal = (objOrMsg, msg, ...args) => {
65
+ if (this.logger) if (typeof objOrMsg === "string") this.logger.fatal(objOrMsg);
66
+ else this.logger.fatal(objOrMsg, msg, ...args);
71
67
  let context;
72
68
  let message;
73
69
  if (typeof objOrMsg === "string") {
@@ -85,12 +81,10 @@ var TelescopeLogger = class TelescopeLogger {
85
81
  message = msg ?? "";
86
82
  }
87
83
  this.telescope.error(message, context, this.requestId).catch(() => {});
88
- });
89
- trace = ((objOrMsg, msg, ...args) => {
90
- if (this.logger) {
91
- if (typeof objOrMsg === "string") this.logger.trace(objOrMsg);
92
- else this.logger.trace(objOrMsg, msg, ...args);
93
- }
84
+ };
85
+ trace = (objOrMsg, msg, ...args) => {
86
+ if (this.logger) if (typeof objOrMsg === "string") this.logger.trace(objOrMsg);
87
+ else this.logger.trace(objOrMsg, msg, ...args);
94
88
  let context;
95
89
  let message;
96
90
  if (typeof objOrMsg === "string") {
@@ -108,7 +102,7 @@ var TelescopeLogger = class TelescopeLogger {
108
102
  message = msg ?? "";
109
103
  }
110
104
  this.telescope.debug(message, context, this.requestId).catch(() => {});
111
- });
105
+ };
112
106
  /**
113
107
  * Creates a child logger with additional context.
114
108
  * The child logger inherits all context from the parent.
@@ -160,8 +154,8 @@ function createTelescopeLogger(telescope, logger, context) {
160
154
  context
161
155
  });
162
156
  }
157
+
163
158
  //#endregion
164
159
  exports.TelescopeLogger = TelescopeLogger;
165
160
  exports.createTelescopeLogger = createTelescopeLogger;
166
-
167
161
  //# sourceMappingURL=console.cjs.map