adonisjs-server-stats 1.5.3 → 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 +98 -0
- package/dist/src/provider/server_stats_provider.d.ts.map +1 -1
- package/dist/src/provider/server_stats_provider.js +340 -50
- 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,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { getLogStreamService } from '../collectors/log_collector.js';
|
|
2
3
|
import { DashboardStore } from '../dashboard/dashboard_store.js';
|
|
4
|
+
import { DataAccess } from '../data/data_access.js';
|
|
3
5
|
import { DebugStore } from '../debug/debug_store.js';
|
|
4
6
|
import { StatsEngine } from '../engine/stats_engine.js';
|
|
5
7
|
import { LogStreamService } from '../log_stream/log_stream_service.js';
|
|
6
8
|
import { setShouldShow, setTraceCollector, setDashboardPath, setExcludedPrefixes, setOnRequestComplete, } from '../middleware/request_tracking_middleware.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
+
import { registerAllRoutes } from '../routes/register_routes.js';
|
|
10
|
+
import { log, dim, bold } from '../utils/logger.js';
|
|
9
11
|
export default class ServerStatsProvider {
|
|
10
12
|
app;
|
|
11
13
|
intervalId = null;
|
|
@@ -20,6 +22,15 @@ export default class ServerStatsProvider {
|
|
|
20
22
|
flushTimer = null;
|
|
21
23
|
statsController = null;
|
|
22
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 = [];
|
|
23
34
|
constructor(app) {
|
|
24
35
|
this.app = app;
|
|
25
36
|
}
|
|
@@ -40,37 +51,68 @@ export default class ServerStatsProvider {
|
|
|
40
51
|
}
|
|
41
52
|
if (router && !this.app.inProduction) {
|
|
42
53
|
const registeredPaths = [];
|
|
43
|
-
|
|
44
|
-
if (typeof config.endpoint === 'string') {
|
|
45
|
-
registerStatsRoutes(router, config.endpoint, () => this.statsController, config.shouldShow);
|
|
46
|
-
registeredPaths.push(config.endpoint);
|
|
47
|
-
}
|
|
48
|
-
// ── Auto-register debug toolbar routes ─────────────────────
|
|
54
|
+
const r = router;
|
|
49
55
|
const toolbarConfig = config.devToolbar;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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) {
|
|
53
81
|
registeredPaths.push(debugEndpoint + '/*');
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
registerDashboardRoutes(router, dashPath, () => this.dashboardController, config.shouldShow);
|
|
58
|
-
registeredPaths.push(dashPath + '/*');
|
|
59
|
-
}
|
|
82
|
+
}
|
|
83
|
+
if (dashboardPath) {
|
|
84
|
+
registeredPaths.push(dashboardPath + '/*');
|
|
60
85
|
}
|
|
61
86
|
// Log registered routes
|
|
62
87
|
if (registeredPaths.length > 0) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
88
|
+
log.list('routes registered:', registeredPaths);
|
|
89
|
+
// Only warn about global auth middleware if:
|
|
90
|
+
// 1. shouldShow is NOT configured (user hasn't set up access control)
|
|
91
|
+
// 2. There IS auth middleware in server.use() or router.use()
|
|
92
|
+
if (!config.shouldShow) {
|
|
93
|
+
const authMiddleware = this.detectGlobalAuthMiddleware();
|
|
94
|
+
if (authMiddleware.length > 0) {
|
|
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
|
+
]);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
74
116
|
}
|
|
75
117
|
}
|
|
76
118
|
if (!this.app.usingEdgeJS)
|
|
@@ -79,10 +121,106 @@ export default class ServerStatsProvider {
|
|
|
79
121
|
const edge = await import('edge.js');
|
|
80
122
|
const { edgePluginServerStats } = await import('../edge/plugin.js');
|
|
81
123
|
edge.default.use(edgePluginServerStats(config));
|
|
124
|
+
this.edgePluginActive = true;
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
log.warn('could not register Edge plugin — @serverStats() tag will not work: ' +
|
|
128
|
+
err?.message);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Read start/kernel.ts and detect auth-related middleware in server.use()
|
|
133
|
+
* or router.use() blocks. Returns import paths of problematic middleware.
|
|
134
|
+
*
|
|
135
|
+
* Ignores initialize_auth_middleware (no DB query — just sets up ctx.auth).
|
|
136
|
+
*/
|
|
137
|
+
detectGlobalAuthMiddleware() {
|
|
138
|
+
const found = [];
|
|
139
|
+
try {
|
|
140
|
+
// Try both .ts and .js extensions
|
|
141
|
+
let source = '';
|
|
142
|
+
for (const ext of ['ts', 'js']) {
|
|
143
|
+
try {
|
|
144
|
+
source = readFileSync(this.app.makePath('start', `kernel.${ext}`), 'utf-8');
|
|
145
|
+
if (source)
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// Try next extension
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (!source)
|
|
153
|
+
return found;
|
|
154
|
+
// Extract server.use([...]) and router.use([...]) blocks
|
|
155
|
+
const useBlockRegex = /(?:server|router)\.use\(\s*\[([\s\S]*?)\]\s*\)/g;
|
|
156
|
+
let match;
|
|
157
|
+
while ((match = useBlockRegex.exec(source)) !== null) {
|
|
158
|
+
const block = match[1];
|
|
159
|
+
// Find all import paths in this block
|
|
160
|
+
const importRegex = /import\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
161
|
+
let importMatch;
|
|
162
|
+
while ((importMatch = importRegex.exec(block)) !== null) {
|
|
163
|
+
const importPath = importMatch[1];
|
|
164
|
+
// Skip initialize_auth_middleware — it just sets up ctx.auth, no DB query
|
|
165
|
+
if (importPath.includes('initialize_auth'))
|
|
166
|
+
continue;
|
|
167
|
+
// Detect auth-related middleware
|
|
168
|
+
if (importPath.includes('auth') ||
|
|
169
|
+
importPath.includes('silent_auth') ||
|
|
170
|
+
importPath.includes('silentAuth')) {
|
|
171
|
+
found.push(importPath);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
82
175
|
}
|
|
83
176
|
catch {
|
|
84
|
-
//
|
|
177
|
+
// Can't read kernel file — skip detection
|
|
85
178
|
}
|
|
179
|
+
return found;
|
|
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)');
|
|
86
224
|
}
|
|
87
225
|
async ready() {
|
|
88
226
|
const config = this.app.config.get('server_stats');
|
|
@@ -90,9 +228,23 @@ export default class ServerStatsProvider {
|
|
|
90
228
|
return;
|
|
91
229
|
if (this.app.inTest && config.skipInTest !== false)
|
|
92
230
|
return;
|
|
93
|
-
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);
|
|
94
244
|
this.app.container.singleton('server_stats.engine', () => this.engine);
|
|
95
245
|
await this.engine.start();
|
|
246
|
+
// Auto-hook log collector into the AdonisJS Pino logger (zero-config)
|
|
247
|
+
await this.hookPinoLogger();
|
|
96
248
|
// Create the stats controller (makes the stats route functional)
|
|
97
249
|
const StatsControllerClass = (await import('../controller/server_stats_controller.js')).default;
|
|
98
250
|
this.statsController = new StatsControllerClass(this.engine);
|
|
@@ -125,14 +277,27 @@ export default class ServerStatsProvider {
|
|
|
125
277
|
if (prefixes.length > 0) {
|
|
126
278
|
setExcludedPrefixes(prefixes);
|
|
127
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
|
+
}
|
|
128
287
|
}
|
|
129
288
|
let transmit = null;
|
|
130
289
|
if (config.transport === 'transmit') {
|
|
131
290
|
try {
|
|
132
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
|
+
}
|
|
133
298
|
}
|
|
134
299
|
catch {
|
|
135
|
-
|
|
300
|
+
log.info('transport is "transmit" but @adonisjs/transmit is not installed — falling back to polling');
|
|
136
301
|
}
|
|
137
302
|
}
|
|
138
303
|
let prometheusCollector = null;
|
|
@@ -141,15 +306,21 @@ export default class ServerStatsProvider {
|
|
|
141
306
|
prometheusCollector = mod.ServerStatsCollector.instance;
|
|
142
307
|
}
|
|
143
308
|
catch {
|
|
144
|
-
// 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');
|
|
145
314
|
}
|
|
146
315
|
this.intervalId = setInterval(async () => {
|
|
147
316
|
try {
|
|
148
317
|
const stats = await this.engine.collect();
|
|
149
318
|
if (transmit && config.channelName) {
|
|
319
|
+
;
|
|
150
320
|
transmit.broadcast(config.channelName, JSON.parse(JSON.stringify(stats)));
|
|
151
321
|
}
|
|
152
322
|
if (prometheusCollector) {
|
|
323
|
+
;
|
|
153
324
|
prometheusCollector.update(stats);
|
|
154
325
|
}
|
|
155
326
|
config.onStats?.(stats);
|
|
@@ -176,7 +347,7 @@ export default class ServerStatsProvider {
|
|
|
176
347
|
emitter = await this.app.container.make('emitter');
|
|
177
348
|
}
|
|
178
349
|
catch {
|
|
179
|
-
|
|
350
|
+
log.warn('AdonisJS emitter not available — query and event collection will be disabled');
|
|
180
351
|
}
|
|
181
352
|
// Get the router
|
|
182
353
|
let router = null;
|
|
@@ -188,9 +359,13 @@ export default class ServerStatsProvider {
|
|
|
188
359
|
}
|
|
189
360
|
await this.debugStore.start(emitter, router);
|
|
190
361
|
// Create the debug controller (makes the debug routes functional)
|
|
191
|
-
const
|
|
362
|
+
const serverConfig = this.app.config.get('server_stats');
|
|
192
363
|
const DebugControllerClass = (await import('../controller/debug_controller.js')).default;
|
|
193
|
-
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
|
+
});
|
|
194
369
|
// Wire trace collector into the request tracking middleware
|
|
195
370
|
if (this.debugStore.traces) {
|
|
196
371
|
setTraceCollector(this.debugStore.traces);
|
|
@@ -215,7 +390,11 @@ export default class ServerStatsProvider {
|
|
|
215
390
|
// Transmit not installed — debug panel will use polling
|
|
216
391
|
}
|
|
217
392
|
if (debugTransmit) {
|
|
393
|
+
this.transmitAvailable = true;
|
|
218
394
|
const debugChannel = 'server-stats/debug';
|
|
395
|
+
if (!this.transmitChannels.includes(debugChannel)) {
|
|
396
|
+
this.transmitChannels.push(debugChannel);
|
|
397
|
+
}
|
|
219
398
|
const pendingTypes = new Set();
|
|
220
399
|
this.debugStore.onNewItem((type) => {
|
|
221
400
|
// Debounce: coalesce rapid events into a single broadcast
|
|
@@ -227,6 +406,7 @@ export default class ServerStatsProvider {
|
|
|
227
406
|
const types = Array.from(pendingTypes);
|
|
228
407
|
pendingTypes.clear();
|
|
229
408
|
try {
|
|
409
|
+
;
|
|
230
410
|
debugTransmit.broadcast(debugChannel, { types });
|
|
231
411
|
}
|
|
232
412
|
catch {
|
|
@@ -257,9 +437,9 @@ export default class ServerStatsProvider {
|
|
|
257
437
|
catch (err) {
|
|
258
438
|
const msg = err?.message || '';
|
|
259
439
|
if (msg.includes('better-sqlite3') || msg.includes('Cannot find module')) {
|
|
260
|
-
|
|
440
|
+
log.warn('Dashboard requires better-sqlite3. Install it with:\n' +
|
|
261
441
|
' npm install better-sqlite3\n' +
|
|
262
|
-
'Dashboard has been disabled for this session.');
|
|
442
|
+
' Dashboard has been disabled for this session.');
|
|
263
443
|
this.dashboardStore = null;
|
|
264
444
|
return;
|
|
265
445
|
}
|
|
@@ -272,18 +452,33 @@ export default class ServerStatsProvider {
|
|
|
272
452
|
setDashboardPath(toolbarConfig.dashboardPath);
|
|
273
453
|
// Create the controller — this makes the routes registered in boot() functional
|
|
274
454
|
const DashboardControllerClass = (await import('../dashboard/dashboard_controller.js')).default;
|
|
275
|
-
this.dashboardController = new DashboardControllerClass(this.dashboardStore, this.
|
|
455
|
+
this.dashboardController = new DashboardControllerClass(this.dashboardStore, this.app);
|
|
276
456
|
// ── Log piping ────────────────────────────────────────────────
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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
|
+
}
|
|
282
476
|
// ── Per-request data piping ────────────────────────────────────
|
|
283
477
|
const debugStore = this.debugStore;
|
|
284
478
|
const dashStore = this.dashboardStore;
|
|
285
479
|
let lastQueryId = 0;
|
|
286
480
|
let lastEventId = 0;
|
|
481
|
+
let warnedPersistOnce = false;
|
|
287
482
|
setOnRequestComplete(({ method, url, statusCode, duration, trace }) => {
|
|
288
483
|
if (!dashStore.isReady())
|
|
289
484
|
return;
|
|
@@ -301,14 +496,24 @@ export default class ServerStatsProvider {
|
|
|
301
496
|
}
|
|
302
497
|
// Persist asynchronously (fire-and-forget)
|
|
303
498
|
dashStore
|
|
304
|
-
.persistRequest(
|
|
499
|
+
.persistRequest({
|
|
500
|
+
method,
|
|
501
|
+
url,
|
|
502
|
+
statusCode,
|
|
503
|
+
duration,
|
|
504
|
+
queries: newQueries,
|
|
505
|
+
trace: trace ?? null,
|
|
506
|
+
})
|
|
305
507
|
.then((requestId) => {
|
|
306
508
|
if (requestId !== null && newEvents.length > 0) {
|
|
307
509
|
return dashStore.recordEvents(requestId, newEvents);
|
|
308
510
|
}
|
|
309
511
|
})
|
|
310
|
-
.catch(() => {
|
|
311
|
-
|
|
512
|
+
.catch((err) => {
|
|
513
|
+
if (!warnedPersistOnce) {
|
|
514
|
+
warnedPersistOnce = true;
|
|
515
|
+
log.warn('failed to persist request data — ' + (err?.message || 'unknown error'));
|
|
516
|
+
}
|
|
312
517
|
});
|
|
313
518
|
});
|
|
314
519
|
// ── Transmit streaming for real-time dashboard updates ────────
|
|
@@ -320,13 +525,24 @@ export default class ServerStatsProvider {
|
|
|
320
525
|
// Transmit not installed — skip real-time updates
|
|
321
526
|
}
|
|
322
527
|
if (transmit) {
|
|
528
|
+
this.transmitAvailable = true;
|
|
323
529
|
const dashChannel = 'server-stats/dashboard';
|
|
530
|
+
if (!this.transmitChannels.includes(dashChannel)) {
|
|
531
|
+
this.transmitChannels.push(dashChannel);
|
|
532
|
+
}
|
|
324
533
|
this.dashboardBroadcastTimer = setInterval(async () => {
|
|
325
534
|
try {
|
|
326
535
|
if (!dashStore.isReady())
|
|
327
536
|
return;
|
|
328
537
|
const overview = await dashStore.getOverviewMetrics('1h');
|
|
329
|
-
|
|
538
|
+
const diagnostics = {
|
|
539
|
+
collectors: this.engine.getCollectorHealth(),
|
|
540
|
+
buffers: this.debugStore.getBufferStats(),
|
|
541
|
+
};
|
|
542
|
+
transmit.broadcast(dashChannel, {
|
|
543
|
+
...overview,
|
|
544
|
+
diagnostics,
|
|
545
|
+
});
|
|
330
546
|
}
|
|
331
547
|
catch {
|
|
332
548
|
// Silently ignore
|
|
@@ -334,6 +550,80 @@ export default class ServerStatsProvider {
|
|
|
334
550
|
}, 5_000);
|
|
335
551
|
}
|
|
336
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
|
+
}
|
|
337
627
|
async shutdown() {
|
|
338
628
|
if (this.intervalId) {
|
|
339
629
|
clearInterval(this.intervalId);
|
|
@@ -356,8 +646,8 @@ export default class ServerStatsProvider {
|
|
|
356
646
|
try {
|
|
357
647
|
await this.debugStore.saveToDisk(this.persistPath);
|
|
358
648
|
}
|
|
359
|
-
catch {
|
|
360
|
-
|
|
649
|
+
catch (err) {
|
|
650
|
+
log.warn('could not save debug data on shutdown — ' + err?.message);
|
|
361
651
|
}
|
|
362
652
|
}
|
|
363
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';
|