Collectd top 10 k8s system process list incorrectly has k8s addon

This change corrects the process list so that only
processes from the kube_system are displayed.

The list was changed from this:
2023-01-09T22:25:32.172 controller-0 collectd[153770]: info The top
10 memory rss processes for the Kubernetes System are :
[('java', '36.72 GiB')
, ('java', '26.87 GiB')
, ('java', '4.25 GiB')
, ('java', '2.71 GiB')
, ('autodetect', '860.24 MiB')
, ('java', '826.97 MiB')
, ('kube-apiserver', '801
.15 MiB')
, ('autodetect', '606.67 MiB')
, ('java', '363.57 MiB')
, ('metricbeat', '249.55 MiB')
]

To this after this fix was implemented.
2023-03-07T16:40:49.669 controller-0 collectd[65421]: info The top
10 memory rss processes for the Kubernetes System are :
[('kube-apiserver', '609.29 MiB')
, ('kube-controller', '137.29 MiB')
, ('helm-controller', '93.80 MiB')
, ('uwsgi', '88.61 MiB')
, ('uwsgi', '88.60 MiB')
, ('uwsgi', '88.60 MiB')
, ('uwsgi', '88.55 MiB')
, ('cephcsi', '81.06 MiB')
, ('cephcsi', '80.25 MiB')
, ('source-controll', '79.47 MiB')
]

Closes-Bug: 2009877

Test Plan:

PASS: Build an image, install and bootstrap successfully
PASS: Apply monitor pods so addon logs would be installed.
PASS: Ensure only Kubernetes System processes are displayed in the
top 10 Kubernetes System list.

Signed-off-by: cpompeud <Cesar.PompeudeBarrosBombonate@windriver.com>
Change-Id: I1361de835003fdaa7f70941f83b9dd79bfe75c60
This commit is contained in:
cpompeud 2023-03-07 16:26:31 -03:00
parent f26bbf8842
commit d5aa0bf737

View File

@ -575,8 +575,7 @@ def get_platform_memory_per_process():
match = re_path_uid.search(path) match = re_path_uid.search(path)
if match: if match:
uid = match.group(1) uid = match.group(1)
pod_pids.extend(get_cgroup_pid(path)) for pid in get_cgroup_pid(path):
for pid in pod_pids:
name = str(get_pid_name(pid)) name = str(get_pid_name(pid))
rss = get_pid_rss(pid) rss = get_pid_rss(pid)
if rss is not None and rss > 0: if rss is not None and rss > 0: