render sensible labels for group nodes with little/no metadata

The node ID of group nodes is in fact the same value as we get from
looking up the metadata key contained in the group topology id. So
just use that since a) we always have it, and b) we save a LatestMap
lookup.
This commit is contained in:
Matthias Radestock
2017-12-23 12:22:05 +00:00
parent 15881cd7fd
commit da11655659

View File

@@ -361,21 +361,13 @@ func weaveNodeSummary(base NodeSummary, n report.Node) (NodeSummary, bool) {
// groupNodeSummary renders the summary for a group node. n.Topology is
// expected to be of the form: group:container:hostname
func groupNodeSummary(base NodeSummary, r report.Report, n report.Node) (NodeSummary, bool) {
topology, key, ok := render.ParseGroupNodeTopology(n.Topology)
if !ok {
return NodeSummary{}, false
}
label, ok := n.Latest.Lookup(key)
if !ok {
return NodeSummary{}, false
}
base.Label, base.Rank = label, label
if t, ok := r.Topology(topology); ok {
base.Shape = t.GetShape()
if t.Label != "" {
base.LabelMinor = pluralize(n.Counters, topology, t.Label, t.LabelPlural)
base.Label, base.Rank = n.ID, n.ID
if topology, _, ok := render.ParseGroupNodeTopology(n.Topology); ok {
if t, ok := r.Topology(topology); ok {
base.Shape = t.GetShape()
if t.Label != "" {
base.LabelMinor = pluralize(n.Counters, topology, t.Label, t.LabelPlural)
}
}
}
base.Stack = true