From 2d6badba79a071216c93184aa445391d7756bbe9 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Thu, 28 Dec 2017 13:49:40 +0000 Subject: [PATCH] cope with processes that have no HostNodeID metadata Some process nodes may not have a HostNodeID metadata, e.g. when an endpoint references a pid that we know nothing about. When mapping processes to containers, we therefore shouldn't rely on HostNodeID. Instead we can obtain the hostID from the process node ID. This has been broken for a while, possibly forever. --- render/container.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/render/container.go b/render/container.go index e42ac959c..c0c3d621f 100644 --- a/render/container.go +++ b/render/container.go @@ -268,9 +268,7 @@ func MapProcess2Container(n report.Node) report.Nodes { } // Otherwise, if the process is not in a container, group it into - // an per-host "Uncontained" node. If for whatever reason this - // node doesn't have a host id in their node metadata, it'll all - // get grouped into a single uncontained node. + // a per-host "Uncontained" node. var ( id string node report.Node @@ -279,7 +277,8 @@ func MapProcess2Container(n report.Node) report.Nodes { id = report.MakeContainerNodeID(containerID) node = NewDerivedNode(id, n).WithTopology(report.Container) } else { - id = MakePseudoNodeID(UncontainedID, report.ExtractHostID(n)) + hostID, _, _ := report.ParseProcessNodeID(n.ID) + id = MakePseudoNodeID(UncontainedID, hostID) node = NewDerivedPseudoNode(id, n) } return report.Nodes{id: node}