mirror of
https://github.com/weaveworks/scope.git
synced 2026-05-14 13:17:07 +00:00
refactor: joinResults.result() takes a plain report.Nodes map
This commit is contained in:
@@ -31,10 +31,9 @@ func MapEndpoints(endpointToID endpointToIDFunc, topology string) Renderer {
|
||||
|
||||
func (e mapEndpoints) Render(ctx context.Context, rpt report.Report) Nodes {
|
||||
local := LocalNetworks(rpt)
|
||||
endpoints := SelectEndpoint.Render(ctx, rpt)
|
||||
ret := newJoinResults(TopologySelector(e.topology).Render(ctx, rpt).Nodes)
|
||||
|
||||
for _, n := range endpoints.Nodes {
|
||||
for _, n := range rpt.Endpoint.Nodes {
|
||||
// Nodes without a hostid are mapped to pseudo nodes, if
|
||||
// possible.
|
||||
if _, ok := n.Latest.Lookup(report.HostNodeID); !ok {
|
||||
@@ -47,5 +46,5 @@ func (e mapEndpoints) Render(ctx context.Context, rpt report.Report) Nodes {
|
||||
ret.addChild(n, id, e.topology)
|
||||
}
|
||||
}
|
||||
return ret.result(endpoints)
|
||||
return ret.result(rpt.Endpoint.Nodes)
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func nodes2Hosts(nodes Nodes) Nodes {
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret.result(nodes)
|
||||
return ret.result(nodes.Nodes)
|
||||
}
|
||||
|
||||
func endpoint2Host(endpoint report.Node) string {
|
||||
|
||||
@@ -197,5 +197,5 @@ func (m Map2Parent) Render(ctx context.Context, rpt report.Report) Nodes {
|
||||
ret.addChildAndChildren(n, id, Pseudo)
|
||||
}
|
||||
}
|
||||
return ret.result(input)
|
||||
return ret.result(input.Nodes)
|
||||
}
|
||||
|
||||
@@ -105,5 +105,5 @@ func processes2Names(processes Nodes) Nodes {
|
||||
ret.addChildAndChildren(n, name, processNameTopology)
|
||||
}
|
||||
}
|
||||
return ret.result(processes)
|
||||
return ret.result(processes.Nodes)
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ func (m Map) Render(ctx context.Context, rpt report.Report) Nodes {
|
||||
span.LogFields(otlog.Int("input.nodes", len(input.Nodes)),
|
||||
otlog.Int("ouput.nodes", len(output.nodes)))
|
||||
|
||||
return output.result(input)
|
||||
return output.result(input.Nodes)
|
||||
}
|
||||
|
||||
// Condition is a predecate over the entire report that can evaluate to true or false.
|
||||
@@ -227,8 +227,8 @@ func (ret *joinResults) passThrough(n report.Node) {
|
||||
|
||||
// Rewrite Adjacency of nodes in ret mapped from original nodes in
|
||||
// input, and return the result.
|
||||
func (ret *joinResults) result(input Nodes) Nodes {
|
||||
for _, n := range input.Nodes {
|
||||
func (ret *joinResults) result(input report.Nodes) Nodes {
|
||||
for _, n := range input {
|
||||
outID, ok := ret.mapped[n.ID]
|
||||
if !ok {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user