You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2016/11/28 19:13:42 UTC
qpid-dispatch git commit: DISPATCH-113 - From Mick Goulish - Added
last-topology-change time in qdstat. This closes #117.
Repository: qpid-dispatch
Updated Branches:
refs/heads/master 2d1bd7fb0 -> cb0a14ba2
DISPATCH-113 - From Mick Goulish - Added last-topology-change time in qdstat. This closes #117.
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/cb0a14ba
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/cb0a14ba
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/cb0a14ba
Branch: refs/heads/master
Commit: cb0a14ba26efe0b3c85834129fe89598548310a4
Parents: 2d1bd7f
Author: Ted Ross <tr...@redhat.com>
Authored: Mon Nov 28 14:12:55 2016 -0500
Committer: Ted Ross <tr...@redhat.com>
Committed: Mon Nov 28 14:12:55 2016 -0500
----------------------------------------------------------------------
python/qpid_dispatch/management/qdrouter.json | 5 +++++
python/qpid_dispatch_internal/router/node.py | 5 +++--
tools/qdstat | 14 ++++++++++++--
3 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/cb0a14ba/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json
index 39af630..741ad0f 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -1225,7 +1225,12 @@
"cost": {
"description": "Reachability cost",
"type": "integer"
+ },
+ "lastTopoChange": {
+ "description": "Timestamp showing the most recent change to this node's neighborhood.",
+ "type": "integer"
}
+
}
},
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/cb0a14ba/python/qpid_dispatch_internal/router/node.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/router/node.py b/python/qpid_dispatch_internal/router/node.py
index 231e3f2..9822169 100644
--- a/python/qpid_dispatch_internal/router/node.py
+++ b/python/qpid_dispatch_internal/router/node.py
@@ -59,7 +59,8 @@ class NodeTracker(object):
"linkState": [ls for ls in self.link_state.peers], # List of neighbour nodes
"nextHop": "(self)",
"validOrigins": [],
- "address": Address.topological(self.my_id, area=self.container.area)
+ "address": Address.topological(self.my_id, area=self.container.area),
+ "lastTopoChange" : self.last_topology_change
})
@@ -123,7 +124,7 @@ class NodeTracker(object):
## Enter flux mode if things are changing
##
if self.link_state_changed or self.recompute_topology:
- self.last_topology_change = now
+ self.last_topology_change = int(round(now))
if not self.flux_mode:
self.flux_mode = True
self.container.log(LOG_TRACE, "Entered Router Flux Mode")
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/cb0a14ba/tools/qdstat
----------------------------------------------------------------------
diff --git a/tools/qdstat b/tools/qdstat
index 546c243..1e8ced3 100755
--- a/tools/qdstat
+++ b/tools/qdstat
@@ -25,7 +25,7 @@ import sys
import locale
import socket
import re
-from time import ctime
+from time import ctime, strftime, gmtime
import qpid_dispatch_site
from qpid_dispatch.management.client import Url, Node, Entity
from qpid_dispatch_internal.management.qdrouter import QdSchema
@@ -296,13 +296,19 @@ class BusManager(Node):
heads.append(Header("valid-origins"))
rows = []
- cols = ('id', 'nextHop', 'routerLink')
+ cols = ('id', 'nextHop', 'routerLink', 'lastTopoChange')
if self.opts.verbose:
cols += ('cost', 'linkState', 'validOrigins')
objects = self.query('org.apache.qpid.dispatch.router.node', cols)
+ # Find the most recent topo change in this neighborhood.
+ lastTopoChange = 0.0
+
for node in objects:
row = []
+ if node.lastTopoChange:
+ if float(node.lastTopoChange) > lastTopoChange:
+ lastTopoChange = float(node.lastTopoChange)
row.append(node.id)
if node.nextHop != None:
row.append(node.nextHop)
@@ -318,6 +324,10 @@ class BusManager(Node):
rows.append(row)
if len(rows) > 0:
title = "Routers in the Network"
+ # Use gmtime to make times comparable across large networks.
+ if lastTopoChange > 1.0:
+ topoLine = "\nLast Topology Change: " + strftime('%A %b %d %H:%M:%S %Y',gmtime(lastTopoChange)) + " GMT"
+ title += topoLine
sort = Sorter(heads, rows, 'router-id')
dispRows = sort.getSorted()
disp.formattedTable(title, heads, dispRows)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org