mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
drop addr and port from Endpoint.Latest map
the information is constant and already present in the id, so we can extract it from there. That reduces the report size and improves report encoding/decoding performance. It should reduce memory usage too and improve report merging performance too. NB: Probes with this change are incompatible with old apps.
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/weaveworks/scope/probe/awsecs"
|
||||
"github.com/weaveworks/scope/probe/docker"
|
||||
"github.com/weaveworks/scope/probe/endpoint"
|
||||
"github.com/weaveworks/scope/probe/host"
|
||||
"github.com/weaveworks/scope/probe/kubernetes"
|
||||
"github.com/weaveworks/scope/probe/overlay"
|
||||
@@ -182,7 +181,7 @@ func pseudoNodeSummary(base NodeSummary, n report.Node) (NodeSummary, bool) {
|
||||
}
|
||||
|
||||
// try rendering it as an endpoint
|
||||
if addr, ok := n.Latest.Lookup(endpoint.Addr); ok {
|
||||
if _, addr, _, ok := report.ParseEndpointNodeID(n.ID); ok {
|
||||
base.Label = addr
|
||||
base.Shape = report.Circle
|
||||
return base, true
|
||||
|
||||
@@ -2,7 +2,6 @@ package render
|
||||
|
||||
import (
|
||||
"github.com/weaveworks/scope/probe/docker"
|
||||
"github.com/weaveworks/scope/probe/endpoint"
|
||||
"github.com/weaveworks/scope/probe/process"
|
||||
"github.com/weaveworks/scope/report"
|
||||
)
|
||||
@@ -82,7 +81,7 @@ var ProcessNameRenderer = ConditionalRenderer(renderProcesses,
|
||||
|
||||
// MapEndpoint2Pseudo makes internet of host pesudo nodes from a endpoint node.
|
||||
func MapEndpoint2Pseudo(n report.Node, local report.Networks) report.Nodes {
|
||||
addr, ok := n.Latest.Lookup(endpoint.Addr)
|
||||
_, addr, _, ok := report.ParseEndpointNodeID(n.ID)
|
||||
if !ok {
|
||||
return report.Nodes{}
|
||||
}
|
||||
|
||||
@@ -52,29 +52,21 @@ var (
|
||||
Endpoint: report.Topology{
|
||||
Nodes: report.Nodes{
|
||||
randomEndpointNodeID: report.MakeNodeWith(randomEndpointNodeID, map[string]string{
|
||||
endpoint.Addr: randomIP,
|
||||
endpoint.Port: randomPort,
|
||||
endpoint.Conntracked: "true",
|
||||
}).
|
||||
WithAdjacent(serverEndpointNodeID).WithTopology(report.Endpoint),
|
||||
|
||||
serverEndpointNodeID: report.MakeNodeWith(serverEndpointNodeID, map[string]string{
|
||||
endpoint.Addr: serverIP,
|
||||
endpoint.Port: serverPort,
|
||||
endpoint.Conntracked: "true",
|
||||
}).
|
||||
WithTopology(report.Endpoint),
|
||||
|
||||
container1EndpointNodeID: report.MakeNodeWith(container1EndpointNodeID, map[string]string{
|
||||
endpoint.Addr: container1IP,
|
||||
endpoint.Port: container1Port,
|
||||
endpoint.Conntracked: "true",
|
||||
}).
|
||||
WithAdjacent(duplicatedEndpointNodeID).WithTopology(report.Endpoint),
|
||||
|
||||
duplicatedEndpointNodeID: report.MakeNodeWith(duplicatedEndpointNodeID, map[string]string{
|
||||
endpoint.Addr: duplicatedIP,
|
||||
endpoint.Port: duplicatedPort,
|
||||
endpoint.Conntracked: "true",
|
||||
}).
|
||||
WithTopology(report.Endpoint),
|
||||
|
||||
Reference in New Issue
Block a user