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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Nov 26 16:09:41 EST 2007


Author: justi9
Date: 2007-11-26 16:09:41 -0500 (Mon, 26 Nov 2007)
New Revision: 1360

Modified:
   mgmt/cumin/python/cumin/exchange.py
   mgmt/cumin/python/cumin/model.py
   mgmt/cumin/python/cumin/queue.py
Log:


Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py	2007-11-26 19:21:17 UTC (rev 1359)
+++ mgmt/cumin/python/cumin/exchange.py	2007-11-26 21:09:41 UTC (rev 1360)
@@ -68,19 +68,19 @@
     def render_item_received(self, session, exchange):
         unit = self.unit.get(session)
         key = unit == "b" and "byteReceives" or "msgReceives"
-        value = getattr(exchange.stats, key)
+        value = self.app.cmodel.exchange.get_stat(key).rate(exchange)
         return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
 
     def render_item_routed(self, session, exchange):
         unit = self.unit.get(session)
         key = unit == "b" and "byteRoutes" or "msgRoutes"
-        value = getattr(exchange.stats, key)
+        value = self.app.cmodel.exchange.get_stat(key).rate(exchange)
         return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
 
     def render_item_dropped(self, session, exchange):
         unit = self.unit.get(session)
         key = unit == "b" and "byteDrops" or "msgDrops"
-        return getattr(exchange.stats, key)
+        return self.app.cmodel.exchange.get_stat(key).value(exchange)
 
     def render_item_status(self, session, exchange):
         return fmt_ostatus(exchange)
@@ -121,26 +121,26 @@
         return "exchange.xml?id=%i" % exchange.id
     
     def render_messages_received(self, session, exchange):
-        value = exchange.stats.msgReceives # XXX rate me
+        value = self.app.cmodel.exchange.get_stat("msgReceives").rate(exchange)
         return fmt_rate(value, "msg", "sec")
 
     def render_messages_routed(self, session, exchange):
-        value = exchange.stats.msgRoutes # XXX rate me
+        value = self.app.cmodel.exchange.get_stat("msgRoutes").rate(exchange)
         return fmt_rate(value, "msg", "sec")
 
     def render_messages_dropped(self, session, exchange):
-        return exchange.stats.msgDrops
+        return self.app.cmodel.exchange.get_stat("msgDrops").value(exchange)
 
     def render_bytes_received(self, session, exchange):
-        value = exchange.stats.byteReceives # XXX rate me
+        value = self.app.cmodel.exchange.get_stat("byteReceives").rate(exchange)
         return fmt_rate(value, "byte", "sec")
 
     def render_bytes_routed(self, session, exchange):
-        value = exchange.stats.byteRoutes # XXX rate me
+        value = self.app.cmodel.exchange.get_stat("byteRoutes").rate(exchange)
         return fmt_rate(value, "byte", "sec")
 
     def render_bytes_dropped(self, session, exchange):
-        return exchange.stats.byteDrops
+        return self.app.cmodel.exchange.get_stat("byteDrops").value(exchange)
 
 class ExchangeView(Widget):
     def __init__(self, app, name):

Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py	2007-11-26 19:21:17 UTC (rev 1359)
+++ mgmt/cumin/python/cumin/model.py	2007-11-26 21:09:41 UTC (rev 1360)
@@ -20,9 +20,6 @@
     def get_class(self, mint_object):
         return self.classes[mint_object.__class__]
 
-    def get_stat(self, mint_object, name):
-        return self.get_class(mint_object).get_stat(name)
-
 class CuminClass(object):
     def __init__(self, model, mint_class):
         self.model = model

Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py	2007-11-26 19:21:17 UTC (rev 1359)
+++ mgmt/cumin/python/cumin/queue.py	2007-11-26 21:09:41 UTC (rev 1360)
@@ -57,23 +57,23 @@
     def render_item_enqueued(self, session, queue):
         unit = self.unit.get(session)
         key = unit == "b" and "byteTotalEnqueues" or "msgTotalEnqueues"
-        value = getattr(queue.stats, key)
+        value = self.app.cmodel.queue.get_stat(key).rate(queue)
         return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
 
     def render_item_dequeued(self, session, queue):
         unit = self.unit.get(session)
         key = unit == "b" and "byteTotalDequeues" or "msgTotalDequeues"
-        value = getattr(queue.stats, key)
+        value = self.app.cmodel.queue.get_stat(key).rate(queue)
         return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
 
     def render_item_depth(self, session, queue):
         key = self.unit.get(session) == "b" and "byteDepth" or "msgDepth"
-        return getattr(queue.stats, key)
+        return self.app.cmodel.queue.get_stat(key).value(queue)
 
     def render_item_depth_accel(self, session, queue):
         unit = self.unit.get(session)
         key = unit == "b" and "byteDepth" or "msgDepth"
-        value = getattr(queue.stats, key)
+        value = self.app.cmodel.queue.get_stat(key).rate(queue)
         return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
 
     def render_item_status(self, session, queue):




More information about the rhmessaging-commits mailing list