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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Fri Nov 2 10:37:55 EDT 2007


Author: justi9
Date: 2007-11-02 10:37:54 -0400 (Fri, 02 Nov 2007)
New Revision: 1211

Modified:
   mgmt/cumin/python/cumin/demo.py
   mgmt/cumin/python/cumin/model.py
   mgmt/cumin/python/cumin/page.strings
   mgmt/cumin/python/cumin/queue.py
   mgmt/cumin/python/cumin/queue.strings
   mgmt/cumin/python/cumin/util.py
   mgmt/notes/justin-todo.txt
Log:
Makes queue status contain the properties displayed in the queue list
at the broker level.  Removes the older set of dummy data values.



Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py	2007-11-02 13:45:22 UTC (rev 1210)
+++ mgmt/cumin/python/cumin/demo.py	2007-11-02 14:37:54 UTC (rev 1211)
@@ -187,10 +187,6 @@
             mobject.unlock()
 
     def frob_measure(self, measure):
-        # XXX if the class_ is set, we are using real data
-        if measure.class_:
-            return
-        
         if measure.type == "int":
             if random() < 0.5:
                 if random() < 0.66:

Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py	2007-11-02 13:45:22 UTC (rev 1210)
+++ mgmt/cumin/python/cumin/model.py	2007-11-02 14:37:54 UTC (rev 1211)
@@ -352,8 +352,15 @@
 
     # get recent values, with latest value at index 0
     def get_values(self, limit=100):
-        values = self.__values[-limit:]
-        values.reverse()
+        if len(self.__values) == 0:
+            values = [0, 0]
+        else:
+            values = self.__values[-limit:]
+            values.reverse()
+
+            if len(values) == 1:
+                values.append(0)
+
         return values
 
     def get_rate(self, interval=3):
@@ -381,10 +388,6 @@
         self.is_auto_delete = False
         self.latency_priority = "m" # h, m, or l
 
-        self.message_count = 41
-        self.error_count = 0
-        self.warning_count = 0
-
         self.errors = list()
         self.warnings = list()
 

Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings	2007-11-02 13:45:22 UTC (rev 1210)
+++ mgmt/cumin/python/cumin/page.strings	2007-11-02 14:37:54 UTC (rev 1211)
@@ -395,7 +395,7 @@
   float: right;
   margin: 0.5em;
   padding: 0.75em 1em;
-  width: 15em;
+  width: 18em;
 }
 
 div.mstatus h2 {
@@ -418,6 +418,16 @@
   background-color: #cfc;
 }
 
+div.mstatus table {
+  width: 100%;
+  font-size: 0.9em;
+}
+
+div.mstatus table th, div.mstatus table td {
+  font-weight: normal;
+  text-align: left;
+}
+
 div.statuslight {
   float: left;
   width: 1em;
@@ -522,7 +532,7 @@
   width: 100%;
 }
 
-.ralign, table.mobjects .ralign {
+.ralign, table.mobjects .ralign, div.mstatus table .ralign {
   text-align: right;
 }
 

Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py	2007-11-02 13:45:22 UTC (rev 1210)
+++ mgmt/cumin/python/cumin/queue.py	2007-11-02 14:37:54 UTC (rev 1211)
@@ -116,28 +116,60 @@
 
 class QueueStatus(Widget):
     def render_class(self, session, queue):
-        if queue.error_count:
+        if queue.errors:
             return "QueueStatus red"
-        elif queue.warning_count:
+        elif queue.warnings:
             return "QueueStatus yellow"
         else:
             return "QueueStatus green"
 
     def render_url(self, session, queue):
         return "queue.xml?id=%i" % queue.id
-    
-    def render_message_info(self, session, queue):
-        return "%i %s in queue" % \
-               (queue.message_count,
-                queue.message_count == 1 and "message" or "messages")
 
-    def render_error_info(self, session, queue):
-        return "%i %s, %i %s" % \
-               (queue.error_count,
-                queue.error_count == 1 and "error" or "errors",
-                queue.warning_count,
-                queue.warning_count == 1 and "warning" or "warnings")
+    def render_consumers(self, session, queue):
+        return queue.get_measurement("consumers").get_value()
 
+    def render_message_enqueues(self, session, queue):
+        value = queue.get_measurement("msgTotalEnqueues").get_rate()
+        return rate(value, "msg", "sec")
+
+    def render_message_dequeues(self, session, queue):
+        value = queue.get_measurement("msgTotalDequeues").get_rate()
+        return rate(value, "msg", "sec")
+
+    def render_message_depth(self, session, queue):
+        return queue.get_measurement("msgDepth").get_value()
+
+    def render_message_depth_ratio(self, session, queue):
+        curr, prev = queue.get_measurement("msgDepth").get_values(2)
+
+        if prev != 0:
+            return "%0.00f" % (curr / float(prev))
+
+    def render_byte_enqueues(self, session, queue):
+        value = queue.get_measurement("byteTotalEnqueues").get_rate()
+        return rate(value, "byte", "sec")
+
+    def render_byte_dequeues(self, session, queue):
+        value = queue.get_measurement("byteTotalDequeues").get_rate()
+        return rate(value, "byte", "sec")
+
+    def render_byte_depth(self, session, queue):
+        return queue.get_measurement("byteDepth").get_value()
+
+    def render_byte_depth_ratio(self, session, queue):
+        curr, prev = queue.get_measurement("byteDepth").get_values(2)
+
+        if prev != 0:
+            return "%0.00f" % (curr / float(prev))
+
+#     def render_error_info(self, session, queue):
+#         return "%i %s, %i %s" % \
+#                (queue.error_count,
+#                 queue.error_count == 1 and "error" or "errors",
+#                 queue.warning_count,
+#                 queue.warning_count == 1 and "warning" or "warnings")
+
 class QueueView(Widget):
     def __init__(self, app, name):
         super(QueueView, self).__init__(app, name)

Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings	2007-11-02 13:45:22 UTC (rev 1210)
+++ mgmt/cumin/python/cumin/queue.strings	2007-11-02 14:37:54 UTC (rev 1211)
@@ -117,14 +117,45 @@
         divs.next().set(errors + ", " + warnings);
     }
 
-    wooly.setIntervalUpdate("{id}", "{url}", updateStatus, 3000);
+    //wooly.setIntervalUpdate("{id}", "{url}", updateStatus, 3000);
 }())
 </script>
 <div class="{class} mstatus" id="{id}">
   <h2>Queue Status</h2>
 
+<!--
   <div>{message_info}</div>
   <div>{error_info}</div>
+  <div>{consumers}</div>
+-->
+
+  <table>
+    <tr>
+      <th></th>
+      <th style="width: 35%;" class="ralign">Messages</th>
+      <th style="width: 35%;" class="ralign">Bytes</th>
+    </tr>
+    <tr>
+      <th>Enqueues</th>
+      <td class="ralign">{message_enqueues}</td>
+      <td class="ralign">{byte_enqueues}</td>
+    </tr>
+    <tr>
+      <th>Dequeues</th>
+      <td class="ralign">{message_dequeues}</td>
+      <td class="ralign">{byte_dequeues}</td>
+    </tr>
+    <tr>
+      <th>Depth</th>
+      <td class="ralign">{message_depth}</td>
+      <td class="ralign">{byte_depth}</td>
+    </tr>
+    <tr>
+      <th>Ratio</th>
+      <td class="ralign">{message_depth_ratio}</td>
+      <td class="ralign">{byte_depth_ratio}</td>
+    </tr>
+  </table>
 </div>
 
 [QueueView.html]

Modified: mgmt/cumin/python/cumin/util.py
===================================================================
--- mgmt/cumin/python/cumin/util.py	2007-11-02 13:45:22 UTC (rev 1210)
+++ mgmt/cumin/python/cumin/util.py	2007-11-02 14:37:54 UTC (rev 1211)
@@ -3,3 +3,9 @@
 
 def ess(num, ending="s"):
     return num != 1 and ending or ""
+
+def nvl(expr1, expr2):
+    if expr1 == None:
+        return expr2
+    else:
+        return expr1

Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt	2007-11-02 13:45:22 UTC (rev 1210)
+++ mgmt/notes/justin-todo.txt	2007-11-02 14:37:54 UTC (rev 1211)
@@ -8,12 +8,8 @@
 
  * exch: link bindings, producers stats to respective views
 
- * Make status boxes display stats like those from list views
+ * Make queue status ajaxy again
 
-   - model: get rid of the old *_count stat fields and use the new ones
-
- * Right align status boxes?
-
 Deferred
 
  * Queue: Add created, deleted, updated timestamps




More information about the rhmessaging-commits mailing list