From da11655659ddfebc4d3bbd8d312027ed8054aa3f Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sat, 23 Dec 2017 12:22:05 +0000 Subject: [PATCH] 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. --- render/detailed/summary.go | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/render/detailed/summary.go b/render/detailed/summary.go index 5dbdfa57c..4088d5dcf 100644 --- a/render/detailed/summary.go +++ b/render/detailed/summary.go @@ -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