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.
- package/README.md +351 -171
- package/dist/configure.d.ts.map +1 -1
- package/dist/core/api-client.d.ts +73 -0
- package/dist/core/api-client.d.ts.map +1 -0
- package/dist/core/config-utils.d.ts +109 -0
- package/dist/core/config-utils.d.ts.map +1 -0
- package/dist/core/constants.d.ts +11 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/dashboard-api.d.ts +65 -0
- package/dist/core/dashboard-api.d.ts.map +1 -0
- package/dist/core/dashboard-data-controller.d.ts +157 -0
- package/dist/core/dashboard-data-controller.d.ts.map +1 -0
- package/dist/core/debug-data-controller.d.ts +89 -0
- package/dist/core/debug-data-controller.d.ts.map +1 -0
- package/dist/core/feature-detect.d.ts +67 -0
- package/dist/core/feature-detect.d.ts.map +1 -0
- package/dist/core/formatters.d.ts +189 -0
- package/dist/core/formatters.d.ts.map +1 -0
- package/dist/core/history-buffer.d.ts +23 -0
- package/dist/core/history-buffer.d.ts.map +1 -0
- package/dist/core/icons.d.ts +36 -0
- package/dist/core/icons.d.ts.map +1 -0
- package/dist/core/index.d.ts +39 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +1961 -0
- package/dist/core/internals-utils.d.ts +71 -0
- package/dist/core/internals-utils.d.ts.map +1 -0
- package/dist/core/job-utils.d.ts +45 -0
- package/dist/core/job-utils.d.ts.map +1 -0
- package/dist/core/log-utils.d.ts +34 -0
- package/dist/core/log-utils.d.ts.map +1 -0
- package/dist/core/metrics.d.ts +41 -0
- package/dist/core/metrics.d.ts.map +1 -0
- package/dist/core/pagination.d.ts +128 -0
- package/dist/core/pagination.d.ts.map +1 -0
- package/dist/core/query-utils.d.ts +35 -0
- package/dist/core/query-utils.d.ts.map +1 -0
- package/dist/core/resizable-columns.d.ts +18 -0
- package/dist/core/resizable-columns.d.ts.map +1 -0
- package/dist/core/routes.d.ts +12 -0
- package/dist/core/routes.d.ts.map +1 -0
- package/dist/core/server-stats-controller.d.ts +106 -0
- package/dist/core/server-stats-controller.d.ts.map +1 -0
- package/dist/core/sparkline.d.ts +80 -0
- package/dist/core/sparkline.d.ts.map +1 -0
- package/dist/core/theme.d.ts +42 -0
- package/dist/core/theme.d.ts.map +1 -0
- package/dist/core/trace-utils.d.ts +62 -0
- package/dist/core/trace-utils.d.ts.map +1 -0
- package/dist/core/transmit-adapter.d.ts +59 -0
- package/dist/core/transmit-adapter.d.ts.map +1 -0
- package/dist/core/types.d.ts +619 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/react/CacheSection-DGxMDlWK.js +146 -0
- package/dist/react/CacheTab-CnVW5PLs.js +123 -0
- package/dist/react/ConfigContent-CnsEI4j3.js +397 -0
- package/dist/react/ConfigSection-DPcrfqXY.js +11 -0
- package/dist/react/ConfigTab-BSWq_o2p.js +15 -0
- package/dist/react/CustomPaneTab-xjkYwTvH.js +104 -0
- package/dist/react/DataTable-YyShr5B-.js +55 -0
- package/dist/react/EmailsSection-CSyTg1aX.js +262 -0
- package/dist/react/EmailsTab-Dh2YSa_f.js +131 -0
- package/dist/react/EventsSection-C1pbJDfW.js +86 -0
- package/dist/react/EventsTab-eCh02cdd.js +63 -0
- package/dist/react/FilterBar-DQRXpWrb.js +50 -0
- package/dist/react/InternalsContent-DBzsI0CG.js +346 -0
- package/dist/react/InternalsSection-t7ihcWO-.js +32 -0
- package/dist/react/InternalsTab-Oij0A2fN.js +30 -0
- package/dist/react/JobsSection-CLAin5vU.js +187 -0
- package/dist/react/JobsTab-Dl5nrj2z.js +141 -0
- package/dist/react/LogsSection-C1p81fXO.js +212 -0
- package/dist/react/LogsTab-D-kR7PjX.js +88 -0
- package/dist/react/OverviewSection-nm3xdACz.js +539 -0
- package/dist/react/Pagination-BkmzUDY8.js +64 -0
- package/dist/react/QueriesSection-DB12HMfQ.js +461 -0
- package/dist/react/QueriesTab-fyBB1u_Y.js +90 -0
- package/dist/react/RequestsSection-DTqB81ac.js +209 -0
- package/dist/react/RoutesSection-DJWa4NPV.js +74 -0
- package/dist/react/RoutesTab-D3l8TOpu.js +74 -0
- package/dist/react/TimelineSection-C4d-jRX1.js +158 -0
- package/dist/react/TimelineTab-C5TFaSmQ.js +193 -0
- package/dist/react/WaterfallChart-Cj73WdfM.js +100 -0
- package/dist/react/core/api-client.d.ts +73 -0
- package/dist/react/core/api-client.d.ts.map +1 -0
- package/dist/react/core/config-utils.d.ts +109 -0
- package/dist/react/core/config-utils.d.ts.map +1 -0
- package/dist/react/core/constants.d.ts +11 -0
- package/dist/react/core/constants.d.ts.map +1 -0
- package/dist/react/core/dashboard-api.d.ts +65 -0
- package/dist/react/core/dashboard-api.d.ts.map +1 -0
- package/dist/react/core/dashboard-data-controller.d.ts +157 -0
- package/dist/react/core/dashboard-data-controller.d.ts.map +1 -0
- package/dist/react/core/debug-data-controller.d.ts +89 -0
- package/dist/react/core/debug-data-controller.d.ts.map +1 -0
- package/dist/react/core/feature-detect.d.ts +67 -0
- package/dist/react/core/feature-detect.d.ts.map +1 -0
- package/dist/react/core/formatters.d.ts +189 -0
- package/dist/react/core/formatters.d.ts.map +1 -0
- package/dist/react/core/history-buffer.d.ts +23 -0
- package/dist/react/core/history-buffer.d.ts.map +1 -0
- package/dist/react/core/icons.d.ts +36 -0
- package/dist/react/core/icons.d.ts.map +1 -0
- package/dist/react/core/index.d.ts +39 -0
- package/dist/react/core/index.d.ts.map +1 -0
- package/dist/react/core/internals-utils.d.ts +71 -0
- package/dist/react/core/internals-utils.d.ts.map +1 -0
- package/dist/react/core/job-utils.d.ts +45 -0
- package/dist/react/core/job-utils.d.ts.map +1 -0
- package/dist/react/core/log-utils.d.ts +34 -0
- package/dist/react/core/log-utils.d.ts.map +1 -0
- package/dist/react/core/metrics.d.ts +41 -0
- package/dist/react/core/metrics.d.ts.map +1 -0
- package/dist/react/core/pagination.d.ts +128 -0
- package/dist/react/core/pagination.d.ts.map +1 -0
- package/dist/react/core/query-utils.d.ts +35 -0
- package/dist/react/core/query-utils.d.ts.map +1 -0
- package/dist/react/core/resizable-columns.d.ts +18 -0
- package/dist/react/core/resizable-columns.d.ts.map +1 -0
- package/dist/react/core/routes.d.ts +12 -0
- package/dist/react/core/routes.d.ts.map +1 -0
- package/dist/react/core/server-stats-controller.d.ts +106 -0
- package/dist/react/core/server-stats-controller.d.ts.map +1 -0
- package/dist/react/core/sparkline.d.ts +80 -0
- package/dist/react/core/sparkline.d.ts.map +1 -0
- package/dist/react/core/theme.d.ts +42 -0
- package/dist/react/core/theme.d.ts.map +1 -0
- package/dist/react/core/trace-utils.d.ts +62 -0
- package/dist/react/core/trace-utils.d.ts.map +1 -0
- package/dist/react/core/transmit-adapter.d.ts +59 -0
- package/dist/react/core/transmit-adapter.d.ts.map +1 -0
- package/dist/react/core/types.d.ts +619 -0
- package/dist/react/core/types.d.ts.map +1 -0
- package/dist/react/index-UdTfSvtO.js +1074 -0
- package/dist/react/index.js +18 -0
- package/dist/react/react/components/Dashboard/DashboardPage.d.ts +17 -0
- package/dist/react/react/components/Dashboard/DashboardPage.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/CacheSection.d.ts +7 -0
- package/dist/react/react/components/Dashboard/sections/CacheSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/ConfigSection.d.ts +7 -0
- package/dist/react/react/components/Dashboard/sections/ConfigSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/EmailsSection.d.ts +7 -0
- package/dist/react/react/components/Dashboard/sections/EmailsSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/EventsSection.d.ts +7 -0
- package/dist/react/react/components/Dashboard/sections/EventsSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/InternalsSection.d.ts +14 -0
- package/dist/react/react/components/Dashboard/sections/InternalsSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/JobsSection.d.ts +7 -0
- package/dist/react/react/components/Dashboard/sections/JobsSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/LogsSection.d.ts +7 -0
- package/dist/react/react/components/Dashboard/sections/LogsSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/OverviewSection.d.ts +7 -0
- package/dist/react/react/components/Dashboard/sections/OverviewSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/QueriesSection.d.ts +7 -0
- package/dist/react/react/components/Dashboard/sections/QueriesSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/RequestsSection.d.ts +7 -0
- package/dist/react/react/components/Dashboard/sections/RequestsSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/RoutesSection.d.ts +7 -0
- package/dist/react/react/components/Dashboard/sections/RoutesSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/sections/TimelineSection.d.ts +9 -0
- package/dist/react/react/components/Dashboard/sections/TimelineSection.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/shared/DataTable.d.ts +27 -0
- package/dist/react/react/components/Dashboard/shared/DataTable.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/shared/FilterBar.d.ts +17 -0
- package/dist/react/react/components/Dashboard/shared/FilterBar.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/shared/Pagination.d.ts +13 -0
- package/dist/react/react/components/Dashboard/shared/Pagination.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/shared/TimeRangeSelector.d.ts +12 -0
- package/dist/react/react/components/Dashboard/shared/TimeRangeSelector.d.ts.map +1 -0
- package/dist/react/react/components/Dashboard/shared/WaterfallChart.d.ts +16 -0
- package/dist/react/react/components/Dashboard/shared/WaterfallChart.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/DebugPanel.d.ts +16 -0
- package/dist/react/react/components/DebugPanel/DebugPanel.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/CacheTab.d.ts +8 -0
- package/dist/react/react/components/DebugPanel/tabs/CacheTab.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/ConfigTab.d.ts +8 -0
- package/dist/react/react/components/DebugPanel/tabs/ConfigTab.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/CustomPaneTab.d.ts +14 -0
- package/dist/react/react/components/DebugPanel/tabs/CustomPaneTab.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/EmailsTab.d.ts +7 -0
- package/dist/react/react/components/DebugPanel/tabs/EmailsTab.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/EventsTab.d.ts +7 -0
- package/dist/react/react/components/DebugPanel/tabs/EventsTab.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/InternalsTab.d.ts +12 -0
- package/dist/react/react/components/DebugPanel/tabs/InternalsTab.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/JobsTab.d.ts +9 -0
- package/dist/react/react/components/DebugPanel/tabs/JobsTab.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/LogsTab.d.ts +7 -0
- package/dist/react/react/components/DebugPanel/tabs/LogsTab.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/QueriesTab.d.ts +7 -0
- package/dist/react/react/components/DebugPanel/tabs/QueriesTab.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/RoutesTab.d.ts +8 -0
- package/dist/react/react/components/DebugPanel/tabs/RoutesTab.d.ts.map +1 -0
- package/dist/react/react/components/DebugPanel/tabs/TimelineTab.d.ts +7 -0
- package/dist/react/react/components/DebugPanel/tabs/TimelineTab.d.ts.map +1 -0
- package/dist/react/react/components/StatsBar/MetricCard.d.ts +21 -0
- package/dist/react/react/components/StatsBar/MetricCard.d.ts.map +1 -0
- package/dist/react/react/components/StatsBar/Sparkline.d.ts +15 -0
- package/dist/react/react/components/StatsBar/Sparkline.d.ts.map +1 -0
- package/dist/react/react/components/StatsBar/StatsBar.d.ts +22 -0
- package/dist/react/react/components/StatsBar/StatsBar.d.ts.map +1 -0
- package/dist/react/react/components/shared/Badge.d.ts +32 -0
- package/dist/react/react/components/shared/Badge.d.ts.map +1 -0
- package/dist/react/react/components/shared/ConfigContent.d.ts +13 -0
- package/dist/react/react/components/shared/ConfigContent.d.ts.map +1 -0
- package/dist/react/react/components/shared/InternalsContent.d.ts +10 -0
- package/dist/react/react/components/shared/InternalsContent.d.ts.map +1 -0
- package/dist/react/react/components/shared/JsonViewer.d.ts +12 -0
- package/dist/react/react/components/shared/JsonViewer.d.ts.map +1 -0
- package/dist/react/react/components/shared/ThemeToggle.d.ts +13 -0
- package/dist/react/react/components/shared/ThemeToggle.d.ts.map +1 -0
- package/dist/react/react/components/shared/Tooltip.d.ts +16 -0
- package/dist/react/react/components/shared/Tooltip.d.ts.map +1 -0
- package/dist/react/react/hooks/useApiClient.d.ts +10 -0
- package/dist/react/react/hooks/useApiClient.d.ts.map +1 -0
- package/dist/react/react/hooks/useDashboardApiBase.d.ts +19 -0
- package/dist/react/react/hooks/useDashboardApiBase.d.ts.map +1 -0
- package/dist/react/react/hooks/useDashboardData.d.ts +27 -0
- package/dist/react/react/hooks/useDashboardData.d.ts.map +1 -0
- package/dist/react/react/hooks/useDebugData.d.ts +17 -0
- package/dist/react/react/hooks/useDebugData.d.ts.map +1 -0
- package/dist/react/react/hooks/useFeatures.d.ts +13 -0
- package/dist/react/react/hooks/useFeatures.d.ts.map +1 -0
- package/dist/react/react/hooks/useResizableTable.d.ts +13 -0
- package/dist/react/react/hooks/useResizableTable.d.ts.map +1 -0
- package/dist/react/react/hooks/useServerStats.d.ts +21 -0
- package/dist/react/react/hooks/useServerStats.d.ts.map +1 -0
- package/dist/react/react/hooks/useTheme.d.ts +12 -0
- package/dist/react/react/hooks/useTheme.d.ts.map +1 -0
- package/dist/react/react/index.d.ts +14 -0
- package/dist/react/react/index.d.ts.map +1 -0
- package/dist/react/style.css +1 -0
- package/dist/react/useApiClient-BVtNCmnL.js +9 -0
- package/dist/react/useDashboardApiBase-Bi36pJ2L.js +14 -0
- package/dist/react/useResizableTable-CNJmACdt.js +13 -0
- package/dist/src/collectors/app_collector.d.ts.map +1 -1
- package/dist/src/collectors/app_collector.js +28 -1
- package/dist/src/collectors/auto_detect.d.ts +31 -0
- package/dist/src/collectors/auto_detect.d.ts.map +1 -0
- package/dist/src/collectors/auto_detect.js +116 -0
- package/dist/src/collectors/collector.d.ts +17 -0
- package/dist/src/collectors/collector.d.ts.map +1 -1
- package/dist/src/collectors/db_pool_collector.d.ts.map +1 -1
- package/dist/src/collectors/db_pool_collector.js +33 -0
- package/dist/src/collectors/http_collector.d.ts.map +1 -1
- package/dist/src/collectors/http_collector.js +25 -6
- package/dist/src/collectors/index.d.ts +2 -0
- package/dist/src/collectors/index.d.ts.map +1 -1
- package/dist/src/collectors/index.js +1 -0
- package/dist/src/collectors/log_collector.d.ts +11 -4
- package/dist/src/collectors/log_collector.d.ts.map +1 -1
- package/dist/src/collectors/log_collector.js +51 -5
- package/dist/src/collectors/process_collector.d.ts.map +1 -1
- package/dist/src/collectors/process_collector.js +4 -0
- package/dist/src/collectors/queue_collector.d.ts.map +1 -1
- package/dist/src/collectors/queue_collector.js +55 -1
- package/dist/src/collectors/redis_collector.d.ts.map +1 -1
- package/dist/src/collectors/redis_collector.js +41 -3
- package/dist/src/collectors/system_collector.d.ts.map +1 -1
- package/dist/src/collectors/system_collector.js +4 -0
- package/dist/src/controller/api_controller.d.ts +101 -0
- package/dist/src/controller/api_controller.d.ts.map +1 -0
- package/dist/src/controller/api_controller.js +131 -0
- package/dist/src/controller/debug_controller.d.ts +14 -10
- package/dist/src/controller/debug_controller.d.ts.map +1 -1
- package/dist/src/controller/debug_controller.js +96 -102
- package/dist/src/core/theme.d.ts +42 -0
- package/dist/src/core/theme.d.ts.map +1 -0
- package/dist/src/core/theme.js +115 -0
- package/dist/src/dashboard/chart_aggregator.d.ts.map +1 -1
- package/dist/src/dashboard/dashboard_controller.d.ts +10 -14
- package/dist/src/dashboard/dashboard_controller.d.ts.map +1 -1
- package/dist/src/dashboard/dashboard_controller.js +132 -250
- package/dist/src/dashboard/dashboard_store.d.ts +62 -19
- package/dist/src/dashboard/dashboard_store.d.ts.map +1 -1
- package/dist/src/dashboard/dashboard_store.js +196 -43
- package/dist/src/dashboard/integrations/cache_inspector.d.ts +19 -1
- package/dist/src/dashboard/integrations/cache_inspector.d.ts.map +1 -1
- package/dist/src/dashboard/integrations/config_inspector.d.ts +1 -1
- package/dist/src/dashboard/integrations/config_inspector.d.ts.map +1 -1
- package/dist/src/dashboard/integrations/config_inspector.js +3 -2
- package/dist/src/dashboard/integrations/queue_inspector.d.ts +55 -10
- package/dist/src/dashboard/integrations/queue_inspector.d.ts.map +1 -1
- package/dist/src/dashboard/integrations/queue_inspector.js +70 -24
- package/dist/src/dashboard/models/stats_event.d.ts +1 -1
- package/dist/src/dashboard/models/stats_event.d.ts.map +1 -1
- package/dist/src/dashboard/models/stats_log.d.ts +1 -1
- package/dist/src/dashboard/models/stats_log.d.ts.map +1 -1
- package/dist/src/dashboard/models/stats_query.d.ts +1 -1
- package/dist/src/dashboard/models/stats_query.d.ts.map +1 -1
- package/dist/src/dashboard/models/stats_saved_filter.d.ts +1 -1
- package/dist/src/dashboard/models/stats_saved_filter.d.ts.map +1 -1
- package/dist/src/dashboard/models/stats_trace.d.ts +2 -1
- package/dist/src/dashboard/models/stats_trace.d.ts.map +1 -1
- package/dist/src/data/data_access.d.ts +103 -0
- package/dist/src/data/data_access.d.ts.map +1 -0
- package/dist/src/data/data_access.js +305 -0
- package/dist/src/data/index.d.ts +3 -0
- package/dist/src/data/index.d.ts.map +1 -0
- package/dist/src/data/index.js +1 -0
- package/dist/src/debug/debug_store.d.ts +20 -1
- package/dist/src/debug/debug_store.d.ts.map +1 -1
- package/dist/src/debug/debug_store.js +43 -15
- package/dist/src/debug/email_collector.d.ts +6 -2
- package/dist/src/debug/email_collector.d.ts.map +1 -1
- package/dist/src/debug/email_collector.js +3 -0
- package/dist/src/debug/event_collector.d.ts +6 -2
- package/dist/src/debug/event_collector.d.ts.map +1 -1
- package/dist/src/debug/event_collector.js +12 -8
- package/dist/src/debug/query_collector.d.ts +6 -2
- package/dist/src/debug/query_collector.d.ts.map +1 -1
- package/dist/src/debug/query_collector.js +3 -0
- package/dist/src/debug/ring_buffer.d.ts +1 -0
- package/dist/src/debug/ring_buffer.d.ts.map +1 -1
- package/dist/src/debug/ring_buffer.js +5 -2
- package/dist/src/debug/route_inspector.d.ts +2 -2
- package/dist/src/debug/route_inspector.d.ts.map +1 -1
- package/dist/src/debug/route_inspector.js +4 -3
- package/dist/src/debug/trace_collector.d.ts +7 -3
- package/dist/src/debug/trace_collector.d.ts.map +1 -1
- package/dist/src/debug/trace_collector.js +7 -5
- package/dist/src/debug/types.d.ts +107 -2
- package/dist/src/debug/types.d.ts.map +1 -1
- package/dist/src/debug/types.js +1 -1
- package/dist/src/define_config.d.ts +49 -5
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js +360 -4
- package/dist/src/edge/bootstrap.d.ts +17 -0
- package/dist/src/edge/bootstrap.d.ts.map +1 -0
- package/dist/src/edge/bootstrap.js +29 -0
- package/dist/src/edge/client/dashboard.js +2 -3619
- package/dist/src/edge/client/debug-panel-deferred.js +1 -0
- package/dist/src/edge/client/debug-panel.js +1 -2140
- package/dist/src/edge/client/stats-bar.js +1 -801
- package/dist/src/edge/client-vue/dashboard.js +5 -0
- package/dist/src/edge/client-vue/debug-panel-deferred.js +4 -0
- package/dist/src/edge/client-vue/debug-panel.js +4 -0
- package/dist/src/edge/client-vue/stats-bar.js +4 -0
- package/dist/src/edge/plugin.d.ts +35 -2
- package/dist/src/edge/plugin.d.ts.map +1 -1
- package/dist/src/edge/plugin.js +30 -66
- package/dist/src/edge/types.d.ts +46 -0
- package/dist/src/edge/types.d.ts.map +1 -0
- package/dist/src/edge/types.js +4 -0
- package/dist/src/edge/views/dashboard.edge +1 -358
- package/dist/src/edge/views/debug-panel.edge +2 -154
- package/dist/src/edge/views/stats-bar.edge +15 -48
- package/dist/src/engine/stats_engine.d.ts +18 -0
- package/dist/src/engine/stats_engine.d.ts.map +1 -1
- package/dist/src/engine/stats_engine.js +45 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/log_stream/log_stream_provider.d.ts.map +1 -1
- package/dist/src/log_stream/log_stream_provider.js +21 -4
- package/dist/src/log_stream/log_stream_service.d.ts +8 -1
- package/dist/src/log_stream/log_stream_service.d.ts.map +1 -1
- package/dist/src/log_stream/log_stream_service.js +27 -3
- package/dist/src/middleware/request_tracking_middleware.d.ts +1 -1
- package/dist/src/middleware/request_tracking_middleware.d.ts.map +1 -1
- package/dist/src/middleware/request_tracking_middleware.js +14 -6
- package/dist/src/prometheus/prometheus_collector.d.ts +2 -1
- package/dist/src/prometheus/prometheus_collector.d.ts.map +1 -1
- package/dist/src/provider/server_stats_provider.d.ts +91 -0
- package/dist/src/provider/server_stats_provider.d.ts.map +1 -1
- package/dist/src/provider/server_stats_provider.js +282 -63
- package/dist/src/routes/access_middleware.d.ts +2 -1
- package/dist/src/routes/access_middleware.d.ts.map +1 -1
- package/dist/src/routes/access_middleware.js +7 -1
- package/dist/src/routes/index.d.ts +4 -0
- package/dist/src/routes/index.d.ts.map +1 -0
- package/dist/src/routes/index.js +1 -0
- package/dist/src/routes/register_routes.d.ts +103 -0
- package/dist/src/routes/register_routes.d.ts.map +1 -0
- package/dist/src/routes/register_routes.js +356 -0
- package/dist/src/routes/router_types.d.ts +29 -0
- package/dist/src/routes/router_types.d.ts.map +1 -0
- package/dist/src/routes/router_types.js +1 -0
- package/dist/src/stubs/config.stub +12 -32
- package/dist/src/styles/components.css +1048 -0
- package/dist/src/{edge/client → styles}/dashboard.css +299 -736
- package/dist/src/{edge/client → styles}/debug-panel.css +117 -633
- package/dist/src/{edge/client → styles}/stats-bar.css +28 -10
- package/dist/src/styles/tokens.css +153 -0
- package/dist/src/styles/utilities.css +75 -0
- package/dist/src/types.d.ts +119 -16
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/json_helpers.d.ts +2 -2
- package/dist/src/utils/json_helpers.d.ts.map +1 -1
- package/dist/src/utils/logger.d.ts +17 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +27 -0
- package/dist/src/utils/mail_helpers.d.ts +1 -1
- package/dist/src/utils/mail_helpers.d.ts.map +1 -1
- package/dist/src/utils/mail_helpers.js +1 -1
- package/dist/vue/CacheSection-CkrIB4-j.js +149 -0
- package/dist/vue/CacheTab-BPisYYiQ.js +104 -0
- package/dist/vue/ConfigSection-gulpOiq1.js +576 -0
- package/dist/vue/ConfigTab-C8cafGUj.js +361 -0
- package/dist/vue/CustomPaneTab-J57ED_bh.js +172 -0
- package/dist/vue/EmailsSection-BlKvQDx8.js +206 -0
- package/dist/vue/EmailsTab-DhFhoNmU.js +157 -0
- package/dist/vue/EventsSection-BdzQvIVJ.js +107 -0
- package/dist/vue/EventsTab-DQ4Nd6AK.js +97 -0
- package/dist/vue/FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js +62 -0
- package/dist/vue/InternalsSection-BJUXE-5F.js +468 -0
- package/dist/vue/InternalsTab-DEMjqtlw.js +471 -0
- package/dist/vue/JobsSection-DOzuMrG3.js +187 -0
- package/dist/vue/JobsTab-BCvhOARO.js +117 -0
- package/dist/vue/JsonViewer.vue_vue_type_script_setup_true_lang-Vsqar1zx.js +67 -0
- package/dist/vue/LogsSection-CNN4y92u.js +227 -0
- package/dist/vue/LogsTab-CJerb22r.js +122 -0
- package/dist/vue/OverviewSection-SITNR_dA.js +849 -0
- package/dist/vue/PaginationControls.vue_vue_type_script_setup_true_lang-CuN7g_8Z.js +50 -0
- package/dist/vue/QueriesSection-BAebAHkD.js +429 -0
- package/dist/vue/QueriesTab-C8_7oprC.js +107 -0
- package/dist/vue/RequestsSection-CIR0IX39.js +243 -0
- package/dist/vue/RoutesSection-j1U2oa0g.js +106 -0
- package/dist/vue/RoutesTab-Dz0MkZuF.js +80 -0
- package/dist/vue/TimelineSection-Dw980UPg.js +186 -0
- package/dist/vue/TimelineTab-Db6lKKsD.js +250 -0
- package/dist/vue/WaterfallChart.vue_vue_type_script_setup_true_lang-tZ13cNj1.js +118 -0
- package/dist/vue/components/Dashboard/DashboardPage.vue.d.ts +18 -0
- package/dist/vue/components/Dashboard/DashboardPage.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/CacheSection.vue.d.ts +5 -0
- package/dist/vue/components/Dashboard/sections/CacheSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/ConfigSection.vue.d.ts +3 -0
- package/dist/vue/components/Dashboard/sections/ConfigSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/EmailsSection.vue.d.ts +5 -0
- package/dist/vue/components/Dashboard/sections/EmailsSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/EventsSection.vue.d.ts +5 -0
- package/dist/vue/components/Dashboard/sections/EventsSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/InternalsSection.vue.d.ts +3 -0
- package/dist/vue/components/Dashboard/sections/InternalsSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/JobsSection.vue.d.ts +5 -0
- package/dist/vue/components/Dashboard/sections/JobsSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/LogsSection.vue.d.ts +3 -0
- package/dist/vue/components/Dashboard/sections/LogsSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/OverviewSection.vue.d.ts +5 -0
- package/dist/vue/components/Dashboard/sections/OverviewSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/QueriesSection.vue.d.ts +45 -0
- package/dist/vue/components/Dashboard/sections/QueriesSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/RequestsSection.vue.d.ts +5 -0
- package/dist/vue/components/Dashboard/sections/RequestsSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/RoutesSection.vue.d.ts +5 -0
- package/dist/vue/components/Dashboard/sections/RoutesSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/sections/TimelineSection.vue.d.ts +11 -0
- package/dist/vue/components/Dashboard/sections/TimelineSection.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/shared/FilterBar.vue.d.ts +29 -0
- package/dist/vue/components/Dashboard/shared/FilterBar.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/shared/PaginationControls.vue.d.ts +12 -0
- package/dist/vue/components/Dashboard/shared/PaginationControls.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/shared/TimeRangeSelector.vue.d.ts +11 -0
- package/dist/vue/components/Dashboard/shared/TimeRangeSelector.vue.d.ts.map +1 -0
- package/dist/vue/components/Dashboard/shared/WaterfallChart.vue.d.ts +10 -0
- package/dist/vue/components/Dashboard/shared/WaterfallChart.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/DebugPanel.vue.d.ts +21 -0
- package/dist/vue/components/DebugPanel/DebugPanel.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/CacheTab.vue.d.ts +12 -0
- package/dist/vue/components/DebugPanel/tabs/CacheTab.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/ConfigTab.vue.d.ts +11 -0
- package/dist/vue/components/DebugPanel/tabs/ConfigTab.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/CustomPaneTab.vue.d.ts +11 -0
- package/dist/vue/components/DebugPanel/tabs/CustomPaneTab.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/EmailsTab.vue.d.ts +12 -0
- package/dist/vue/components/DebugPanel/tabs/EmailsTab.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/EventsTab.vue.d.ts +12 -0
- package/dist/vue/components/DebugPanel/tabs/EventsTab.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/InternalsTab.vue.d.ts +11 -0
- package/dist/vue/components/DebugPanel/tabs/InternalsTab.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/JobsTab.vue.d.ts +13 -0
- package/dist/vue/components/DebugPanel/tabs/JobsTab.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/LogsTab.vue.d.ts +15 -0
- package/dist/vue/components/DebugPanel/tabs/LogsTab.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/QueriesTab.vue.d.ts +12 -0
- package/dist/vue/components/DebugPanel/tabs/QueriesTab.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/RoutesTab.vue.d.ts +12 -0
- package/dist/vue/components/DebugPanel/tabs/RoutesTab.vue.d.ts.map +1 -0
- package/dist/vue/components/DebugPanel/tabs/TimelineTab.vue.d.ts +15 -0
- package/dist/vue/components/DebugPanel/tabs/TimelineTab.vue.d.ts.map +1 -0
- package/dist/vue/components/StatsBar/MetricCard.vue.d.ts +19 -0
- package/dist/vue/components/StatsBar/MetricCard.vue.d.ts.map +1 -0
- package/dist/vue/components/StatsBar/Sparkline.vue.d.ts +17 -0
- package/dist/vue/components/StatsBar/Sparkline.vue.d.ts.map +1 -0
- package/dist/vue/components/StatsBar/StatsBar.vue.d.ts +22 -0
- package/dist/vue/components/StatsBar/StatsBar.vue.d.ts.map +1 -0
- package/dist/vue/components/shared/JsonViewer.vue.d.ts +13 -0
- package/dist/vue/components/shared/JsonViewer.vue.d.ts.map +1 -0
- package/dist/vue/components/shared/ThemeToggle.vue.d.ts +8 -0
- package/dist/vue/components/shared/ThemeToggle.vue.d.ts.map +1 -0
- package/dist/vue/composables/useApiClient.d.ts +9 -0
- package/dist/vue/composables/useApiClient.d.ts.map +1 -0
- package/dist/vue/composables/useDashboardData.d.ts +53 -0
- package/dist/vue/composables/useDashboardData.d.ts.map +1 -0
- package/dist/vue/composables/useDebugData.d.ts +25 -0
- package/dist/vue/composables/useDebugData.d.ts.map +1 -0
- package/dist/vue/composables/useFeatures.d.ts +80 -0
- package/dist/vue/composables/useFeatures.d.ts.map +1 -0
- package/dist/vue/composables/useResizableTable.d.ts +16 -0
- package/dist/vue/composables/useResizableTable.d.ts.map +1 -0
- package/dist/vue/composables/useServerStats.d.ts +104 -0
- package/dist/vue/composables/useServerStats.d.ts.map +1 -0
- package/dist/vue/composables/useTheme.d.ts +6 -0
- package/dist/vue/composables/useTheme.d.ts.map +1 -0
- package/dist/vue/index-COgsk_nv.js +1233 -0
- package/dist/vue/index.d.ts +10 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue/index.js +11 -0
- package/dist/vue/style.css +1 -0
- package/dist/vue/useApiClient-BQQ9CF-q.js +10 -0
- package/dist/vue/useResizableTable-BoivAevK.js +17 -0
- package/package.json +68 -10
- package/dist/src/dashboard/dashboard_routes.d.ts +0 -16
- package/dist/src/dashboard/dashboard_routes.d.ts.map +0 -1
- package/dist/src/dashboard/dashboard_routes.js +0 -77
- package/dist/src/routes/debug_routes.d.ts +0 -14
- package/dist/src/routes/debug_routes.d.ts.map +0 -1
- package/dist/src/routes/debug_routes.js +0 -42
- package/dist/src/routes/stats_routes.d.ts +0 -14
- package/dist/src/routes/stats_routes.d.ts.map +0 -1
- package/dist/src/routes/stats_routes.js +0 -27
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import {
|
|
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 {
|
|
9
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
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
|
-
|
|
76
|
-
authMiddleware.map((m) =>
|
|
77
|
-
'
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
'
|
|
81
|
-
|
|
82
|
-
'
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
'
|
|
86
|
-
|
|
87
|
-
'
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
'
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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,
|
|
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
|
-
|
|
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.
|
|
455
|
+
this.dashboardController = new DashboardControllerClass(this.dashboardStore, this.app);
|
|
347
456
|
// ── Log piping ────────────────────────────────────────────────
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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":"
|
|
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 @@
|
|
|
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';
|