diff --git a/render/host.go b/render/host.go index be6c8b34e5..1bd0ec1d4e 100644 --- a/render/host.go +++ b/render/host.go @@ -35,25 +35,31 @@ var HostRenderer = MakeReduce( // If this function is given a node without a hostname // (including other pseudo nodes), it will drop the node. // -// Otherwise, this function will produce a node with the correct ID +// Otherwise, this function will produce nodes with the correct ID // format for a host, but without any Major or Minor labels. It does // not have enough info to do that, and the resulting graph must be // merged with a host graph to get that info. func MapX2Host(n report.Node, _ report.Networks) report.Nodes { - // Don't propagate all pseudo nodes - we do this in MapEndpoint2Host + // Don't propagate pseudo nodes - we do this in MapEndpoint2Host if n.Topology == Pseudo { return report.Nodes{} } - hostNodeID, timestamp, ok := n.Latest.LookupEntry(report.HostNodeID) + + hostIDs, ok := n.Parents.Lookup(report.Host) if !ok { return report.Nodes{} } - id := report.MakeHostNodeID(report.ExtractHostID(n)) - result := NewDerivedNode(id, n).WithTopology(report.Host) - result.Latest = result.Latest.Set(report.HostNodeID, timestamp, hostNodeID) - result.Counters = result.Counters.Add(n.Topology, 1) - result.Children = report.MakeNodeSet(n) - return report.Nodes{id: result} + + result := report.Nodes{} + children := report.MakeNodeSet(n) + for _, id := range hostIDs { + node := NewDerivedNode(id, n).WithTopology(report.Host) + node.Counters = node.Counters.Add(n.Topology, 1) + node.Children = children + result[id] = node + } + + return result } // MapEndpoint2Host takes nodes from the endpoint topology and produces