Browse Source

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

Co-authored-by: feng <1304903146@qq.com>
pull/11243/head
fit2bot 1 year ago committed by GitHub
parent
commit
33ee84633f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      apps/terminal/utils/components.py

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

Loading…
Cancel
Save