From f8c5c02599c93af8560bb7d5dc8be56b9da17a2e Mon Sep 17 00:00:00 2001 From: jietaoxiao Date: Fri, 21 Jul 2023 14:23:12 +0800 Subject: [PATCH 1/2] uniity/podMan: fix getAllcons(), containerID may be nil --- source/tools/monitor/unity/collector/podMan/podsAll.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/tools/monitor/unity/collector/podMan/podsAll.lua b/source/tools/monitor/unity/collector/podMan/podsAll.lua index 248a1a77..1b3c7eec 100644 --- a/source/tools/monitor/unity/collector/podMan/podsAll.lua +++ b/source/tools/monitor/unity/collector/podMan/podsAll.lua @@ -133,6 +133,7 @@ function CpodsAll:getAllcons(procfs) for _, pod in ipairs(obj.items) do local metadata = pod.metadata --print(string.format("podns :%s, pod:%s",metadata.namespace, metadata.name)) + if not pod.status.qosClass then goto continue end local lpod = {name = metadata.name, namespace = metadata.namespace, uid = pystring:replace(metadata.uid, "-", "_"), @@ -140,6 +141,7 @@ function CpodsAll:getAllcons(procfs) } local containerStatuses = pod.status.containerStatuses for _, con in ipairs(containerStatuses) do + if not con.containerID then goto cs_continue then local cell = { pod = lpod, name = con.name, @@ -150,7 +152,9 @@ function CpodsAll:getAllcons(procfs) c = c + 1 cons[c] = cell end + ::cs_continue:: end + ::continue:: end return cons end -- Gitee From 76ee6802705a44b76e1282d2b86d83d2055eb14d Mon Sep 17 00:00:00 2001 From: jietaoxiao Date: Fri, 21 Jul 2023 14:47:32 +0800 Subject: [PATCH 2/2] unity/podman: fix spell error --- source/tools/monitor/unity/collector/podMan/podsAll.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/tools/monitor/unity/collector/podMan/podsAll.lua b/source/tools/monitor/unity/collector/podMan/podsAll.lua index 1b3c7eec..80846d70 100644 --- a/source/tools/monitor/unity/collector/podMan/podsAll.lua +++ b/source/tools/monitor/unity/collector/podMan/podsAll.lua @@ -141,7 +141,7 @@ function CpodsAll:getAllcons(procfs) } local containerStatuses = pod.status.containerStatuses for _, con in ipairs(containerStatuses) do - if not con.containerID then goto cs_continue then + if not con.containerID then goto cs_continue end local cell = { pod = lpod, name = con.name, -- Gitee