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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Oct 22 16:25:38 EDT 2007


Author: justi9
Date: 2007-10-22 16:25:38 -0400 (Mon, 22 Oct 2007)
New Revision: 1138

Modified:
   mgmt/cumin/python/cumin/demo.py
   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
Log:
Adds some instrum props that were missing from exchange and queue.



Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py	2007-10-22 18:37:35 UTC (rev 1137)
+++ mgmt/cumin/python/cumin/demo.py	2007-10-22 20:25:38 UTC (rev 1138)
@@ -154,24 +154,43 @@
 
         self.model = model
         self.setDaemon(True)
-    
+
+    def frob_measure(self, measure):
+        if measure.type == "int" and random() < 0.33:
+            if random() < 0.5:
+                value = measure.get_value()
+                measure.add_value(value + randint(4, 12))
+            else:
+                value = measure.get_value() - randint(3, 9)
+                measure.add_value(value > 0 and value or 0)
+
     def run(self):
         while True:
             sleep(1)
 
             for server in self.model.get_servers():
                 for vhost in server.virtual_host_items():
+                    for exchange in vhost.exchange_items():
+                        exchange.lock()
+                        try:
+                            for measure in exchange.measurements:
+                                self.frob_measure(measure)
+                        finally:
+                            exchange.unlock()
+
+                        for binding in exchange.binding_items():
+                            binding.lock()
+                            try:
+                                for measure in binding.measurements:
+                                    self.frob_measure(measure)
+                            finally:
+                                binding.unlock()
+                    
                     for queue in vhost.queue_items():
                         queue.lock()
                         try:
                             for measure in queue.measurements:
-                                if measure.type == "int" and random() < 0.33:
-                                    if random() < 0.5:
-                                        value = measure.get_value()
-                                        measure.add_value(value + randint(4, 12))
-                                    else:
-                                        value = measure.get_value() - randint(3, 9)
-                                        measure.add_value(value > 0 and value or 0)
+                                self.frob_measure(measure)
 
                             queue.message_count += 1
 

Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py	2007-10-22 18:37:35 UTC (rev 1137)
+++ mgmt/cumin/python/cumin/exchange.py	2007-10-22 20:25:38 UTC (rev 1138)
@@ -112,6 +112,9 @@
     def render_item_routing_key(self, session, binding):
         return binding.routing_key
 
+    def render_item_messages_matched(self, session, binding):
+        return binding.get_measurement("msgMatched").get_value()
+
 class ExchangeForm(CuminForm):
     def __init__(self, app, name):
         super(ExchangeForm, self).__init__(app, name)

Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings	2007-10-22 18:37:35 UTC (rev 1137)
+++ mgmt/cumin/python/cumin/exchange.strings	2007-10-22 20:25:38 UTC (rev 1138)
@@ -96,6 +96,7 @@
   <tr>
     <th>Queue</th>
     <th>Routing Key</th>
+    <th style="text-align: right;">Messages Matched</th>
   </tr>
 
   {items}
@@ -105,6 +106,7 @@
 <tr>
   <td><a href="{item_href}">Queue '{item_name}'</a></td>
   <td>{item_routing_key}</td>
+  <td style="text-align: right;">{item_messages_matched}</td>
 </tr>
 
 [ExchangeStatistics.html]

Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py	2007-10-22 18:37:35 UTC (rev 1137)
+++ mgmt/cumin/python/cumin/model.py	2007-10-22 20:25:38 UTC (rev 1138)
@@ -368,6 +368,11 @@
         measure.highlow = True
         self.measurements.append(measure)
 
+        measure = Measurement("unackedMessages", "int")
+        measure.title = "Unacknowledged messages"
+        measure.categories = ("general")
+        self.measurements.append(measure)
+
         # Disk
 
         #measure = Measurement("diskPageSize", "int")
@@ -471,6 +476,11 @@
         measure.categories = ("byte", "persistent")
         self.measurements.append(measure)
 
+    def get_measurement(self, name):
+        for measure in self.measurements:
+            if measure.name == name:
+                return measure
+
     def remove(self):
         for binding in self.binding_items().copy():
             binding.remove()
@@ -516,36 +526,41 @@
         measure.highlow = True
         self.measurements.append(measure)
 
-        measure = Measurement("bindings", "int")
+        measure = Measurement("msgReceives", "int")
         measure.title = "Messages received"
         measure.categories = ("message", "general")
         self.measurements.append(measure)
 
-        measure = Measurement("bindings", "int")
+        measure = Measurement("msgDrops", "int")
         measure.title = "Messages dropped"
         measure.categories = ("message", "general")
         self.measurements.append(measure)
 
-        measure = Measurement("bindings", "int")
-        measure.title = "Messages enqueued"
+        measure = Measurement("msgRoutes", "int")
+        measure.title = "Messages routed"
         measure.categories = ("message", "general")
         self.measurements.append(measure)
 
-        measure = Measurement("bindings", "int")
+        measure = Measurement("byteReceives", "int")
         measure.title = "Bytes received"
         measure.categories = ("byte", "general")
         self.measurements.append(measure)
 
-        measure = Measurement("bindings", "int")
+        measure = Measurement("byteDrops", "int")
         measure.title = "Bytes dropped"
         measure.categories = ("byte", "general")
         self.measurements.append(measure)
 
-        measure = Measurement("bindings", "int")
-        measure.title = "Bytes enqueued"
+        measure = Measurement("byteRoutes", "int")
+        measure.title = "Bytes routed"
         measure.categories = ("byte", "general")
         self.measurements.append(measure)
 
+    def get_measurement(self, name):
+        for measure in self.measurements:
+            if measure.name == name:
+                return measure
+
     def remove(self):
         for binding in self.binding_items().copy():
             binding.remove()
@@ -572,6 +587,18 @@
 
         self.routing_key = None
 
+        self.measurements = list()
+
+        measure = Measurement("msgMatched", "int")
+        measure.title = "Messages matched"
+        measure.categories = ("message", "general")
+        self.measurements.append(measure)
+
+    def get_measurement(self, name):
+        for measure in self.measurements:
+            if measure.name == name:
+                return measure
+
     def write_xml(self, writer):
         writer.write("<binding id=\"binding-%i\">" % self.id)
         writer.write("<exchange ref=\"exchange-%i\"/>" % self.exchange.id)

Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py	2007-10-22 18:37:35 UTC (rev 1137)
+++ mgmt/cumin/python/cumin/queue.py	2007-10-22 20:25:38 UTC (rev 1138)
@@ -135,16 +135,15 @@
         self.page().show_exchange(branch, binding.get_exchange())
         return branch.marshal()
     
-    def render_item_remove_href(self, session, binding):
-        branch = session.branch()
-        return branch.marshal()
-    
     def render_item_name(self, session, binding):
         return binding.get_exchange().name
 
     def render_item_routing_key(self, session, binding):
         return binding.routing_key
 
+    def render_item_messages_matched(self, session, binding):
+        return binding.get_measurement("msgMatched").get_value()
+
 class QueueForm(CuminForm):
     def __init__(self, app, name):
         super(QueueForm, self).__init__(app, name)

Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings	2007-10-22 18:37:35 UTC (rev 1137)
+++ mgmt/cumin/python/cumin/queue.strings	2007-10-22 20:25:38 UTC (rev 1138)
@@ -122,6 +122,7 @@
   <tr>
     <th>Exchange</th>
     <th>Routing Key</th>
+    <th style="text-align: right;">Messages Matched</th>
   </tr>
 
   {items}
@@ -131,6 +132,7 @@
 <tr>
   <td><a href="{item_href}">Exchange '{item_name}'</a></td>
   <td>{item_routing_key}</td>
+  <td style="text-align: right;">{item_messages_matched}</td>
 </tr>
 
 [QueueBindingAdd.html]




More information about the rhmessaging-commits mailing list