mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-16 03:49:52 +00:00
don't map image adjacencies to hosts
it's just wrong
This commit is contained in:
@@ -32,11 +32,23 @@ func nodes2Hosts(nodes Nodes) Nodes {
|
||||
if n.Topology == Pseudo {
|
||||
continue // Don't propagate pseudo nodes - we do this in endpoints2Hosts
|
||||
}
|
||||
isImage := n.Topology == report.ContainerImage
|
||||
hostIDs, _ := n.Parents.Lookup(report.Host)
|
||||
for _, id := range hostIDs {
|
||||
ret.addChild(n, id, func(id string) report.Node {
|
||||
return report.MakeNode(id).WithTopology(report.Host)
|
||||
})
|
||||
if isImage {
|
||||
// We need to treat image nodes specially because they
|
||||
// aggregate adjacencies of containers across multiple
|
||||
// hosts, and hence mapping these adjacencies to host
|
||||
// adjacencies would produce edges that aren't present
|
||||
// in reality.
|
||||
ret.addUnmappedChild(n, id, func(id string) report.Node {
|
||||
return report.MakeNode(id).WithTopology(report.Host)
|
||||
})
|
||||
} else {
|
||||
ret.addChild(n, id, func(id string) report.Node {
|
||||
return report.MakeNode(id).WithTopology(report.Host)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret.result(nodes)
|
||||
|
||||
@@ -185,6 +185,20 @@ func (ret *joinResults) add(m report.Node, n report.Node) {
|
||||
}
|
||||
}
|
||||
|
||||
// Add m as a child of the node at id, creating a new result node if
|
||||
// not already there.
|
||||
func (ret *joinResults) addUnmappedChild(m report.Node, id string, create func(string) report.Node) {
|
||||
result, exists := ret.nodes[id]
|
||||
if !exists {
|
||||
result = create(id)
|
||||
}
|
||||
result.Children = result.Children.Add(m)
|
||||
if m.Topology != report.Endpoint { // optimisation: we never look at endpoint counts
|
||||
result.Counters = result.Counters.Add(m.Topology, 1)
|
||||
}
|
||||
ret.nodes[id] = result
|
||||
}
|
||||
|
||||
// Add m as a child of the node at id, creating a new result node if
|
||||
// not already there, and updating the mapping from old ID to new ID.
|
||||
func (ret *joinResults) addChild(m report.Node, id string, create func(string) report.Node) {
|
||||
|
||||
Reference in New Issue
Block a user