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.
This commit is contained in:
Matthias Radestock
2017-12-28 13:49:40 +00:00
parent 4c1d5640ae
commit 2d6badba79

View File

@@ -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}