From 58b6293b76660584be71d24575817de1e954461a Mon Sep 17 00:00:00 2001 From: Bai Date: Tue, 15 Dec 2020 15:46:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=84=E4=BB=B6=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0offline=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/terminal/utils.py b/apps/terminal/utils.py index d85e21deb..b480503d5 100644 --- a/apps/terminal/utils.py +++ b/apps/terminal/utils.py @@ -116,7 +116,8 @@ class ComponentsMetricsUtil(object): def get_metrics(self, tp=None): components = self.get_components(tp) - total_count = normal_count = high_count = critical_count = session_active_total = 0 + total_count = normal_count = high_count = critical_count = offline_count = \ + session_active_total = 0 for component in components: total_count += 1 if component.is_alive: @@ -129,12 +130,13 @@ class ComponentsMetricsUtil(object): critical_count += 1 session_active_total += component.state.get('session_active_count', 0) else: - critical_count += 1 + offline_count += 1 return { 'total': total_count, 'normal': normal_count, 'high': high_count, 'critical': critical_count, + 'offline': offline_count, 'session_active': session_active_total } @@ -147,7 +149,8 @@ class ComponentsPrometheusMetricsUtil(ComponentsMetricsUtil): 'any': metrics['total'], 'normal': metrics['normal'], 'high': metrics['high'], - 'critical': metrics['critical'] + 'critical': metrics['critical'], + 'offline': metrics['offline'] } def get_prometheus_metrics_text(self):