mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-23 07:16:47 +00:00
get rid of endpoint type indicators
The app stopped paying attention to these some time ago. Removing them shrinks reports by 3-10%.
This commit is contained in:
@@ -103,13 +103,10 @@ func (t *connectionTracker) ReportConnections(rpt *report.Report) {
|
||||
// performFlowWalk consults the flowWalker for short-lived connections
|
||||
func (t *connectionTracker) performFlowWalk(rpt *report.Report) map[string]fourTuple {
|
||||
seenTuples := map[string]fourTuple{}
|
||||
extraNodeInfo := map[string]string{
|
||||
Conntracked: "true",
|
||||
}
|
||||
t.flowWalker.walkFlows(func(f flow, alive bool) {
|
||||
tuple := flowToTuple(f)
|
||||
seenTuples[tuple.key()] = tuple
|
||||
t.addConnection(rpt, tuple, "", extraNodeInfo, extraNodeInfo)
|
||||
t.addConnection(rpt, tuple, "", nil, nil)
|
||||
})
|
||||
return seenTuples
|
||||
}
|
||||
@@ -138,13 +135,12 @@ func (t *connectionTracker) performWalkProc(rpt *report.Report, hostNodeID strin
|
||||
}
|
||||
for conn := conns.Next(); conn != nil; conn = conns.Next() {
|
||||
tuple, namespaceID, incoming := connectionTuple(conn, seenTuples)
|
||||
var (
|
||||
toNodeInfo = map[string]string{Procspied: "true"}
|
||||
fromNodeInfo = map[string]string{Procspied: "true"}
|
||||
)
|
||||
var toNodeInfo, fromNodeInfo map[string]string
|
||||
if conn.Proc.PID > 0 {
|
||||
fromNodeInfo[process.PID] = strconv.FormatUint(uint64(conn.Proc.PID), 10)
|
||||
fromNodeInfo[report.HostNodeID] = hostNodeID
|
||||
fromNodeInfo = map[string]string{
|
||||
process.PID: strconv.FormatUint(uint64(conn.Proc.PID), 10),
|
||||
report.HostNodeID: hostNodeID,
|
||||
}
|
||||
}
|
||||
if incoming {
|
||||
tuple.reverse()
|
||||
@@ -186,23 +182,19 @@ func (t *connectionTracker) getInitialState() {
|
||||
|
||||
func (t *connectionTracker) performEbpfTrack(rpt *report.Report, hostNodeID string) error {
|
||||
t.ebpfTracker.walkConnections(func(e ebpfConnection) {
|
||||
fromNodeInfo := map[string]string{
|
||||
EBPF: "true",
|
||||
}
|
||||
toNodeInfo := map[string]string{
|
||||
EBPF: "true",
|
||||
}
|
||||
var toNodeInfo, fromNodeInfo map[string]string
|
||||
if e.pid > 0 {
|
||||
fromNodeInfo[process.PID] = strconv.Itoa(e.pid)
|
||||
fromNodeInfo[report.HostNodeID] = hostNodeID
|
||||
fromNodeInfo = map[string]string{
|
||||
process.PID: strconv.Itoa(e.pid),
|
||||
report.HostNodeID: hostNodeID,
|
||||
}
|
||||
}
|
||||
|
||||
tuple := e.tuple
|
||||
if e.incoming {
|
||||
t.addConnection(rpt, reverse(e.tuple), e.networkNamespace, toNodeInfo, fromNodeInfo)
|
||||
} else {
|
||||
t.addConnection(rpt, e.tuple, e.networkNamespace, fromNodeInfo, toNodeInfo)
|
||||
tuple = reverse(tuple)
|
||||
toNodeInfo, fromNodeInfo = fromNodeInfo, toNodeInfo
|
||||
}
|
||||
|
||||
t.addConnection(rpt, tuple, e.networkNamespace, fromNodeInfo, toNodeInfo)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -70,8 +70,7 @@ func TestNat(t *testing.T) {
|
||||
have := report.MakeReport()
|
||||
originalID := report.MakeEndpointNodeID("host1", "", "10.0.47.1", "80")
|
||||
have.Endpoint.AddNode(report.MakeNodeWith(originalID, map[string]string{
|
||||
"foo": "bar",
|
||||
Procspied: "true",
|
||||
"foo": "bar",
|
||||
}))
|
||||
|
||||
want := have.Copy()
|
||||
@@ -79,7 +78,6 @@ func TestNat(t *testing.T) {
|
||||
want.Endpoint.AddNode(report.MakeNodeWith(wantID, map[string]string{
|
||||
"copy_of": originalID,
|
||||
"foo": "bar",
|
||||
Procspied: "true",
|
||||
}))
|
||||
|
||||
makeNATMapper(ct).applyNAT(have, "host1")
|
||||
@@ -125,15 +123,13 @@ func TestNat(t *testing.T) {
|
||||
have := report.MakeReport()
|
||||
originalID := report.MakeEndpointNodeID("host2", "", "10.0.47.2", "22222")
|
||||
have.Endpoint.AddNode(report.MakeNodeWith(originalID, map[string]string{
|
||||
"foo": "baz",
|
||||
Procspied: "true",
|
||||
"foo": "baz",
|
||||
}))
|
||||
|
||||
want := have.Copy()
|
||||
want.Endpoint.AddNode(report.MakeNodeWith(report.MakeEndpointNodeID("host2", "", "2.3.4.5", "22223"), map[string]string{
|
||||
"copy_of": originalID,
|
||||
"foo": "baz",
|
||||
Procspied: "true",
|
||||
}))
|
||||
|
||||
makeNATMapper(ct).applyNAT(have, "host1")
|
||||
|
||||
@@ -11,9 +11,6 @@ import (
|
||||
|
||||
// Node metadata keys.
|
||||
const (
|
||||
Conntracked = "conntracked"
|
||||
EBPF = "eBPF"
|
||||
Procspied = "procspied"
|
||||
ReverseDNSNames = "reverse_dns_names"
|
||||
SnoopedDNSNames = "snooped_dns_names"
|
||||
)
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/weaveworks/common/mtime"
|
||||
|
||||
"github.com/weaveworks/scope/probe/docker"
|
||||
"github.com/weaveworks/scope/probe/endpoint"
|
||||
"github.com/weaveworks/scope/probe/host"
|
||||
"github.com/weaveworks/scope/render"
|
||||
"github.com/weaveworks/scope/report"
|
||||
@@ -51,24 +50,16 @@ var (
|
||||
rpt = report.Report{
|
||||
Endpoint: report.Topology{
|
||||
Nodes: report.Nodes{
|
||||
randomEndpointNodeID: report.MakeNodeWith(randomEndpointNodeID, map[string]string{
|
||||
endpoint.Conntracked: "true",
|
||||
}).
|
||||
WithAdjacent(serverEndpointNodeID).WithTopology(report.Endpoint),
|
||||
randomEndpointNodeID: report.MakeNode(randomEndpointNodeID).
|
||||
WithTopology(report.Endpoint).WithAdjacent(serverEndpointNodeID),
|
||||
|
||||
serverEndpointNodeID: report.MakeNodeWith(serverEndpointNodeID, map[string]string{
|
||||
endpoint.Conntracked: "true",
|
||||
}).
|
||||
serverEndpointNodeID: report.MakeNode(serverEndpointNodeID).
|
||||
WithTopology(report.Endpoint),
|
||||
|
||||
container1EndpointNodeID: report.MakeNodeWith(container1EndpointNodeID, map[string]string{
|
||||
endpoint.Conntracked: "true",
|
||||
}).
|
||||
WithAdjacent(duplicatedEndpointNodeID).WithTopology(report.Endpoint),
|
||||
container1EndpointNodeID: report.MakeNode(container1EndpointNodeID).
|
||||
WithTopology(report.Endpoint).WithAdjacent(duplicatedEndpointNodeID),
|
||||
|
||||
duplicatedEndpointNodeID: report.MakeNodeWith(duplicatedEndpointNodeID, map[string]string{
|
||||
endpoint.Conntracked: "true",
|
||||
}).
|
||||
duplicatedEndpointNodeID: report.MakeNode(duplicatedEndpointNodeID).
|
||||
WithTopology(report.Endpoint),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"time"
|
||||
|
||||
"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/process"
|
||||
@@ -128,67 +127,53 @@ var (
|
||||
// care to test into the fixture. Just be sure to include the bits
|
||||
// that the mapping funcs extract :)
|
||||
Client54001NodeID: report.MakeNode(Client54001NodeID).WithTopology(report.Endpoint).WithLatests(map[string]string{
|
||||
process.PID: Client1PID,
|
||||
report.HostNodeID: ClientHostNodeID,
|
||||
endpoint.Procspied: True,
|
||||
process.PID: Client1PID,
|
||||
report.HostNodeID: ClientHostNodeID,
|
||||
}).WithEdge(Server80NodeID, report.EdgeMetadata{
|
||||
EgressPacketCount: newu64(10),
|
||||
EgressByteCount: newu64(100),
|
||||
}),
|
||||
|
||||
Client54002NodeID: report.MakeNode(Client54002NodeID).WithTopology(report.Endpoint).WithLatests(map[string]string{
|
||||
process.PID: Client2PID,
|
||||
report.HostNodeID: ClientHostNodeID,
|
||||
endpoint.Procspied: True,
|
||||
process.PID: Client2PID,
|
||||
report.HostNodeID: ClientHostNodeID,
|
||||
}).WithEdge(Server80NodeID, report.EdgeMetadata{
|
||||
EgressPacketCount: newu64(20),
|
||||
EgressByteCount: newu64(200),
|
||||
}),
|
||||
|
||||
Server80NodeID: report.MakeNode(Server80NodeID).WithTopology(report.Endpoint).WithLatests(map[string]string{
|
||||
process.PID: ServerPID,
|
||||
report.HostNodeID: ServerHostNodeID,
|
||||
endpoint.Procspied: True,
|
||||
process.PID: ServerPID,
|
||||
report.HostNodeID: ServerHostNodeID,
|
||||
}),
|
||||
|
||||
NonContainerNodeID: report.MakeNode(NonContainerNodeID).WithTopology(report.Endpoint).WithLatests(map[string]string{
|
||||
process.PID: NonContainerPID,
|
||||
report.HostNodeID: ServerHostNodeID,
|
||||
endpoint.Procspied: True,
|
||||
process.PID: NonContainerPID,
|
||||
report.HostNodeID: ServerHostNodeID,
|
||||
}).WithAdjacent(GoogleEndpointNodeID),
|
||||
|
||||
// Probe pseudo nodes
|
||||
UnknownClient1NodeID: report.MakeNode(UnknownClient1NodeID).WithTopology(report.Endpoint).WithLatests(map[string]string{
|
||||
endpoint.Procspied: True,
|
||||
}).WithEdge(Server80NodeID, report.EdgeMetadata{
|
||||
UnknownClient1NodeID: report.MakeNode(UnknownClient1NodeID).WithTopology(report.Endpoint).WithEdge(Server80NodeID, report.EdgeMetadata{
|
||||
EgressPacketCount: newu64(30),
|
||||
EgressByteCount: newu64(300),
|
||||
}),
|
||||
|
||||
UnknownClient2NodeID: report.MakeNode(UnknownClient2NodeID).WithTopology(report.Endpoint).WithLatests(map[string]string{
|
||||
endpoint.Procspied: True,
|
||||
}).WithEdge(Server80NodeID, report.EdgeMetadata{
|
||||
UnknownClient2NodeID: report.MakeNode(UnknownClient2NodeID).WithTopology(report.Endpoint).WithEdge(Server80NodeID, report.EdgeMetadata{
|
||||
EgressPacketCount: newu64(40),
|
||||
EgressByteCount: newu64(400),
|
||||
}),
|
||||
|
||||
UnknownClient3NodeID: report.MakeNode(UnknownClient3NodeID).WithTopology(report.Endpoint).WithLatests(map[string]string{
|
||||
endpoint.Procspied: True,
|
||||
}).WithEdge(Server80NodeID, report.EdgeMetadata{
|
||||
UnknownClient3NodeID: report.MakeNode(UnknownClient3NodeID).WithTopology(report.Endpoint).WithEdge(Server80NodeID, report.EdgeMetadata{
|
||||
EgressPacketCount: newu64(50),
|
||||
EgressByteCount: newu64(500),
|
||||
}),
|
||||
|
||||
RandomClientNodeID: report.MakeNode(RandomClientNodeID).WithTopology(report.Endpoint).WithLatests(map[string]string{
|
||||
endpoint.Procspied: True,
|
||||
}).WithEdge(Server80NodeID, report.EdgeMetadata{
|
||||
RandomClientNodeID: report.MakeNode(RandomClientNodeID).WithTopology(report.Endpoint).WithEdge(Server80NodeID, report.EdgeMetadata{
|
||||
EgressPacketCount: newu64(60),
|
||||
EgressByteCount: newu64(600),
|
||||
}),
|
||||
|
||||
GoogleEndpointNodeID: report.MakeNode(GoogleEndpointNodeID).WithTopology(report.Endpoint).WithLatests(map[string]string{
|
||||
endpoint.Procspied: True,
|
||||
}),
|
||||
GoogleEndpointNodeID: report.MakeNode(GoogleEndpointNodeID).WithTopology(report.Endpoint),
|
||||
},
|
||||
},
|
||||
Process: report.Topology{
|
||||
|
||||
Reference in New Issue
Block a user