Author: justi9
Date: 2007-10-22 14:37:35 -0400 (Mon, 22 Oct 2007)
New Revision: 1137
Modified:
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.strings
Log:
Adds statistics to the exchange view.
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-10-22 15:49:12 UTC (rev 1136)
+++ mgmt/cumin/python/cumin/exchange.py 2007-10-22 18:37:35 UTC (rev 1137)
@@ -3,6 +3,7 @@
from wooly.forms import *
from wooly.resources import *
+from measurement import *
from model import *
from widgets import *
from parameters import *
@@ -75,6 +76,7 @@
self.add_child(self.tabs)
self.tabs.add_tab(ExchangeBindingSet(app, "bindings"))
+ self.tabs.add_tab(ExchangeStatistics(app, "stats"))
def render_title(self, session, exchange):
return "Exchange '%s'" % exchange.name
@@ -230,3 +232,26 @@
def render_cancel_content(self, session, exchange):
return "No, Cancel"
+
+class ExchangeStatistics(TabSet):
+ def __init__(self, app, name):
+ super(ExchangeStatistics, self).__init__(app, name)
+
+ self.add_tab(self.StatisticsCurrent(app, "current"))
+ self.add_tab(self.StatisticsHistory(app, "history"))
+
+ def render_title(self, session, exchange):
+ return "Statistics"
+
+ class StatisticsCurrent(Widget):
+ def __init__(self, app, name):
+ super(ExchangeStatistics.StatisticsCurrent, self).__init__(app, name)
+
+ self.add_child(MeasurementSet(app, "general_stats",
"general"))
+
+ def render_title(self, session, exchange):
+ return "Current"
+
+ class StatisticsHistory(Widget):
+ def render_title(self, session, exchange):
+ return "History"
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2007-10-22 15:49:12 UTC (rev 1136)
+++ mgmt/cumin/python/cumin/exchange.strings 2007-10-22 18:37:35 UTC (rev 1137)
@@ -106,3 +106,19 @@
<td><a href="{item_href}">Queue
'{item_name}'</a></td>
<td>{item_routing_key}</td>
</tr>
+
+[ExchangeStatistics.html]
+<ul class="radiotabs tabs">{tabs}</ul>
+<div class="radiotabs mode">{mode}</div>
+
+[StatisticsCurrent.html]
+<table class="layout">
+ <tr>
+ <td class="twocol">
+ <h2>General</h2>
+ {general_stats}
+ </td>
+ <td class="twocol">
+ </td>
+ </tr>
+</table>
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-22 15:49:12 UTC (rev 1136)
+++ mgmt/cumin/python/cumin/model.py 2007-10-22 18:37:35 UTC (rev 1137)
@@ -508,6 +508,44 @@
self.is_auto_delete = False
self.is_internal = False
+ self.measurements = list()
+
+ measure = Measurement("bindings", "int")
+ measure.title = "Bindings"
+ measure.categories = ("general")
+ measure.highlow = True
+ self.measurements.append(measure)
+
+ measure = Measurement("bindings", "int")
+ measure.title = "Messages received"
+ measure.categories = ("message", "general")
+ self.measurements.append(measure)
+
+ measure = Measurement("bindings", "int")
+ measure.title = "Messages dropped"
+ measure.categories = ("message", "general")
+ self.measurements.append(measure)
+
+ measure = Measurement("bindings", "int")
+ measure.title = "Messages enqueued"
+ measure.categories = ("message", "general")
+ self.measurements.append(measure)
+
+ measure = Measurement("bindings", "int")
+ measure.title = "Bytes received"
+ measure.categories = ("byte", "general")
+ self.measurements.append(measure)
+
+ measure = Measurement("bindings", "int")
+ measure.title = "Bytes dropped"
+ measure.categories = ("byte", "general")
+ self.measurements.append(measure)
+
+ measure = Measurement("bindings", "int")
+ measure.title = "Bytes enqueued"
+ measure.categories = ("byte", "general")
+ self.measurements.append(measure)
+
def remove(self):
for binding in self.binding_items().copy():
binding.remove()
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-22 15:49:12 UTC (rev 1136)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-22 18:37:35 UTC (rev 1137)
@@ -409,6 +409,10 @@
margin: 1em;
}
+table.layout {
+ width: 100%;
+}
+
[CuminPage.html]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-10-22 15:49:12 UTC (rev 1136)
+++ mgmt/cumin/python/cumin/queue.strings 2007-10-22 18:37:35 UTC (rev 1137)
@@ -167,13 +167,8 @@
<ul class="radiotabs tabs">{tabs}</ul>
<div class="radiotabs mode">{mode}</div>
-[StatisticsCurrent.css]
-table.StatisticsCurrent {
- width: 100%;
-}
-
[StatisticsCurrent.html]
-<table class="StatisticsCurrent">
+<table class="layout">
<tr>
<td class="twocol">
<h2>General</h2>