adonisjs-server-stats 1.5.4 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (519) hide show
  1. package/README.md +351 -171
  2. package/dist/configure.d.ts.map +1 -1
  3. package/dist/core/api-client.d.ts +73 -0
  4. package/dist/core/api-client.d.ts.map +1 -0
  5. package/dist/core/config-utils.d.ts +109 -0
  6. package/dist/core/config-utils.d.ts.map +1 -0
  7. package/dist/core/constants.d.ts +11 -0
  8. package/dist/core/constants.d.ts.map +1 -0
  9. package/dist/core/dashboard-api.d.ts +65 -0
  10. package/dist/core/dashboard-api.d.ts.map +1 -0
  11. package/dist/core/dashboard-data-controller.d.ts +157 -0
  12. package/dist/core/dashboard-data-controller.d.ts.map +1 -0
  13. package/dist/core/debug-data-controller.d.ts +89 -0
  14. package/dist/core/debug-data-controller.d.ts.map +1 -0
  15. package/dist/core/feature-detect.d.ts +67 -0
  16. package/dist/core/feature-detect.d.ts.map +1 -0
  17. package/dist/core/formatters.d.ts +189 -0
  18. package/dist/core/formatters.d.ts.map +1 -0
  19. package/dist/core/history-buffer.d.ts +23 -0
  20. package/dist/core/history-buffer.d.ts.map +1 -0
  21. package/dist/core/icons.d.ts +36 -0
  22. package/dist/core/icons.d.ts.map +1 -0
  23. package/dist/core/index.d.ts +39 -0
  24. package/dist/core/index.d.ts.map +1 -0
  25. package/dist/core/index.js +1961 -0
  26. package/dist/core/internals-utils.d.ts +71 -0
  27. package/dist/core/internals-utils.d.ts.map +1 -0
  28. package/dist/core/job-utils.d.ts +45 -0
  29. package/dist/core/job-utils.d.ts.map +1 -0
  30. package/dist/core/log-utils.d.ts +34 -0
  31. package/dist/core/log-utils.d.ts.map +1 -0
  32. package/dist/core/metrics.d.ts +41 -0
  33. package/dist/core/metrics.d.ts.map +1 -0
  34. package/dist/core/pagination.d.ts +128 -0
  35. package/dist/core/pagination.d.ts.map +1 -0
  36. package/dist/core/query-utils.d.ts +35 -0
  37. package/dist/core/query-utils.d.ts.map +1 -0
  38. package/dist/core/resizable-columns.d.ts +18 -0
  39. package/dist/core/resizable-columns.d.ts.map +1 -0
  40. package/dist/core/routes.d.ts +12 -0
  41. package/dist/core/routes.d.ts.map +1 -0
  42. package/dist/core/server-stats-controller.d.ts +106 -0
  43. package/dist/core/server-stats-controller.d.ts.map +1 -0
  44. package/dist/core/sparkline.d.ts +80 -0
  45. package/dist/core/sparkline.d.ts.map +1 -0
  46. package/dist/core/theme.d.ts +42 -0
  47. package/dist/core/theme.d.ts.map +1 -0
  48. package/dist/core/trace-utils.d.ts +62 -0
  49. package/dist/core/trace-utils.d.ts.map +1 -0
  50. package/dist/core/transmit-adapter.d.ts +59 -0
  51. package/dist/core/transmit-adapter.d.ts.map +1 -0
  52. package/dist/core/types.d.ts +619 -0
  53. package/dist/core/types.d.ts.map +1 -0
  54. package/dist/react/CacheSection-DGxMDlWK.js +146 -0
  55. package/dist/react/CacheTab-CnVW5PLs.js +123 -0
  56. package/dist/react/ConfigContent-CnsEI4j3.js +397 -0
  57. package/dist/react/ConfigSection-DPcrfqXY.js +11 -0
  58. package/dist/react/ConfigTab-BSWq_o2p.js +15 -0
  59. package/dist/react/CustomPaneTab-xjkYwTvH.js +104 -0
  60. package/dist/react/DataTable-YyShr5B-.js +55 -0
  61. package/dist/react/EmailsSection-CSyTg1aX.js +262 -0
  62. package/dist/react/EmailsTab-Dh2YSa_f.js +131 -0
  63. package/dist/react/EventsSection-C1pbJDfW.js +86 -0
  64. package/dist/react/EventsTab-eCh02cdd.js +63 -0
  65. package/dist/react/FilterBar-DQRXpWrb.js +50 -0
  66. package/dist/react/InternalsContent-DBzsI0CG.js +346 -0
  67. package/dist/react/InternalsSection-t7ihcWO-.js +32 -0
  68. package/dist/react/InternalsTab-Oij0A2fN.js +30 -0
  69. package/dist/react/JobsSection-CLAin5vU.js +187 -0
  70. package/dist/react/JobsTab-Dl5nrj2z.js +141 -0
  71. package/dist/react/LogsSection-C1p81fXO.js +212 -0
  72. package/dist/react/LogsTab-D-kR7PjX.js +88 -0
  73. package/dist/react/OverviewSection-nm3xdACz.js +539 -0
  74. package/dist/react/Pagination-BkmzUDY8.js +64 -0
  75. package/dist/react/QueriesSection-DB12HMfQ.js +461 -0
  76. package/dist/react/QueriesTab-fyBB1u_Y.js +90 -0
  77. package/dist/react/RequestsSection-DTqB81ac.js +209 -0
  78. package/dist/react/RoutesSection-DJWa4NPV.js +74 -0
  79. package/dist/react/RoutesTab-D3l8TOpu.js +74 -0
  80. package/dist/react/TimelineSection-C4d-jRX1.js +158 -0
  81. package/dist/react/TimelineTab-C5TFaSmQ.js +193 -0
  82. package/dist/react/WaterfallChart-Cj73WdfM.js +100 -0
  83. package/dist/react/core/api-client.d.ts +73 -0
  84. package/dist/react/core/api-client.d.ts.map +1 -0
  85. package/dist/react/core/config-utils.d.ts +109 -0
  86. package/dist/react/core/config-utils.d.ts.map +1 -0
  87. package/dist/react/core/constants.d.ts +11 -0
  88. package/dist/react/core/constants.d.ts.map +1 -0
  89. package/dist/react/core/dashboard-api.d.ts +65 -0
  90. package/dist/react/core/dashboard-api.d.ts.map +1 -0
  91. package/dist/react/core/dashboard-data-controller.d.ts +157 -0
  92. package/dist/react/core/dashboard-data-controller.d.ts.map +1 -0
  93. package/dist/react/core/debug-data-controller.d.ts +89 -0
  94. package/dist/react/core/debug-data-controller.d.ts.map +1 -0
  95. package/dist/react/core/feature-detect.d.ts +67 -0
  96. package/dist/react/core/feature-detect.d.ts.map +1 -0
  97. package/dist/react/core/formatters.d.ts +189 -0
  98. package/dist/react/core/formatters.d.ts.map +1 -0
  99. package/dist/react/core/history-buffer.d.ts +23 -0
  100. package/dist/react/core/history-buffer.d.ts.map +1 -0
  101. package/dist/react/core/icons.d.ts +36 -0
  102. package/dist/react/core/icons.d.ts.map +1 -0
  103. package/dist/react/core/index.d.ts +39 -0
  104. package/dist/react/core/index.d.ts.map +1 -0
  105. package/dist/react/core/internals-utils.d.ts +71 -0
  106. package/dist/react/core/internals-utils.d.ts.map +1 -0
  107. package/dist/react/core/job-utils.d.ts +45 -0
  108. package/dist/react/core/job-utils.d.ts.map +1 -0
  109. package/dist/react/core/log-utils.d.ts +34 -0
  110. package/dist/react/core/log-utils.d.ts.map +1 -0
  111. package/dist/react/core/metrics.d.ts +41 -0
  112. package/dist/react/core/metrics.d.ts.map +1 -0
  113. package/dist/react/core/pagination.d.ts +128 -0
  114. package/dist/react/core/pagination.d.ts.map +1 -0
  115. package/dist/react/core/query-utils.d.ts +35 -0
  116. package/dist/react/core/query-utils.d.ts.map +1 -0
  117. package/dist/react/core/resizable-columns.d.ts +18 -0
  118. package/dist/react/core/resizable-columns.d.ts.map +1 -0
  119. package/dist/react/core/routes.d.ts +12 -0
  120. package/dist/react/core/routes.d.ts.map +1 -0
  121. package/dist/react/core/server-stats-controller.d.ts +106 -0
  122. package/dist/react/core/server-stats-controller.d.ts.map +1 -0
  123. package/dist/react/core/sparkline.d.ts +80 -0
  124. package/dist/react/core/sparkline.d.ts.map +1 -0
  125. package/dist/react/core/theme.d.ts +42 -0
  126. package/dist/react/core/theme.d.ts.map +1 -0
  127. package/dist/react/core/trace-utils.d.ts +62 -0
  128. package/dist/react/core/trace-utils.d.ts.map +1 -0
  129. package/dist/react/core/transmit-adapter.d.ts +59 -0
  130. package/dist/react/core/transmit-adapter.d.ts.map +1 -0
  131. package/dist/react/core/types.d.ts +619 -0
  132. package/dist/react/core/types.d.ts.map +1 -0
  133. package/dist/react/index-UdTfSvtO.js +1074 -0
  134. package/dist/react/index.js +18 -0
  135. package/dist/react/react/components/Dashboard/DashboardPage.d.ts +17 -0
  136. package/dist/react/react/components/Dashboard/DashboardPage.d.ts.map +1 -0
  137. package/dist/react/react/components/Dashboard/sections/CacheSection.d.ts +7 -0
  138. package/dist/react/react/components/Dashboard/sections/CacheSection.d.ts.map +1 -0
  139. package/dist/react/react/components/Dashboard/sections/ConfigSection.d.ts +7 -0
  140. package/dist/react/react/components/Dashboard/sections/ConfigSection.d.ts.map +1 -0
  141. package/dist/react/react/components/Dashboard/sections/EmailsSection.d.ts +7 -0
  142. package/dist/react/react/components/Dashboard/sections/EmailsSection.d.ts.map +1 -0
  143. package/dist/react/react/components/Dashboard/sections/EventsSection.d.ts +7 -0
  144. package/dist/react/react/components/Dashboard/sections/EventsSection.d.ts.map +1 -0
  145. package/dist/react/react/components/Dashboard/sections/InternalsSection.d.ts +14 -0
  146. package/dist/react/react/components/Dashboard/sections/InternalsSection.d.ts.map +1 -0
  147. package/dist/react/react/components/Dashboard/sections/JobsSection.d.ts +7 -0
  148. package/dist/react/react/components/Dashboard/sections/JobsSection.d.ts.map +1 -0
  149. package/dist/react/react/components/Dashboard/sections/LogsSection.d.ts +7 -0
  150. package/dist/react/react/components/Dashboard/sections/LogsSection.d.ts.map +1 -0
  151. package/dist/react/react/components/Dashboard/sections/OverviewSection.d.ts +7 -0
  152. package/dist/react/react/components/Dashboard/sections/OverviewSection.d.ts.map +1 -0
  153. package/dist/react/react/components/Dashboard/sections/QueriesSection.d.ts +7 -0
  154. package/dist/react/react/components/Dashboard/sections/QueriesSection.d.ts.map +1 -0
  155. package/dist/react/react/components/Dashboard/sections/RequestsSection.d.ts +7 -0
  156. package/dist/react/react/components/Dashboard/sections/RequestsSection.d.ts.map +1 -0
  157. package/dist/react/react/components/Dashboard/sections/RoutesSection.d.ts +7 -0
  158. package/dist/react/react/components/Dashboard/sections/RoutesSection.d.ts.map +1 -0
  159. package/dist/react/react/components/Dashboard/sections/TimelineSection.d.ts +9 -0
  160. package/dist/react/react/components/Dashboard/sections/TimelineSection.d.ts.map +1 -0
  161. package/dist/react/react/components/Dashboard/shared/DataTable.d.ts +27 -0
  162. package/dist/react/react/components/Dashboard/shared/DataTable.d.ts.map +1 -0
  163. package/dist/react/react/components/Dashboard/shared/FilterBar.d.ts +17 -0
  164. package/dist/react/react/components/Dashboard/shared/FilterBar.d.ts.map +1 -0
  165. package/dist/react/react/components/Dashboard/shared/Pagination.d.ts +13 -0
  166. package/dist/react/react/components/Dashboard/shared/Pagination.d.ts.map +1 -0
  167. package/dist/react/react/components/Dashboard/shared/TimeRangeSelector.d.ts +12 -0
  168. package/dist/react/react/components/Dashboard/shared/TimeRangeSelector.d.ts.map +1 -0
  169. package/dist/react/react/components/Dashboard/shared/WaterfallChart.d.ts +16 -0
  170. package/dist/react/react/components/Dashboard/shared/WaterfallChart.d.ts.map +1 -0
  171. package/dist/react/react/components/DebugPanel/DebugPanel.d.ts +16 -0
  172. package/dist/react/react/components/DebugPanel/DebugPanel.d.ts.map +1 -0
  173. package/dist/react/react/components/DebugPanel/tabs/CacheTab.d.ts +8 -0
  174. package/dist/react/react/components/DebugPanel/tabs/CacheTab.d.ts.map +1 -0
  175. package/dist/react/react/components/DebugPanel/tabs/ConfigTab.d.ts +8 -0
  176. package/dist/react/react/components/DebugPanel/tabs/ConfigTab.d.ts.map +1 -0
  177. package/dist/react/react/components/DebugPanel/tabs/CustomPaneTab.d.ts +14 -0
  178. package/dist/react/react/components/DebugPanel/tabs/CustomPaneTab.d.ts.map +1 -0
  179. package/dist/react/react/components/DebugPanel/tabs/EmailsTab.d.ts +7 -0
  180. package/dist/react/react/components/DebugPanel/tabs/EmailsTab.d.ts.map +1 -0
  181. package/dist/react/react/components/DebugPanel/tabs/EventsTab.d.ts +7 -0
  182. package/dist/react/react/components/DebugPanel/tabs/EventsTab.d.ts.map +1 -0
  183. package/dist/react/react/components/DebugPanel/tabs/InternalsTab.d.ts +12 -0
  184. package/dist/react/react/components/DebugPanel/tabs/InternalsTab.d.ts.map +1 -0
  185. package/dist/react/react/components/DebugPanel/tabs/JobsTab.d.ts +9 -0
  186. package/dist/react/react/components/DebugPanel/tabs/JobsTab.d.ts.map +1 -0
  187. package/dist/react/react/components/DebugPanel/tabs/LogsTab.d.ts +7 -0
  188. package/dist/react/react/components/DebugPanel/tabs/LogsTab.d.ts.map +1 -0
  189. package/dist/react/react/components/DebugPanel/tabs/QueriesTab.d.ts +7 -0
  190. package/dist/react/react/components/DebugPanel/tabs/QueriesTab.d.ts.map +1 -0
  191. package/dist/react/react/components/DebugPanel/tabs/RoutesTab.d.ts +8 -0
  192. package/dist/react/react/components/DebugPanel/tabs/RoutesTab.d.ts.map +1 -0
  193. package/dist/react/react/components/DebugPanel/tabs/TimelineTab.d.ts +7 -0
  194. package/dist/react/react/components/DebugPanel/tabs/TimelineTab.d.ts.map +1 -0
  195. package/dist/react/react/components/StatsBar/MetricCard.d.ts +21 -0
  196. package/dist/react/react/components/StatsBar/MetricCard.d.ts.map +1 -0
  197. package/dist/react/react/components/StatsBar/Sparkline.d.ts +15 -0
  198. package/dist/react/react/components/StatsBar/Sparkline.d.ts.map +1 -0
  199. package/dist/react/react/components/StatsBar/StatsBar.d.ts +22 -0
  200. package/dist/react/react/components/StatsBar/StatsBar.d.ts.map +1 -0
  201. package/dist/react/react/components/shared/Badge.d.ts +32 -0
  202. package/dist/react/react/components/shared/Badge.d.ts.map +1 -0
  203. package/dist/react/react/components/shared/ConfigContent.d.ts +13 -0
  204. package/dist/react/react/components/shared/ConfigContent.d.ts.map +1 -0
  205. package/dist/react/react/components/shared/InternalsContent.d.ts +10 -0
  206. package/dist/react/react/components/shared/InternalsContent.d.ts.map +1 -0
  207. package/dist/react/react/components/shared/JsonViewer.d.ts +12 -0
  208. package/dist/react/react/components/shared/JsonViewer.d.ts.map +1 -0
  209. package/dist/react/react/components/shared/ThemeToggle.d.ts +13 -0
  210. package/dist/react/react/components/shared/ThemeToggle.d.ts.map +1 -0
  211. package/dist/react/react/components/shared/Tooltip.d.ts +16 -0
  212. package/dist/react/react/components/shared/Tooltip.d.ts.map +1 -0
  213. package/dist/react/react/hooks/useApiClient.d.ts +10 -0
  214. package/dist/react/react/hooks/useApiClient.d.ts.map +1 -0
  215. package/dist/react/react/hooks/useDashboardApiBase.d.ts +19 -0
  216. package/dist/react/react/hooks/useDashboardApiBase.d.ts.map +1 -0
  217. package/dist/react/react/hooks/useDashboardData.d.ts +27 -0
  218. package/dist/react/react/hooks/useDashboardData.d.ts.map +1 -0
  219. package/dist/react/react/hooks/useDebugData.d.ts +17 -0
  220. package/dist/react/react/hooks/useDebugData.d.ts.map +1 -0
  221. package/dist/react/react/hooks/useFeatures.d.ts +13 -0
  222. package/dist/react/react/hooks/useFeatures.d.ts.map +1 -0
  223. package/dist/react/react/hooks/useResizableTable.d.ts +13 -0
  224. package/dist/react/react/hooks/useResizableTable.d.ts.map +1 -0
  225. package/dist/react/react/hooks/useServerStats.d.ts +21 -0
  226. package/dist/react/react/hooks/useServerStats.d.ts.map +1 -0
  227. package/dist/react/react/hooks/useTheme.d.ts +12 -0
  228. package/dist/react/react/hooks/useTheme.d.ts.map +1 -0
  229. package/dist/react/react/index.d.ts +14 -0
  230. package/dist/react/react/index.d.ts.map +1 -0
  231. package/dist/react/style.css +1 -0
  232. package/dist/react/useApiClient-BVtNCmnL.js +9 -0
  233. package/dist/react/useDashboardApiBase-Bi36pJ2L.js +14 -0
  234. package/dist/react/useResizableTable-CNJmACdt.js +13 -0
  235. package/dist/src/collectors/app_collector.d.ts.map +1 -1
  236. package/dist/src/collectors/app_collector.js +28 -1
  237. package/dist/src/collectors/auto_detect.d.ts +31 -0
  238. package/dist/src/collectors/auto_detect.d.ts.map +1 -0
  239. package/dist/src/collectors/auto_detect.js +116 -0
  240. package/dist/src/collectors/collector.d.ts +17 -0
  241. package/dist/src/collectors/collector.d.ts.map +1 -1
  242. package/dist/src/collectors/db_pool_collector.d.ts.map +1 -1
  243. package/dist/src/collectors/db_pool_collector.js +33 -0
  244. package/dist/src/collectors/http_collector.d.ts.map +1 -1
  245. package/dist/src/collectors/http_collector.js +25 -6
  246. package/dist/src/collectors/index.d.ts +2 -0
  247. package/dist/src/collectors/index.d.ts.map +1 -1
  248. package/dist/src/collectors/index.js +1 -0
  249. package/dist/src/collectors/log_collector.d.ts +11 -4
  250. package/dist/src/collectors/log_collector.d.ts.map +1 -1
  251. package/dist/src/collectors/log_collector.js +51 -5
  252. package/dist/src/collectors/process_collector.d.ts.map +1 -1
  253. package/dist/src/collectors/process_collector.js +4 -0
  254. package/dist/src/collectors/queue_collector.d.ts.map +1 -1
  255. package/dist/src/collectors/queue_collector.js +55 -1
  256. package/dist/src/collectors/redis_collector.d.ts.map +1 -1
  257. package/dist/src/collectors/redis_collector.js +41 -3
  258. package/dist/src/collectors/system_collector.d.ts.map +1 -1
  259. package/dist/src/collectors/system_collector.js +4 -0
  260. package/dist/src/controller/api_controller.d.ts +101 -0
  261. package/dist/src/controller/api_controller.d.ts.map +1 -0
  262. package/dist/src/controller/api_controller.js +131 -0
  263. package/dist/src/controller/debug_controller.d.ts +14 -10
  264. package/dist/src/controller/debug_controller.d.ts.map +1 -1
  265. package/dist/src/controller/debug_controller.js +96 -102
  266. package/dist/src/core/theme.d.ts +42 -0
  267. package/dist/src/core/theme.d.ts.map +1 -0
  268. package/dist/src/core/theme.js +115 -0
  269. package/dist/src/dashboard/chart_aggregator.d.ts.map +1 -1
  270. package/dist/src/dashboard/dashboard_controller.d.ts +10 -14
  271. package/dist/src/dashboard/dashboard_controller.d.ts.map +1 -1
  272. package/dist/src/dashboard/dashboard_controller.js +132 -250
  273. package/dist/src/dashboard/dashboard_store.d.ts +62 -19
  274. package/dist/src/dashboard/dashboard_store.d.ts.map +1 -1
  275. package/dist/src/dashboard/dashboard_store.js +196 -43
  276. package/dist/src/dashboard/integrations/cache_inspector.d.ts +19 -1
  277. package/dist/src/dashboard/integrations/cache_inspector.d.ts.map +1 -1
  278. package/dist/src/dashboard/integrations/config_inspector.d.ts +1 -1
  279. package/dist/src/dashboard/integrations/config_inspector.d.ts.map +1 -1
  280. package/dist/src/dashboard/integrations/config_inspector.js +3 -2
  281. package/dist/src/dashboard/integrations/queue_inspector.d.ts +55 -10
  282. package/dist/src/dashboard/integrations/queue_inspector.d.ts.map +1 -1
  283. package/dist/src/dashboard/integrations/queue_inspector.js +70 -24
  284. package/dist/src/dashboard/models/stats_event.d.ts +1 -1
  285. package/dist/src/dashboard/models/stats_event.d.ts.map +1 -1
  286. package/dist/src/dashboard/models/stats_log.d.ts +1 -1
  287. package/dist/src/dashboard/models/stats_log.d.ts.map +1 -1
  288. package/dist/src/dashboard/models/stats_query.d.ts +1 -1
  289. package/dist/src/dashboard/models/stats_query.d.ts.map +1 -1
  290. package/dist/src/dashboard/models/stats_saved_filter.d.ts +1 -1
  291. package/dist/src/dashboard/models/stats_saved_filter.d.ts.map +1 -1
  292. package/dist/src/dashboard/models/stats_trace.d.ts +2 -1
  293. package/dist/src/dashboard/models/stats_trace.d.ts.map +1 -1
  294. package/dist/src/data/data_access.d.ts +103 -0
  295. package/dist/src/data/data_access.d.ts.map +1 -0
  296. package/dist/src/data/data_access.js +305 -0
  297. package/dist/src/data/index.d.ts +3 -0
  298. package/dist/src/data/index.d.ts.map +1 -0
  299. package/dist/src/data/index.js +1 -0
  300. package/dist/src/debug/debug_store.d.ts +20 -1
  301. package/dist/src/debug/debug_store.d.ts.map +1 -1
  302. package/dist/src/debug/debug_store.js +43 -15
  303. package/dist/src/debug/email_collector.d.ts +6 -2
  304. package/dist/src/debug/email_collector.d.ts.map +1 -1
  305. package/dist/src/debug/email_collector.js +3 -0
  306. package/dist/src/debug/event_collector.d.ts +6 -2
  307. package/dist/src/debug/event_collector.d.ts.map +1 -1
  308. package/dist/src/debug/event_collector.js +12 -8
  309. package/dist/src/debug/query_collector.d.ts +6 -2
  310. package/dist/src/debug/query_collector.d.ts.map +1 -1
  311. package/dist/src/debug/query_collector.js +3 -0
  312. package/dist/src/debug/ring_buffer.d.ts +1 -0
  313. package/dist/src/debug/ring_buffer.d.ts.map +1 -1
  314. package/dist/src/debug/ring_buffer.js +5 -2
  315. package/dist/src/debug/route_inspector.d.ts +2 -2
  316. package/dist/src/debug/route_inspector.d.ts.map +1 -1
  317. package/dist/src/debug/route_inspector.js +4 -3
  318. package/dist/src/debug/trace_collector.d.ts +7 -3
  319. package/dist/src/debug/trace_collector.d.ts.map +1 -1
  320. package/dist/src/debug/trace_collector.js +7 -5
  321. package/dist/src/debug/types.d.ts +107 -2
  322. package/dist/src/debug/types.d.ts.map +1 -1
  323. package/dist/src/debug/types.js +1 -1
  324. package/dist/src/define_config.d.ts +49 -5
  325. package/dist/src/define_config.d.ts.map +1 -1
  326. package/dist/src/define_config.js +360 -4
  327. package/dist/src/edge/bootstrap.d.ts +17 -0
  328. package/dist/src/edge/bootstrap.d.ts.map +1 -0
  329. package/dist/src/edge/bootstrap.js +29 -0
  330. package/dist/src/edge/client/dashboard.js +2 -3619
  331. package/dist/src/edge/client/debug-panel-deferred.js +1 -0
  332. package/dist/src/edge/client/debug-panel.js +1 -2140
  333. package/dist/src/edge/client/stats-bar.js +1 -801
  334. package/dist/src/edge/client-vue/dashboard.js +5 -0
  335. package/dist/src/edge/client-vue/debug-panel-deferred.js +4 -0
  336. package/dist/src/edge/client-vue/debug-panel.js +4 -0
  337. package/dist/src/edge/client-vue/stats-bar.js +4 -0
  338. package/dist/src/edge/plugin.d.ts +35 -2
  339. package/dist/src/edge/plugin.d.ts.map +1 -1
  340. package/dist/src/edge/plugin.js +30 -66
  341. package/dist/src/edge/types.d.ts +46 -0
  342. package/dist/src/edge/types.d.ts.map +1 -0
  343. package/dist/src/edge/types.js +4 -0
  344. package/dist/src/edge/views/dashboard.edge +1 -358
  345. package/dist/src/edge/views/debug-panel.edge +2 -154
  346. package/dist/src/edge/views/stats-bar.edge +15 -48
  347. package/dist/src/engine/stats_engine.d.ts +18 -0
  348. package/dist/src/engine/stats_engine.d.ts.map +1 -1
  349. package/dist/src/engine/stats_engine.js +45 -2
  350. package/dist/src/index.d.ts +1 -1
  351. package/dist/src/index.d.ts.map +1 -1
  352. package/dist/src/log_stream/log_stream_provider.d.ts.map +1 -1
  353. package/dist/src/log_stream/log_stream_provider.js +21 -4
  354. package/dist/src/log_stream/log_stream_service.d.ts +8 -1
  355. package/dist/src/log_stream/log_stream_service.d.ts.map +1 -1
  356. package/dist/src/log_stream/log_stream_service.js +27 -3
  357. package/dist/src/middleware/request_tracking_middleware.d.ts +1 -1
  358. package/dist/src/middleware/request_tracking_middleware.d.ts.map +1 -1
  359. package/dist/src/middleware/request_tracking_middleware.js +14 -6
  360. package/dist/src/prometheus/prometheus_collector.d.ts +2 -1
  361. package/dist/src/prometheus/prometheus_collector.d.ts.map +1 -1
  362. package/dist/src/provider/server_stats_provider.d.ts +91 -0
  363. package/dist/src/provider/server_stats_provider.d.ts.map +1 -1
  364. package/dist/src/provider/server_stats_provider.js +282 -63
  365. package/dist/src/routes/access_middleware.d.ts +2 -1
  366. package/dist/src/routes/access_middleware.d.ts.map +1 -1
  367. package/dist/src/routes/access_middleware.js +7 -1
  368. package/dist/src/routes/index.d.ts +4 -0
  369. package/dist/src/routes/index.d.ts.map +1 -0
  370. package/dist/src/routes/index.js +1 -0
  371. package/dist/src/routes/register_routes.d.ts +103 -0
  372. package/dist/src/routes/register_routes.d.ts.map +1 -0
  373. package/dist/src/routes/register_routes.js +356 -0
  374. package/dist/src/routes/router_types.d.ts +29 -0
  375. package/dist/src/routes/router_types.d.ts.map +1 -0
  376. package/dist/src/routes/router_types.js +1 -0
  377. package/dist/src/stubs/config.stub +12 -32
  378. package/dist/src/styles/components.css +1048 -0
  379. package/dist/src/{edge/client → styles}/dashboard.css +299 -736
  380. package/dist/src/{edge/client → styles}/debug-panel.css +117 -633
  381. package/dist/src/{edge/client → styles}/stats-bar.css +28 -10
  382. package/dist/src/styles/tokens.css +153 -0
  383. package/dist/src/styles/utilities.css +75 -0
  384. package/dist/src/types.d.ts +119 -16
  385. package/dist/src/types.d.ts.map +1 -1
  386. package/dist/src/utils/json_helpers.d.ts +2 -2
  387. package/dist/src/utils/json_helpers.d.ts.map +1 -1
  388. package/dist/src/utils/logger.d.ts +17 -0
  389. package/dist/src/utils/logger.d.ts.map +1 -0
  390. package/dist/src/utils/logger.js +27 -0
  391. package/dist/src/utils/mail_helpers.d.ts +1 -1
  392. package/dist/src/utils/mail_helpers.d.ts.map +1 -1
  393. package/dist/src/utils/mail_helpers.js +1 -1
  394. package/dist/vue/CacheSection-CkrIB4-j.js +149 -0
  395. package/dist/vue/CacheTab-BPisYYiQ.js +104 -0
  396. package/dist/vue/ConfigSection-gulpOiq1.js +576 -0
  397. package/dist/vue/ConfigTab-C8cafGUj.js +361 -0
  398. package/dist/vue/CustomPaneTab-J57ED_bh.js +172 -0
  399. package/dist/vue/EmailsSection-BlKvQDx8.js +206 -0
  400. package/dist/vue/EmailsTab-DhFhoNmU.js +157 -0
  401. package/dist/vue/EventsSection-BdzQvIVJ.js +107 -0
  402. package/dist/vue/EventsTab-DQ4Nd6AK.js +97 -0
  403. package/dist/vue/FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js +62 -0
  404. package/dist/vue/InternalsSection-BJUXE-5F.js +468 -0
  405. package/dist/vue/InternalsTab-DEMjqtlw.js +471 -0
  406. package/dist/vue/JobsSection-DOzuMrG3.js +187 -0
  407. package/dist/vue/JobsTab-BCvhOARO.js +117 -0
  408. package/dist/vue/JsonViewer.vue_vue_type_script_setup_true_lang-Vsqar1zx.js +67 -0
  409. package/dist/vue/LogsSection-CNN4y92u.js +227 -0
  410. package/dist/vue/LogsTab-CJerb22r.js +122 -0
  411. package/dist/vue/OverviewSection-SITNR_dA.js +849 -0
  412. package/dist/vue/PaginationControls.vue_vue_type_script_setup_true_lang-CuN7g_8Z.js +50 -0
  413. package/dist/vue/QueriesSection-BAebAHkD.js +429 -0
  414. package/dist/vue/QueriesTab-C8_7oprC.js +107 -0
  415. package/dist/vue/RequestsSection-CIR0IX39.js +243 -0
  416. package/dist/vue/RoutesSection-j1U2oa0g.js +106 -0
  417. package/dist/vue/RoutesTab-Dz0MkZuF.js +80 -0
  418. package/dist/vue/TimelineSection-Dw980UPg.js +186 -0
  419. package/dist/vue/TimelineTab-Db6lKKsD.js +250 -0
  420. package/dist/vue/WaterfallChart.vue_vue_type_script_setup_true_lang-tZ13cNj1.js +118 -0
  421. package/dist/vue/components/Dashboard/DashboardPage.vue.d.ts +18 -0
  422. package/dist/vue/components/Dashboard/DashboardPage.vue.d.ts.map +1 -0
  423. package/dist/vue/components/Dashboard/sections/CacheSection.vue.d.ts +5 -0
  424. package/dist/vue/components/Dashboard/sections/CacheSection.vue.d.ts.map +1 -0
  425. package/dist/vue/components/Dashboard/sections/ConfigSection.vue.d.ts +3 -0
  426. package/dist/vue/components/Dashboard/sections/ConfigSection.vue.d.ts.map +1 -0
  427. package/dist/vue/components/Dashboard/sections/EmailsSection.vue.d.ts +5 -0
  428. package/dist/vue/components/Dashboard/sections/EmailsSection.vue.d.ts.map +1 -0
  429. package/dist/vue/components/Dashboard/sections/EventsSection.vue.d.ts +5 -0
  430. package/dist/vue/components/Dashboard/sections/EventsSection.vue.d.ts.map +1 -0
  431. package/dist/vue/components/Dashboard/sections/InternalsSection.vue.d.ts +3 -0
  432. package/dist/vue/components/Dashboard/sections/InternalsSection.vue.d.ts.map +1 -0
  433. package/dist/vue/components/Dashboard/sections/JobsSection.vue.d.ts +5 -0
  434. package/dist/vue/components/Dashboard/sections/JobsSection.vue.d.ts.map +1 -0
  435. package/dist/vue/components/Dashboard/sections/LogsSection.vue.d.ts +3 -0
  436. package/dist/vue/components/Dashboard/sections/LogsSection.vue.d.ts.map +1 -0
  437. package/dist/vue/components/Dashboard/sections/OverviewSection.vue.d.ts +5 -0
  438. package/dist/vue/components/Dashboard/sections/OverviewSection.vue.d.ts.map +1 -0
  439. package/dist/vue/components/Dashboard/sections/QueriesSection.vue.d.ts +45 -0
  440. package/dist/vue/components/Dashboard/sections/QueriesSection.vue.d.ts.map +1 -0
  441. package/dist/vue/components/Dashboard/sections/RequestsSection.vue.d.ts +5 -0
  442. package/dist/vue/components/Dashboard/sections/RequestsSection.vue.d.ts.map +1 -0
  443. package/dist/vue/components/Dashboard/sections/RoutesSection.vue.d.ts +5 -0
  444. package/dist/vue/components/Dashboard/sections/RoutesSection.vue.d.ts.map +1 -0
  445. package/dist/vue/components/Dashboard/sections/TimelineSection.vue.d.ts +11 -0
  446. package/dist/vue/components/Dashboard/sections/TimelineSection.vue.d.ts.map +1 -0
  447. package/dist/vue/components/Dashboard/shared/FilterBar.vue.d.ts +29 -0
  448. package/dist/vue/components/Dashboard/shared/FilterBar.vue.d.ts.map +1 -0
  449. package/dist/vue/components/Dashboard/shared/PaginationControls.vue.d.ts +12 -0
  450. package/dist/vue/components/Dashboard/shared/PaginationControls.vue.d.ts.map +1 -0
  451. package/dist/vue/components/Dashboard/shared/TimeRangeSelector.vue.d.ts +11 -0
  452. package/dist/vue/components/Dashboard/shared/TimeRangeSelector.vue.d.ts.map +1 -0
  453. package/dist/vue/components/Dashboard/shared/WaterfallChart.vue.d.ts +10 -0
  454. package/dist/vue/components/Dashboard/shared/WaterfallChart.vue.d.ts.map +1 -0
  455. package/dist/vue/components/DebugPanel/DebugPanel.vue.d.ts +21 -0
  456. package/dist/vue/components/DebugPanel/DebugPanel.vue.d.ts.map +1 -0
  457. package/dist/vue/components/DebugPanel/tabs/CacheTab.vue.d.ts +12 -0
  458. package/dist/vue/components/DebugPanel/tabs/CacheTab.vue.d.ts.map +1 -0
  459. package/dist/vue/components/DebugPanel/tabs/ConfigTab.vue.d.ts +11 -0
  460. package/dist/vue/components/DebugPanel/tabs/ConfigTab.vue.d.ts.map +1 -0
  461. package/dist/vue/components/DebugPanel/tabs/CustomPaneTab.vue.d.ts +11 -0
  462. package/dist/vue/components/DebugPanel/tabs/CustomPaneTab.vue.d.ts.map +1 -0
  463. package/dist/vue/components/DebugPanel/tabs/EmailsTab.vue.d.ts +12 -0
  464. package/dist/vue/components/DebugPanel/tabs/EmailsTab.vue.d.ts.map +1 -0
  465. package/dist/vue/components/DebugPanel/tabs/EventsTab.vue.d.ts +12 -0
  466. package/dist/vue/components/DebugPanel/tabs/EventsTab.vue.d.ts.map +1 -0
  467. package/dist/vue/components/DebugPanel/tabs/InternalsTab.vue.d.ts +11 -0
  468. package/dist/vue/components/DebugPanel/tabs/InternalsTab.vue.d.ts.map +1 -0
  469. package/dist/vue/components/DebugPanel/tabs/JobsTab.vue.d.ts +13 -0
  470. package/dist/vue/components/DebugPanel/tabs/JobsTab.vue.d.ts.map +1 -0
  471. package/dist/vue/components/DebugPanel/tabs/LogsTab.vue.d.ts +15 -0
  472. package/dist/vue/components/DebugPanel/tabs/LogsTab.vue.d.ts.map +1 -0
  473. package/dist/vue/components/DebugPanel/tabs/QueriesTab.vue.d.ts +12 -0
  474. package/dist/vue/components/DebugPanel/tabs/QueriesTab.vue.d.ts.map +1 -0
  475. package/dist/vue/components/DebugPanel/tabs/RoutesTab.vue.d.ts +12 -0
  476. package/dist/vue/components/DebugPanel/tabs/RoutesTab.vue.d.ts.map +1 -0
  477. package/dist/vue/components/DebugPanel/tabs/TimelineTab.vue.d.ts +15 -0
  478. package/dist/vue/components/DebugPanel/tabs/TimelineTab.vue.d.ts.map +1 -0
  479. package/dist/vue/components/StatsBar/MetricCard.vue.d.ts +19 -0
  480. package/dist/vue/components/StatsBar/MetricCard.vue.d.ts.map +1 -0
  481. package/dist/vue/components/StatsBar/Sparkline.vue.d.ts +17 -0
  482. package/dist/vue/components/StatsBar/Sparkline.vue.d.ts.map +1 -0
  483. package/dist/vue/components/StatsBar/StatsBar.vue.d.ts +22 -0
  484. package/dist/vue/components/StatsBar/StatsBar.vue.d.ts.map +1 -0
  485. package/dist/vue/components/shared/JsonViewer.vue.d.ts +13 -0
  486. package/dist/vue/components/shared/JsonViewer.vue.d.ts.map +1 -0
  487. package/dist/vue/components/shared/ThemeToggle.vue.d.ts +8 -0
  488. package/dist/vue/components/shared/ThemeToggle.vue.d.ts.map +1 -0
  489. package/dist/vue/composables/useApiClient.d.ts +9 -0
  490. package/dist/vue/composables/useApiClient.d.ts.map +1 -0
  491. package/dist/vue/composables/useDashboardData.d.ts +53 -0
  492. package/dist/vue/composables/useDashboardData.d.ts.map +1 -0
  493. package/dist/vue/composables/useDebugData.d.ts +25 -0
  494. package/dist/vue/composables/useDebugData.d.ts.map +1 -0
  495. package/dist/vue/composables/useFeatures.d.ts +80 -0
  496. package/dist/vue/composables/useFeatures.d.ts.map +1 -0
  497. package/dist/vue/composables/useResizableTable.d.ts +16 -0
  498. package/dist/vue/composables/useResizableTable.d.ts.map +1 -0
  499. package/dist/vue/composables/useServerStats.d.ts +104 -0
  500. package/dist/vue/composables/useServerStats.d.ts.map +1 -0
  501. package/dist/vue/composables/useTheme.d.ts +6 -0
  502. package/dist/vue/composables/useTheme.d.ts.map +1 -0
  503. package/dist/vue/index-COgsk_nv.js +1233 -0
  504. package/dist/vue/index.d.ts +10 -0
  505. package/dist/vue/index.d.ts.map +1 -0
  506. package/dist/vue/index.js +11 -0
  507. package/dist/vue/style.css +1 -0
  508. package/dist/vue/useApiClient-BQQ9CF-q.js +10 -0
  509. package/dist/vue/useResizableTable-BoivAevK.js +17 -0
  510. package/package.json +68 -10
  511. package/dist/src/dashboard/dashboard_routes.d.ts +0 -16
  512. package/dist/src/dashboard/dashboard_routes.d.ts.map +0 -1
  513. package/dist/src/dashboard/dashboard_routes.js +0 -77
  514. package/dist/src/routes/debug_routes.d.ts +0 -14
  515. package/dist/src/routes/debug_routes.d.ts.map +0 -1
  516. package/dist/src/routes/debug_routes.js +0 -42
  517. package/dist/src/routes/stats_routes.d.ts +0 -14
  518. package/dist/src/routes/stats_routes.d.ts.map +0 -1
  519. package/dist/src/routes/stats_routes.js +0 -27
@@ -1,12 +1,13 @@
1
1
  import { readFileSync } from 'node:fs';
2
- import { registerDashboardRoutes } from '../dashboard/dashboard_routes.js';
2
+ import { getLogStreamService } from '../collectors/log_collector.js';
3
3
  import { DashboardStore } from '../dashboard/dashboard_store.js';
4
+ import { DataAccess } from '../data/data_access.js';
4
5
  import { DebugStore } from '../debug/debug_store.js';
5
6
  import { StatsEngine } from '../engine/stats_engine.js';
6
7
  import { LogStreamService } from '../log_stream/log_stream_service.js';
7
8
  import { setShouldShow, setTraceCollector, setDashboardPath, setExcludedPrefixes, setOnRequestComplete, } from '../middleware/request_tracking_middleware.js';
8
- import { registerDebugRoutes } from '../routes/debug_routes.js';
9
- import { registerStatsRoutes } from '../routes/stats_routes.js';
9
+ import { registerAllRoutes } from '../routes/register_routes.js';
10
+ import { log, dim, bold } from '../utils/logger.js';
10
11
  export default class ServerStatsProvider {
11
12
  app;
12
13
  intervalId = null;
@@ -21,6 +22,15 @@ export default class ServerStatsProvider {
21
22
  flushTimer = null;
22
23
  statsController = null;
23
24
  debugController = null;
25
+ apiController = null;
26
+ // Diagnostics tracking
27
+ pinoHookActive = false;
28
+ edgePluginActive = false;
29
+ prometheusActive = false;
30
+ transmitAvailable = false;
31
+ transmitChannels = [];
32
+ resolvedConfig = null;
33
+ resolvedCollectors = [];
24
34
  constructor(app) {
25
35
  this.app = app;
26
36
  }
@@ -41,55 +51,66 @@ export default class ServerStatsProvider {
41
51
  }
42
52
  if (router && !this.app.inProduction) {
43
53
  const registeredPaths = [];
44
- // ── Auto-register stats bar endpoint ───────────────────────
45
- if (typeof config.endpoint === 'string') {
46
- registerStatsRoutes(router, config.endpoint, () => this.statsController, config.shouldShow);
47
- registeredPaths.push(config.endpoint);
48
- }
49
- // ── Auto-register debug toolbar routes ─────────────────────
54
+ const r = router;
50
55
  const toolbarConfig = config.devToolbar;
51
- if (toolbarConfig?.enabled) {
52
- const debugEndpoint = toolbarConfig.debugEndpoint ?? '/admin/api/debug';
53
- registerDebugRoutes(router, debugEndpoint, () => this.debugController, config.shouldShow);
56
+ // Derive endpoint paths for route registration
57
+ const statsEndpoint = typeof config.endpoint === 'string' ? config.endpoint : false;
58
+ const debugEndpoint = toolbarConfig?.enabled
59
+ ? (toolbarConfig.debugEndpoint ?? '/admin/api/debug')
60
+ : undefined;
61
+ const dashboardPath = toolbarConfig?.enabled && toolbarConfig.dashboard
62
+ ? (toolbarConfig.dashboardPath ?? '/__stats')
63
+ : undefined;
64
+ // ── Register all routes via the unified registrar ──────────
65
+ registerAllRoutes({
66
+ router: r,
67
+ getApiController: () => this.apiController,
68
+ getStatsController: () => this.statsController,
69
+ getDebugController: () => this.debugController,
70
+ getDashboardController: () => this.dashboardController,
71
+ statsEndpoint,
72
+ debugEndpoint,
73
+ dashboardPath,
74
+ shouldShow: config.shouldShow,
75
+ });
76
+ // Track which paths were registered for logging
77
+ if (typeof statsEndpoint === 'string') {
78
+ registeredPaths.push(statsEndpoint);
79
+ }
80
+ if (debugEndpoint) {
54
81
  registeredPaths.push(debugEndpoint + '/*');
55
- // ── Auto-register dashboard routes ─────────────────────────
56
- if (toolbarConfig.dashboard) {
57
- const dashPath = toolbarConfig.dashboardPath ?? '/__stats';
58
- registerDashboardRoutes(router, dashPath, () => this.dashboardController, config.shouldShow);
59
- registeredPaths.push(dashPath + '/*');
60
- }
82
+ }
83
+ if (dashboardPath) {
84
+ registeredPaths.push(dashboardPath + '/*');
61
85
  }
62
86
  // Log registered routes
63
87
  if (registeredPaths.length > 0) {
64
- const tag = '\x1b[36m[ \x1b[1m🔍 server-stats\x1b[0m\x1b[36m ]\x1b[0m';
65
- const dim = (s) => `\x1b[2m${s}\x1b[0m`;
66
- const bold = (s) => `\x1b[1m${s}\x1b[0m`;
67
- console.log(`\n${tag} routes registered:\n` +
68
- registeredPaths.map((p) => ` ${dim('→')} ${bold(p)}`).join('\n'));
88
+ log.list('routes registered:', registeredPaths);
69
89
  // Only warn about global auth middleware if:
70
90
  // 1. shouldShow is NOT configured (user hasn't set up access control)
71
91
  // 2. There IS auth middleware in server.use() or router.use()
72
92
  if (!config.shouldShow) {
73
93
  const authMiddleware = this.detectGlobalAuthMiddleware();
74
94
  if (authMiddleware.length > 0) {
75
- console.log(`\n${tag} ${bold('found global auth middleware that will run on every poll:')}\n` +
76
- authMiddleware.map((m) => ` ${dim('→')} ${m}`).join('\n') +
77
- '\n\n' +
78
- ` ${dim('these routes get polled every ~3s, so auth middleware will')}\n` +
79
- ` ${dim('trigger a DB query on each poll. here are two ways to fix it:')}\n` +
80
- '\n' +
81
- ` ${bold('option 1:')} add a shouldShow callback to your config:\n` +
82
- '\n' +
83
- ` ${dim('// config/server_stats.ts')}\n` +
84
- ` ${dim("shouldShow: (ctx) => ctx.auth?.user?.role === 'admin'")}\n` +
85
- '\n' +
86
- ` ${bold('option 2:')} move auth middleware from router.use() to a route group:\n` +
87
- '\n' +
88
- ` ${dim('// start/kernel.ts — remove from router.use()')}\n` +
89
- ` ${dim("// () => import('#middleware/silent_auth_middleware')")}\n` +
90
- '\n' +
91
- ` ${dim('// start/routes.ts — add to your route groups instead')}\n` +
92
- ` ${dim("router.group(() => { ... }).use(middleware.silentAuth())")}\n`);
95
+ log.block(bold('found global auth middleware that will run on every poll:'), [
96
+ ...authMiddleware.map((m) => `${dim('→')} ${m}`),
97
+ '',
98
+ dim('these routes get polled every ~3s, so auth middleware will'),
99
+ dim('trigger a DB query on each poll. here are two ways to fix it:'),
100
+ '',
101
+ `${bold('option 1:')} add a shouldShow callback to your config:`,
102
+ '',
103
+ dim('// config/server_stats.ts'),
104
+ dim("shouldShow: (ctx) => ctx.auth?.user?.role === 'admin'"),
105
+ '',
106
+ `${bold('option 2:')} move auth middleware from router.use() to a route group:`,
107
+ '',
108
+ dim('// start/kernel.ts — remove from router.use()'),
109
+ dim("// () => import('#middleware/silent_auth_middleware')"),
110
+ '',
111
+ dim('// start/routes.ts — add to your route groups instead'),
112
+ dim('router.group(() => { ... }).use(middleware.silentAuth())'),
113
+ ]);
93
114
  }
94
115
  }
95
116
  }
@@ -100,9 +121,11 @@ export default class ServerStatsProvider {
100
121
  const edge = await import('edge.js');
101
122
  const { edgePluginServerStats } = await import('../edge/plugin.js');
102
123
  edge.default.use(edgePluginServerStats(config));
124
+ this.edgePluginActive = true;
103
125
  }
104
- catch {
105
- // Edge not available skip tag registration
126
+ catch (err) {
127
+ log.warn('could not register Edge plugin@serverStats() tag will not work: ' +
128
+ err?.message);
106
129
  }
107
130
  }
108
131
  /**
@@ -155,15 +178,73 @@ export default class ServerStatsProvider {
155
178
  }
156
179
  return found;
157
180
  }
181
+ /**
182
+ * Hook into the AdonisJS logger's Pino stream to feed log entries
183
+ * directly into the LogStreamService — no file path needed.
184
+ *
185
+ * Uses `Symbol.for('pino.stream')` (documented Pino API) to access
186
+ * the underlying destination stream, then wraps its `write` method
187
+ * to tee entries into the log collector.
188
+ */
189
+ async hookPinoLogger() {
190
+ const logStream = getLogStreamService();
191
+ if (!logStream)
192
+ return; // logCollector() not in the config
193
+ let logger;
194
+ try {
195
+ logger = await this.app.container.make('logger');
196
+ }
197
+ catch {
198
+ // Logger not available
199
+ }
200
+ const pino = logger?.pino;
201
+ if (!pino)
202
+ return;
203
+ const streamSym = Symbol.for('pino.stream');
204
+ const rawStream = pino[streamSym];
205
+ if (!rawStream || typeof rawStream.write !== 'function')
206
+ return;
207
+ const stream = rawStream;
208
+ const originalWrite = stream.write.bind(stream);
209
+ stream.write = function (chunk, ...args) {
210
+ try {
211
+ const str = typeof chunk === 'string' ? chunk : chunk.toString();
212
+ const entry = JSON.parse(str);
213
+ if (entry && typeof entry.level === 'number') {
214
+ logStream.ingest(entry);
215
+ }
216
+ }
217
+ catch {
218
+ // Not valid JSON — ignore (e.g. pino-pretty output)
219
+ }
220
+ return originalWrite(chunk, ...args);
221
+ };
222
+ this.pinoHookActive = true;
223
+ log.info('log collector hooked into AdonisJS logger (zero-config)');
224
+ }
158
225
  async ready() {
159
226
  const config = this.app.config.get('server_stats');
160
227
  if (!config)
161
228
  return;
162
229
  if (this.app.inTest && config.skipInTest !== false)
163
230
  return;
164
- this.engine = new StatsEngine(config.collectors);
231
+ this.resolvedConfig = config;
232
+ let collectors;
233
+ if (!config.collectors || config.collectors === 'auto') {
234
+ const { autoDetectCollectors } = await import('../collectors/auto_detect.js');
235
+ const result = await autoDetectCollectors();
236
+ collectors = result.collectors;
237
+ log.info(`${bold(String(result.active))} of ${bold(String(result.total))} collectors active`);
238
+ }
239
+ else {
240
+ collectors = config.collectors;
241
+ }
242
+ this.resolvedCollectors = collectors;
243
+ this.engine = new StatsEngine(collectors);
165
244
  this.app.container.singleton('server_stats.engine', () => this.engine);
166
245
  await this.engine.start();
246
+ // Auto-hook log collector into the AdonisJS Pino logger (zero-config)
247
+ await this.hookPinoLogger();
167
248
  // Create the stats controller (makes the stats route functional)
168
249
  const StatsControllerClass = (await import('../controller/server_stats_controller.js')).default;
169
250
  this.statsController = new StatsControllerClass(this.engine);
@@ -196,14 +277,27 @@ export default class ServerStatsProvider {
196
277
  if (prefixes.length > 0) {
197
278
  setExcludedPrefixes(prefixes);
198
279
  }
280
+ // Create the unified ApiController now that both stores are available
281
+ if (this.debugStore) {
282
+ const logPath = this.app.makePath('logs', 'adonisjs.log');
283
+ const dataAccess = new DataAccess(this.debugStore, this.dashboardStore, logPath);
284
+ const { ApiController: ApiControllerClass } = await import('../controller/api_controller.js');
285
+ this.apiController = new ApiControllerClass(dataAccess);
286
+ }
199
287
  }
200
288
  let transmit = null;
201
289
  if (config.transport === 'transmit') {
202
290
  try {
203
291
  transmit = await this.app.container.make('transmit');
292
+ if (transmit) {
293
+ this.transmitAvailable = true;
294
+ if (config.channelName) {
295
+ this.transmitChannels.push(config.channelName);
296
+ }
297
+ }
204
298
  }
205
299
  catch {
206
- // Transmit not installed — skip broadcasting
300
+ log.info('transport is "transmit" but @adonisjs/transmit is not installed — falling back to polling');
207
301
  }
208
302
  }
209
303
  let prometheusCollector = null;
@@ -212,15 +306,21 @@ export default class ServerStatsProvider {
212
306
  prometheusCollector = mod.ServerStatsCollector.instance;
213
307
  }
214
308
  catch {
215
- // Prometheus not installed — skip
309
+ // Prometheus not installed — skip (optional dependency)
310
+ }
311
+ if (prometheusCollector) {
312
+ this.prometheusActive = true;
313
+ log.info('Prometheus integration active');
216
314
  }
217
315
  this.intervalId = setInterval(async () => {
218
316
  try {
219
317
  const stats = await this.engine.collect();
220
318
  if (transmit && config.channelName) {
319
+ ;
221
320
  transmit.broadcast(config.channelName, JSON.parse(JSON.stringify(stats)));
222
321
  }
223
322
  if (prometheusCollector) {
323
+ ;
224
324
  prometheusCollector.update(stats);
225
325
  }
226
326
  config.onStats?.(stats);
@@ -247,7 +347,7 @@ export default class ServerStatsProvider {
247
347
  emitter = await this.app.container.make('emitter');
248
348
  }
249
349
  catch {
250
- // Emitter not available
350
+ log.warn('AdonisJS emitter not available — query and event collection will be disabled');
251
351
  }
252
352
  // Get the router
253
353
  let router = null;
@@ -259,9 +359,13 @@ export default class ServerStatsProvider {
259
359
  }
260
360
  await this.debugStore.start(emitter, router);
261
361
  // Create the debug controller (makes the debug routes functional)
262
- const logPath = this.app.makePath('logs', 'adonisjs.log');
362
+ const serverConfig = this.app.config.get('server_stats');
263
363
  const DebugControllerClass = (await import('../controller/debug_controller.js')).default;
264
- this.debugController = new DebugControllerClass(this.debugStore, logPath);
364
+ this.debugController = new DebugControllerClass(this.debugStore, serverConfig, {
365
+ getEngine: () => this.engine,
366
+ getDashboardStore: () => this.dashboardStore,
367
+ getProviderDiagnostics: () => this.getDiagnostics(),
368
+ });
265
369
  // Wire trace collector into the request tracking middleware
266
370
  if (this.debugStore.traces) {
267
371
  setTraceCollector(this.debugStore.traces);
@@ -286,7 +390,11 @@ export default class ServerStatsProvider {
286
390
  // Transmit not installed — debug panel will use polling
287
391
  }
288
392
  if (debugTransmit) {
393
+ this.transmitAvailable = true;
289
394
  const debugChannel = 'server-stats/debug';
395
+ if (!this.transmitChannels.includes(debugChannel)) {
396
+ this.transmitChannels.push(debugChannel);
397
+ }
290
398
  const pendingTypes = new Set();
291
399
  this.debugStore.onNewItem((type) => {
292
400
  // Debounce: coalesce rapid events into a single broadcast
@@ -298,6 +406,7 @@ export default class ServerStatsProvider {
298
406
  const types = Array.from(pendingTypes);
299
407
  pendingTypes.clear();
300
408
  try {
409
+ ;
301
410
  debugTransmit.broadcast(debugChannel, { types });
302
411
  }
303
412
  catch {
@@ -328,9 +437,9 @@ export default class ServerStatsProvider {
328
437
  catch (err) {
329
438
  const msg = err?.message || '';
330
439
  if (msg.includes('better-sqlite3') || msg.includes('Cannot find module')) {
331
- console.warn('[server-stats] Dashboard requires better-sqlite3. Install it with:\n' +
440
+ log.warn('Dashboard requires better-sqlite3. Install it with:\n' +
332
441
  ' npm install better-sqlite3\n' +
333
- 'Dashboard has been disabled for this session.');
442
+ ' Dashboard has been disabled for this session.');
334
443
  this.dashboardStore = null;
335
444
  return;
336
445
  }
@@ -343,18 +452,33 @@ export default class ServerStatsProvider {
343
452
  setDashboardPath(toolbarConfig.dashboardPath);
344
453
  // Create the controller — this makes the routes registered in boot() functional
345
454
  const DashboardControllerClass = (await import('../dashboard/dashboard_controller.js')).default;
346
- this.dashboardController = new DashboardControllerClass(this.dashboardStore, this.debugStore, this.app);
455
+ this.dashboardController = new DashboardControllerClass(this.dashboardStore, this.app);
347
456
  // ── Log piping ────────────────────────────────────────────────
348
- const logPath = this.app.makePath('logs', 'adonisjs.log');
349
- this.dashboardLogStream = new LogStreamService(logPath, (entry) => {
350
- this.dashboardStore?.recordLog(entry);
351
- });
352
- await this.dashboardLogStream.start();
457
+ // If the log collector is already hooked into Pino (zero-config mode),
458
+ // piggyback on it instead of creating a separate file poller.
459
+ const existingLogStream = getLogStreamService();
460
+ if (existingLogStream && !existingLogStream['logPath']) {
461
+ // Stream mode — add a listener for dashboard persistence
462
+ const origOnEntry = existingLogStream['onEntry'];
463
+ existingLogStream['onEntry'] = (entry) => {
464
+ origOnEntry?.(entry);
465
+ this.dashboardStore?.recordLog(entry);
466
+ };
467
+ }
468
+ else {
469
+ // File-based fallback
470
+ const logPath = this.app.makePath('logs', 'adonisjs.log');
471
+ this.dashboardLogStream = new LogStreamService(logPath, (entry) => {
472
+ this.dashboardStore?.recordLog(entry);
473
+ });
474
+ await this.dashboardLogStream.start();
475
+ }
353
476
  // ── Per-request data piping ────────────────────────────────────
354
477
  const debugStore = this.debugStore;
355
478
  const dashStore = this.dashboardStore;
356
479
  let lastQueryId = 0;
357
480
  let lastEventId = 0;
481
+ let warnedPersistOnce = false;
358
482
  setOnRequestComplete(({ method, url, statusCode, duration, trace }) => {
359
483
  if (!dashStore.isReady())
360
484
  return;
@@ -372,14 +496,24 @@ export default class ServerStatsProvider {
372
496
  }
373
497
  // Persist asynchronously (fire-and-forget)
374
498
  dashStore
375
- .persistRequest(method, url, statusCode, duration, newQueries, trace ?? null)
499
+ .persistRequest({
500
+ method,
501
+ url,
502
+ statusCode,
503
+ duration,
504
+ queries: newQueries,
505
+ trace: trace ?? null,
506
+ })
376
507
  .then((requestId) => {
377
508
  if (requestId !== null && newEvents.length > 0) {
378
509
  return dashStore.recordEvents(requestId, newEvents);
379
510
  }
380
511
  })
381
- .catch(() => {
382
- // Silently ignore persistence errors
512
+ .catch((err) => {
513
+ if (!warnedPersistOnce) {
514
+ warnedPersistOnce = true;
515
+ log.warn('failed to persist request data — ' + (err?.message || 'unknown error'));
516
+ }
383
517
  });
384
518
  });
385
519
  // ── Transmit streaming for real-time dashboard updates ────────
@@ -391,13 +525,24 @@ export default class ServerStatsProvider {
391
525
  // Transmit not installed — skip real-time updates
392
526
  }
393
527
  if (transmit) {
528
+ this.transmitAvailable = true;
394
529
  const dashChannel = 'server-stats/dashboard';
530
+ if (!this.transmitChannels.includes(dashChannel)) {
531
+ this.transmitChannels.push(dashChannel);
532
+ }
395
533
  this.dashboardBroadcastTimer = setInterval(async () => {
396
534
  try {
397
535
  if (!dashStore.isReady())
398
536
  return;
399
537
  const overview = await dashStore.getOverviewMetrics('1h');
400
- transmit.broadcast(dashChannel, overview);
538
+ const diagnostics = {
539
+ collectors: this.engine.getCollectorHealth(),
540
+ buffers: this.debugStore.getBufferStats(),
541
+ };
542
+ transmit.broadcast(dashChannel, {
543
+ ...overview,
544
+ diagnostics,
545
+ });
401
546
  }
402
547
  catch {
403
548
  // Silently ignore
@@ -405,6 +550,80 @@ export default class ServerStatsProvider {
405
550
  }, 5_000);
406
551
  }
407
552
  }
553
+ /** Return diagnostics state for the Internals endpoint. */
554
+ getDiagnostics() {
555
+ const config = this.resolvedConfig;
556
+ const toolbarConfig = config?.devToolbar;
557
+ return {
558
+ timers: {
559
+ collectionInterval: {
560
+ active: this.intervalId !== null,
561
+ intervalMs: config?.intervalMs ?? 0,
562
+ },
563
+ dashboardBroadcast: {
564
+ active: this.dashboardBroadcastTimer !== null,
565
+ intervalMs: 5000,
566
+ },
567
+ debugBroadcast: {
568
+ active: this.debugBroadcastTimer !== null,
569
+ debounceMs: 200,
570
+ },
571
+ persistFlush: {
572
+ active: this.flushTimer !== null,
573
+ intervalMs: 30_000,
574
+ },
575
+ retentionCleanup: {
576
+ active: this.dashboardStore?.isReady() ?? false,
577
+ intervalMs: 60 * 60 * 1000,
578
+ },
579
+ },
580
+ transmit: {
581
+ available: this.transmitAvailable,
582
+ channels: this.transmitChannels,
583
+ },
584
+ integrations: {
585
+ prometheus: { active: this.prometheusActive },
586
+ pinoHook: {
587
+ active: this.pinoHookActive,
588
+ mode: this.pinoHookActive ? 'stream' : toolbarConfig?.enabled ? 'none' : 'none',
589
+ },
590
+ edgePlugin: { active: this.edgePluginActive },
591
+ cacheInspector: {
592
+ available: this.resolvedCollectors.some((c) => c.name === 'redis'),
593
+ },
594
+ queueInspector: {
595
+ available: this.resolvedCollectors.some((c) => c.name === 'queue'),
596
+ },
597
+ },
598
+ config: {
599
+ intervalMs: config?.intervalMs ?? 0,
600
+ transport: config?.transport ?? 'none',
601
+ channelName: config?.channelName ?? '',
602
+ endpoint: config?.endpoint ?? false,
603
+ skipInTest: config?.skipInTest !== false,
604
+ hasOnStatsCallback: typeof config?.onStats === 'function',
605
+ hasShouldShowCallback: typeof config?.shouldShow === 'function',
606
+ },
607
+ devToolbar: {
608
+ enabled: !!toolbarConfig?.enabled,
609
+ maxQueries: toolbarConfig?.maxQueries ?? 500,
610
+ maxEvents: toolbarConfig?.maxEvents ?? 200,
611
+ maxEmails: toolbarConfig?.maxEmails ?? 100,
612
+ maxTraces: toolbarConfig?.maxTraces ?? 200,
613
+ slowQueryThresholdMs: toolbarConfig?.slowQueryThresholdMs ?? 100,
614
+ tracing: toolbarConfig?.tracing ?? false,
615
+ dashboard: toolbarConfig?.dashboard ?? false,
616
+ dashboardPath: toolbarConfig?.dashboardPath ?? '/__stats',
617
+ debugEndpoint: toolbarConfig?.debugEndpoint ?? '/admin/api/debug',
618
+ retentionDays: toolbarConfig?.retentionDays ?? 7,
619
+ dbPath: toolbarConfig?.dbPath ?? '.adonisjs/server-stats/dashboard.sqlite3',
620
+ persistDebugData: toolbarConfig?.persistDebugData ?? false,
621
+ renderer: toolbarConfig?.renderer ?? 'preact',
622
+ excludeFromTracing: toolbarConfig?.excludeFromTracing ?? [],
623
+ customPaneCount: toolbarConfig?.panes?.length ?? 0,
624
+ },
625
+ };
626
+ }
408
627
  async shutdown() {
409
628
  if (this.intervalId) {
410
629
  clearInterval(this.intervalId);
@@ -427,8 +646,8 @@ export default class ServerStatsProvider {
427
646
  try {
428
647
  await this.debugStore.saveToDisk(this.persistPath);
429
648
  }
430
- catch {
431
- // Silently ignore save errors during shutdown
649
+ catch (err) {
650
+ log.warn('could not save debug data on shutdown — ' + err?.message);
432
651
  }
433
652
  }
434
653
  // Clean up dashboard resources
@@ -1,8 +1,9 @@
1
+ import type { HttpContext } from '@adonisjs/core/http';
1
2
  /**
2
3
  * Create a middleware function that gates access using the shouldShow callback.
3
4
  * Returns 403 if the callback returns false.
4
5
  *
5
6
  * Shared by stats, debug, and dashboard route registrars.
6
7
  */
7
- export declare function createAccessMiddleware(shouldShow: (ctx: any) => boolean): (ctx: any, next: () => Promise<void>) => Promise<any>;
8
+ export declare function createAccessMiddleware(shouldShow: (ctx: HttpContext) => boolean): (ctx: HttpContext, next: () => Promise<void>) => Promise<void>;
8
9
  //# sourceMappingURL=access_middleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"access_middleware.d.ts","sourceRoot":"","sources":["../../../src/routes/access_middleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,IACxD,KAAK,GAAG,EAAE,MAAM,MAAM,OAAO,CAAC,IAAI,CAAC,kBAUlD"}
1
+ {"version":3,"file":"access_middleware.d.ts","sourceRoot":"","sources":["../../../src/routes/access_middleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAItD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,OAAO,IAChE,KAAK,WAAW,EAAE,MAAM,MAAM,OAAO,CAAC,IAAI,CAAC,mBAgB1D"}
@@ -1,3 +1,5 @@
1
+ import { log } from '../utils/logger.js';
2
+ let warnedShouldShow = false;
1
3
  /**
2
4
  * Create a middleware function that gates access using the shouldShow callback.
3
5
  * Returns 403 if the callback returns false.
@@ -11,7 +13,11 @@ export function createAccessMiddleware(shouldShow) {
11
13
  return ctx.response.forbidden({ error: 'Access denied' });
12
14
  }
13
15
  }
14
- catch {
16
+ catch (err) {
17
+ if (!warnedShouldShow) {
18
+ warnedShouldShow = true;
19
+ log.warn('shouldShow callback threw in route guard — returning 403: ' + err?.message);
20
+ }
15
21
  return ctx.response.forbidden({ error: 'Access denied' });
16
22
  }
17
23
  await next();
@@ -0,0 +1,4 @@
1
+ export { registerAllRoutes } from './register_routes.js';
2
+ export type { RegisterRoutesOptions } from './register_routes.js';
3
+ export type { AdonisRoute, AdonisRouter } from './router_types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AACjE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1 @@
1
+ export { registerAllRoutes } from './register_routes.js';