From d5aa0bf73771186c67506cfa766bd12371f5228e Mon Sep 17 00:00:00 2001 From: cpompeud Date: Tue, 7 Mar 2023 16:26:31 -0300 Subject: [PATCH] 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 Change-Id: I1361de835003fdaa7f70941f83b9dd79bfe75c60 --- collectd-extensions/src/memory.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/collectd-extensions/src/memory.py b/collectd-extensions/src/memory.py index 16b8649..5736cef 100755 --- a/collectd-extensions/src/memory.py +++ b/collectd-extensions/src/memory.py @@ -575,8 +575,7 @@ def get_platform_memory_per_process(): match = re_path_uid.search(path) if match: uid = match.group(1) - pod_pids.extend(get_cgroup_pid(path)) - for pid in pod_pids: + for pid in get_cgroup_pid(path): name = str(get_pid_name(pid)) rss = get_pid_rss(pid) if rss is not None and rss > 0: