From d6fafef902e70a7270986f1e3095a8fa33ce877a Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Tue, 21 Sep 2021 14:19:01 -0400 Subject: [PATCH] proc_stats: report websocket connection count Signed-off-by: Eric Callahan --- moonraker/components/proc_stats.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/moonraker/components/proc_stats.py b/moonraker/components/proc_stats.py index 785a85b..0f12966 100644 --- a/moonraker/components/proc_stats.py +++ b/moonraker/components/proc_stats.py @@ -94,11 +94,13 @@ class ProcStats: ts = await self._check_throttled_state() cpu_temp = await self.event_loop.run_in_thread( self._get_cpu_temperature) + websocket_count = self.server.get_websocket_manager().get_count() return { 'moonraker_stats': list(self.proc_stat_queue), 'throttled_state': ts, 'cpu_temp': cpu_temp, - 'network': self.last_net_stats + 'network': self.last_net_stats, + 'websocket_connections': websocket_count } async def _handle_shutdown(self) -> None: @@ -137,10 +139,12 @@ class ProcStats: 'mem_units': mem_units } self.proc_stat_queue.append(result) + websocket_count = self.server.get_websocket_manager().get_count() self.server.send_event("proc_stats:proc_stat_update", { 'moonraker_stats': result, 'cpu_temp': cpu_temp, - 'network': net + 'network': net, + 'websocket_connections': websocket_count }) self.last_update_time = update_time self.last_proc_time = proc_time