perf: 修改terminal metrics接口 加入terminal name (#11228)

Co-authored-by: feng <1304903146@qq.com>
pull/11243/head
fit2bot 2023-08-08 18:45:10 +08:00 committed by GitHub
parent 419806aa57
commit 33ee84633f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -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)