Add initial metadata in details panel and clarification comments

This commit is contained in:
Alfonso Acosta
2016-10-26 09:09:01 +00:00
parent 7771625a25
commit f906511ded
3 changed files with 20 additions and 3 deletions

View File

@@ -25,9 +25,10 @@ type Client interface {
// Status describes whats happen in the Weave Net router.
type Status struct {
Router Router
DNS DNS
IPAM IPAM
Version string
Router Router
DNS DNS
IPAM IPAM
}
// Router describes the status of the Weave Router

View File

@@ -27,6 +27,9 @@ const (
// WeaveMACAddress is the key for the mac address of the container on the
// weave network, to be found in container node metadata
WeaveMACAddress = "weave_mac_address"
// WeaveVersion is the key for the weave version running on the peer
WeaveVersion = "weave_version"
)
// Weave represents a single Weave router, presumably on the same host
@@ -163,14 +166,24 @@ func (w *Weave) Report() (report.Report, error) {
WeaveMACAddress: {ID: WeaveMACAddress, Label: "Weave MAC", From: report.FromLatest, Priority: 17},
WeaveDNSHostname: {ID: WeaveDNSHostname, Label: "Weave DNS Name", From: report.FromLatest, Priority: 18},
})
r.Overlay = r.Overlay.WithMetadataTemplates(report.MetadataTemplates{
WeavePeerName: {ID: WeavePeerName, Label: "Peer Name", From: report.FromLatest, Truncate: 17, Priority: 1},
WeaveVersion: {ID: WeaveVersion, Label: "Version", From: report.FromLatest, Priority: 2},
})
// We report nodes for all peers (not just the current node) to highlight peers not monitored by Scope
// (i.e. without a running probe)
// Note: this will cause redundant information (n^2) if all peers have a running probe
for _, peer := range w.statusCache.Router.Peers {
node := report.MakeNodeWith(report.MakeOverlayNodeID(report.WeaveOverlayPeerPrefix, peer.Name),
map[string]string{
WeavePeerName: peer.Name,
WeavePeerNickName: peer.NickName,
})
// Peer corresponding to current host
if peer.Name == w.statusCache.Router.Name {
node = node.WithLatest(report.HostNodeID, mtime.Now(), w.hostID)
node = node.WithLatest(WeaveVersion, mtime.Now(), w.statusCache.Version)
node = node.WithParents(report.EmptySets.Add(report.Host, report.MakeStringSet(w.hostID)))
}
for _, conn := range peer.Connections {

View File

@@ -23,6 +23,9 @@ func MapWeaveIdentity(m report.Node, _ report.Networks) report.Nodes {
nickname, _ = m.Latest.Lookup(overlay.WeavePeerNickName)
)
// Nodes without a host id indicate they are not monitored by Scope
// (their info doesn't come from a probe monitoring that peer directly)
// , display them as pseudo nodes.
if _, ok := node.Latest.Lookup(report.HostNodeID); !ok {
id := MakePseudoNodeID(UnmanagedID, nickname)
node = NewDerivedPseudoNode(id, m)