[rhmessaging-commits] rhmessaging commits: r1803 - mgmt/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Mar 27 11:24:30 EDT 2008


Author: justi9
Date: 2008-03-27 11:24:30 -0400 (Thu, 27 Mar 2008)
New Revision: 1803

Modified:
   mgmt/cumin/python/cumin/broker.py
   mgmt/cumin/python/cumin/broker.strings
   mgmt/cumin/python/cumin/model.py
Log:
Add stat metadata for broker links.

Add columns using some of that data to BrokerLinkSet.



Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py	2008-03-27 14:48:15 UTC (rev 1802)
+++ mgmt/cumin/python/cumin/broker.py	2008-03-27 15:24:30 UTC (rev 1803)
@@ -130,6 +130,12 @@
         col = self.AddressColumn(app, "addr")
         self.add_column(col)
 
+        col = self.FromPeerColumn(app, "from_peer")
+        self.add_column(col)
+
+        col = self.ToPeerColumn(app, "to_peer")
+        self.add_column(col)
+
     def get_args(self, session):
         return self.frame.get_args(session)
 
@@ -149,9 +155,20 @@
         def render_title(self, session, data):
             return "Address"
 
-        def render_content(self, session, data):
-            return data[name]
+    class FromPeerColumn(NullSortColumn, FreshDataOnlyColumn):
+        def render_title(self, session, data):
+            return "Bytes from Peer"
 
+        def render_value(self, session, value):
+            return fmt_rate(value)
+
+    class ToPeerColumn(NullSortColumn, FreshDataOnlyColumn):
+        def render_title(self, session, data):
+            return "Bytes to Peer"
+
+        def render_value(self, session, value):
+            return fmt_rate(value)
+
 class BrokerFrame(CuminFrame):
     def __init__(self, app, name):
         super(BrokerFrame, self).__init__(app, name)

Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings	2008-03-27 14:48:15 UTC (rev 1802)
+++ mgmt/cumin/python/cumin/broker.strings	2008-03-27 15:24:30 UTC (rev 1803)
@@ -40,9 +40,17 @@
 </form>
 
 [BrokerLinkSet.sql]
-select l.id, l.address as addr
+select
+  l.id,
+  l.address as addr,
+  c.bytes_from_peer as from_peer,
+  case when p.bytes_from_peer is null then true else false end as from_peer_is_null,
+  c.bytes_to_peer as to_peer,
+  case when p.bytes_to_peer is null then true else false end as to_peer_is_null
 from link as l
 join vhost as v on v.id = l.vhost_id
+left outer join link_stats as c on c.id = l.stats_curr_id
+left outer join link_stats as p on p.id = l.stats_prev_id
 {sql_where}
 {sql_orderby}
 {sql_limit}

Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py	2008-03-27 14:48:15 UTC (rev 1802)
+++ mgmt/cumin/python/cumin/model.py	2008-03-27 15:24:30 UTC (rev 1803)
@@ -24,6 +24,7 @@
         CuminBinding(self)
         CuminClient(self)
         CuminSession(self)
+        CuminLink(self)
 
         CuminBrokerRegistration(self)
         CuminBrokerGroup(self)
@@ -693,6 +694,33 @@
         def do_invoke(self, object, args, completion):
             object.solicitAck(self.model.data, completion)
 
+class CuminLink(CuminClass):
+    def __init__(self, model):
+        super(CuminLink, self).__init__(model, "link", Link, LinkStats)
+
+        stat = CuminStat(self, "framesFromPeer", "int")
+        stat.title = "Frames from Peer"
+        stat.unit = "frame"
+        stat.categories = ("general")
+
+        stat = CuminStat(self, "framesToPeer", "int")
+        stat.title = "Frames to Peer"
+        stat.unit = "frame"
+        stat.categories = ("general")
+
+        stat = CuminStat(self, "bytesFromPeer", "int")
+        stat.title = "Bytes from Peer"
+        stat.unit = "byte"
+        stat.categories = ("general")
+
+        stat = CuminStat(self, "bytesToPeer", "int")
+        stat.title = "Bytes to Peer"
+        stat.unit = "byte"
+        stat.categories = ("general")
+
+    def get_title(self, session):
+        return "Broker Link"
+        
 class CuminBrokerRegistration(CuminClass):
     def __init__(self, model):
         super(CuminBrokerRegistration, self).__init__ \




More information about the rhmessaging-commits mailing list