From 33ee84633feff7ba3918f7d1ccd1d3af62b66215 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:45:10 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9terminal=20metrics?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E5=8A=A0=E5=85=A5terminal=20name=20(#1122?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/terminal/utils/components.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/terminal/utils/components.py b/apps/terminal/utils/components.py index 100391dbd..2c3786dbf 100644 --- a/apps/terminal/utils/components.py +++ b/apps/terminal/utils/components.py @@ -68,11 +68,16 @@ class TypedComponentsStatusMetricsUtil(object): metrics = [] for _tp, components in self.grouped_components: metric = { - 'normal': 0, 'high': 0, 'critical': 0, 'offline': 0, - 'total': 0, 'session_active': 0, 'type': _tp + 'total': 0, + 'type': _tp, + 'session_active': 0, + ComponentLoad.high: [], + ComponentLoad.normal: [], + ComponentLoad.offline: [], + ComponentLoad.critical: [], } for component in components: - metric[component.load] += 1 + metric[component.load].append(component.name) metric['total'] += 1 metric['session_active'] += component.get_online_session_count() metrics.append(metric)