[rhmessaging-commits] rhmessaging commits: r1791 - in mgmt: notes and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Mar 24 17:32:40 EDT 2008


Author: justi9
Date: 2008-03-24 17:32:40 -0400 (Mon, 24 Mar 2008)
New Revision: 1791

Modified:
   mgmt/cumin/python/cumin/client.py
   mgmt/cumin/python/cumin/client.strings
   mgmt/cumin/python/cumin/exchange.py
   mgmt/cumin/python/cumin/exchange.strings
   mgmt/cumin/python/cumin/model.py
   mgmt/cumin/python/cumin/queue.py
   mgmt/cumin/python/cumin/queue.strings
   mgmt/cumin/python/cumin/widgets.py
   mgmt/notes/justin-todo.txt
Log:
bz435989 - Don't display stale rate data in tables or stat readouts.

Introduces a reusable column object, FreshDataOnlyColumn, to implement
this behavior in tables.



Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py	2008-03-24 21:28:20 UTC (rev 1790)
+++ mgmt/cumin/python/cumin/client.py	2008-03-24 21:32:40 UTC (rev 1791)
@@ -99,7 +99,7 @@
             #return fmt_link(branch.marshal(), client.sessions.count())
             return "XXX"
 
-    class SentColumn(NullSortColumn):
+    class SentColumn(NullSortColumn, FreshDataOnlyColumn):
         def render_title(self, session, data):
             return "%s Sent" % self.parent.get_unit_plural(session)
 
@@ -110,7 +110,7 @@
         def render_value(self, session, value):
             return fmt_rate(value, "", "sec")
 
-    class ReceivedColumn(NullSortColumn):
+    class ReceivedColumn(NullSortColumn, FreshDataOnlyColumn):
         def render_title(self, session, data):
             return "%s Received" % self.parent.get_unit_plural(session)
 

Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings	2008-03-24 21:28:20 UTC (rev 1790)
+++ mgmt/cumin/python/cumin/client.strings	2008-03-24 21:32:40 UTC (rev 1791)
@@ -13,7 +13,8 @@
   case when p.bytes_to_client is null then true else false end as br_is_null,
   (c.frames_to_client - p.frames_to_client)
    / (extract(epoch from (c.rec_time - p.rec_time)) + 0.0001) as fr,
-  case when p.frames_to_client is null then true else false end as fr_is_null
+  case when p.frames_to_client is null then true else false end as fr_is_null,
+  c.rec_time
 from client as l
 left outer join client_stats as c on c.id = l.stats_curr_id
 left outer join client_stats as p on p.id = l.stats_prev_id

Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py	2008-03-24 21:28:20 UTC (rev 1790)
+++ mgmt/cumin/python/cumin/exchange.py	2008-03-24 21:32:40 UTC (rev 1791)
@@ -116,7 +116,7 @@
             frame.show_view(branch).show_bindings(branch)
             return fmt_link(branch.marshal(), data["bindings"])
 
-    class ReceivedColumn(NullSortColumn):
+    class ReceivedColumn(NullSortColumn, FreshDataOnlyColumn):
         def render_title(self, session, data):
             return "%s Received" % self.parent.unit.get_brief_plural(session)
 
@@ -127,7 +127,7 @@
         def render_value(self, session, value):
             return fmt_rate(value, "", "sec")
 
-    class RoutedColumn(NullSortColumn):
+    class RoutedColumn(NullSortColumn, FreshDataOnlyColumn):
         def render_title(self, session, data):
             return "%s Routed" % self.parent.unit.get_brief_plural(session)
 

Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings	2008-03-24 21:28:20 UTC (rev 1790)
+++ mgmt/cumin/python/cumin/exchange.strings	2008-03-24 21:32:40 UTC (rev 1791)
@@ -23,7 +23,8 @@
    / (extract(epoch from (c.rec_time - p.rec_time)) + 0.0001) as brouted,
   case when p.byte_routes is null then true else false end as brouted_is_null,
   c.msg_drops as mdropped,
-  c.byte_drops as bdropped
+  c.byte_drops as bdropped,
+  c.rec_time
 from exchange as e
 left outer join exchange_stats as c on c.id = e.stats_curr_id
 left outer join exchange_stats as p on p.id = e.stats_prev_id

Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py	2008-03-24 21:28:20 UTC (rev 1790)
+++ mgmt/cumin/python/cumin/model.py	2008-03-24 21:32:40 UTC (rev 1791)
@@ -220,8 +220,10 @@
         return text
 
     def rate(self, object):
+        threshold = datetime.now() - timedelta(minutes=10)
+
         try:
-            if object.statsCurr:
+            if object.statsCurr and object.statsCurr.recTime > threshold:
                 curr = getattr(object.statsCurr, self.name)
                 ctime = object.statsCurr.recTime
                 csecs = mktime(ctime.timetuple())

Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py	2008-03-24 21:28:20 UTC (rev 1790)
+++ mgmt/cumin/python/cumin/queue.py	2008-03-24 21:32:40 UTC (rev 1791)
@@ -123,7 +123,7 @@
             frame.show_view(branch).show_bindings(branch)
             return fmt_link(branch.marshal(), data["bindings"])
 
-    class EnqueuedColumn(NullSortColumn):
+    class EnqueuedColumn(NullSortColumn, FreshDataOnlyColumn):
         def render_title(self, session, data):
             return "%s Enqueued" % self.parent.unit.get_brief_plural(session)
 
@@ -134,7 +134,7 @@
         def render_value(self, session, value):
             return fmt_rate(value, "", "sec")
 
-    class DequeuedColumn(NullSortColumn):
+    class DequeuedColumn(NullSortColumn, FreshDataOnlyColumn):
         def render_title(self, session, data):
             return "%s Dequeued" % self.parent.unit.get_brief_plural(session)
 

Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings	2008-03-24 21:28:20 UTC (rev 1790)
+++ mgmt/cumin/python/cumin/queue.strings	2008-03-24 21:32:40 UTC (rev 1791)
@@ -19,7 +19,8 @@
   c.msg_depth as mdepth,
   c.byte_depth as bdepth,
   1 as mdepthaccel,
-  1 as bdepthaccel
+  1 as bdepthaccel,
+  c.rec_time
 from queue as q
 left outer join queue_stats as c on c.id = q.stats_curr_id
 left outer join queue_stats as p on p.id = q.stats_prev_id

Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py	2008-03-24 21:28:20 UTC (rev 1790)
+++ mgmt/cumin/python/cumin/widgets.py	2008-03-24 21:32:40 UTC (rev 1791)
@@ -1,3 +1,4 @@
+from datetime import datetime, timedelta
 from math import ceil
 from sqlobject import sqlhub
 from sqlobject.sresults import SelectResults
@@ -444,6 +445,27 @@
             dir = self.parent.is_reversed(session) and "desc" or "asc"
             return "order by %s_is_null asc, %s %s" % (key, key, dir)
 
+class FreshDataOnlyColumn(SqlTableColumn):
+    def __init__(self, app, name):
+        super(FreshDataOnlyColumn, self).__init__(app, name)
+
+        self.__ago = self.TimeAgo(app, "ago")
+        self.add_attribute(self.__ago)
+
+    def render_content(self, session, data):
+        key = self.get_column_key(session)
+
+        if data["rec_time"] > self.__ago.get(session):
+            html = self.render_value(session, data[key])
+        else:
+            html = fmt_none_brief()
+
+        return html
+
+    class TimeAgo(Attribute):
+        def get_default(self, session):
+            return datetime.now() - timedelta(minutes=10)
+
 class PaginatedItemSet(ItemSet):
     def __init__(self, app, name):
         super(PaginatedItemSet, self).__init__(app, name)

Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt	2008-03-24 21:28:20 UTC (rev 1790)
+++ mgmt/notes/justin-todo.txt	2008-03-24 21:32:40 UTC (rev 1791)
@@ -8,14 +8,14 @@
 
  * Don't let anyone close mgmt clients
 
-   - Waiting on an api change from Ted
-
  * Put some kind of status on broker
 
- * Gray out old rates
-
  * Make it possible to navigate from broker to system
 
+ * Update the README
+
+ * Fix the status box updates, to avoid the "/sec" display
+
 Deferred
 
  * Blow up if we try to call set_redirect_url twice in a session




More information about the rhmessaging-commits mailing list