mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
Group pseudo nodes by the node the referred to and their address in grouped topologies.
This commit is contained in:
@@ -119,8 +119,10 @@ func (t Topology) RenderBy(f MapFunc, grouped bool) map[string]RenderableNode {
|
||||
dstRenderableID = dstNodeAddress
|
||||
maj, min = "the Internet", ""
|
||||
} else if grouped {
|
||||
dstRenderableID = localUnknown
|
||||
maj, min = "", ""
|
||||
// When grouping, emit one pseudo node per (srcNodeAddress, dstNodeAddr)
|
||||
dstNodeAddr, _ := trySplitAddr(dstNodeAddress)
|
||||
dstRenderableID = strings.Join([]string{"pseudo:", dstNodeAddr, srcRenderableID}, ScopeDelim)
|
||||
maj, min = dstNodeAddr, ""
|
||||
} else {
|
||||
// Rule for non-internet psuedo nodes; emit 1 new node for each
|
||||
// dstNodeAddr, srcNodeAddr, srcNodePort.
|
||||
|
||||
@@ -183,26 +183,16 @@ func TestRenderByProcessPID(t *testing.T) {
|
||||
},
|
||||
},
|
||||
"pseudo:;10.10.10.10;192.168.1.1;80": {
|
||||
ID: "pseudo:;10.10.10.10;192.168.1.1;80",
|
||||
LabelMajor: "10.10.10.10",
|
||||
LabelMinor: "",
|
||||
Rank: "",
|
||||
Pseudo: true,
|
||||
Adjacency: nil,
|
||||
OriginHosts: nil,
|
||||
OriginNodes: nil,
|
||||
Metadata: AggregateMetadata{},
|
||||
ID: "pseudo:;10.10.10.10;192.168.1.1;80",
|
||||
LabelMajor: "10.10.10.10",
|
||||
Pseudo: true,
|
||||
Metadata: AggregateMetadata{},
|
||||
},
|
||||
"pseudo:;10.10.10.11;192.168.1.1;80": {
|
||||
ID: "pseudo:;10.10.10.11;192.168.1.1;80",
|
||||
LabelMajor: "10.10.10.11",
|
||||
LabelMinor: "",
|
||||
Rank: "",
|
||||
Pseudo: true,
|
||||
Adjacency: nil,
|
||||
OriginHosts: nil,
|
||||
OriginNodes: nil,
|
||||
Metadata: AggregateMetadata{},
|
||||
ID: "pseudo:;10.10.10.11;192.168.1.1;80",
|
||||
LabelMajor: "10.10.10.11",
|
||||
Pseudo: true,
|
||||
Metadata: AggregateMetadata{},
|
||||
},
|
||||
}
|
||||
have := report.Process.RenderBy(ProcessPID, false)
|
||||
@@ -231,12 +221,16 @@ func TestRenderByProcessPIDGrouped(t *testing.T) {
|
||||
},
|
||||
},
|
||||
"apache": {
|
||||
ID: "apache",
|
||||
LabelMajor: "apache",
|
||||
LabelMinor: "",
|
||||
Rank: "215",
|
||||
Pseudo: false,
|
||||
Adjacency: NewIDList("curl", "localUnknown"),
|
||||
ID: "apache",
|
||||
LabelMajor: "apache",
|
||||
LabelMinor: "",
|
||||
Rank: "215",
|
||||
Pseudo: false,
|
||||
Adjacency: NewIDList(
|
||||
"curl",
|
||||
"pseudo:;10.10.10.10;apache",
|
||||
"pseudo:;10.10.10.11;apache",
|
||||
),
|
||||
OriginHosts: NewIDList("server.hostname.com"),
|
||||
OriginNodes: NewIDList(";192.168.1.1;80"),
|
||||
Metadata: AggregateMetadata{
|
||||
@@ -244,16 +238,17 @@ func TestRenderByProcessPIDGrouped(t *testing.T) {
|
||||
KeyBytesEgress: 1500,
|
||||
},
|
||||
},
|
||||
"localUnknown": {
|
||||
ID: "localUnknown",
|
||||
LabelMajor: "",
|
||||
LabelMinor: "",
|
||||
Rank: "",
|
||||
Pseudo: true,
|
||||
Adjacency: nil,
|
||||
OriginHosts: nil,
|
||||
OriginNodes: nil,
|
||||
Metadata: AggregateMetadata{},
|
||||
"pseudo:;10.10.10.10;apache": {
|
||||
ID: "pseudo:;10.10.10.10;apache",
|
||||
LabelMajor: "10.10.10.10",
|
||||
Pseudo: true,
|
||||
Metadata: AggregateMetadata{},
|
||||
},
|
||||
"pseudo:;10.10.10.11;apache": {
|
||||
ID: "pseudo:;10.10.10.11;apache",
|
||||
LabelMajor: "10.10.10.11",
|
||||
Pseudo: true,
|
||||
Metadata: AggregateMetadata{},
|
||||
},
|
||||
}
|
||||
have := report.Process.RenderBy(ProcessPID, true)
|
||||
|
||||
Reference in New Issue
Block a user