Author: justi9
Date: 2008-04-15 16:15:25 -0400 (Tue, 15 Apr 2008)
New Revision: 1917
Modified:
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/stat.strings
Log:
bz438224 - Add enqueue and dequeue rate charts.
This change also starts a reorganization of stats.
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-04-15 17:56:07 UTC (rev 1916)
+++ mgmt/cumin/python/cumin/queue.py 2008-04-15 20:15:25 UTC (rev 1917)
@@ -231,7 +231,7 @@
self.__tabs = TabbedModeSet(app, "tabs")
self.add_child(self.__tabs)
- self.__tabs.add_tab(QueueStatistics(app, "stats"))
+ self.__tabs.add_tab(QueueStats(app, "stats"))
self.__bindings = QueueBindingSet(app, "bindings")
self.__tabs.add_tab(self.__bindings)
@@ -424,48 +424,55 @@
def render_cancel_content(self, session, binding):
return "No, Cancel"
-class QueueStatistics(TabbedModeSet):
+class QueueStats(TabbedModeSet):
def __init__(self, app, name):
- super(QueueStatistics, self).__init__(app, name)
+ super(QueueStats, self).__init__(app, name)
- self.add_tab(self.StatisticsCurrent(app, "current"))
- self.add_tab(self.StatisticsHistory(app, "history"))
+ self.add_tab(GeneralQueueStats(app, "general"))
def render_title(self, session):
return "Statistics"
- class StatisticsCurrent(Widget):
- def __init__(self, app, name):
- super(QueueStatistics.StatisticsCurrent, self).__init__(app, name)
+class GeneralQueueStats(Widget):
+ def __init__(self, app, name):
+ super(GeneralQueueStats, self).__init__(app, name)
- self.add_child(StatSet(app, "general", "general"))
- self.add_child(StatSet(app, "disk", "disk"))
- self.add_child(StatSet(app, "transactional",
"transactional"))
- self.add_child(StatSet(app, "persistent", "persistent"))
- self.add_child(StatSet(app, "transaction",
"transaction"))
+ self.add_child(StatSet(app, "general", "general"))
+ self.add_child(StatSet(app, "disk", "disk"))
- def render_title(self, session):
- return "Current"
+ chart = self.EnqueueDequeueRateChart(app, "enqdeq")
+ self.add_child(chart)
- class StatisticsHistory(Widget):
+ chart = self.DepthChart(app, "depth")
+ self.add_child(chart)
+
+ chart = StatValueChart(app, "consumers")
+ chart.stats = ("consumers",)
+ self.add_child(chart)
+
+ def render_title(self, session):
+ return "General"
+
+ class EnqueueDequeueRateChart(StatValueChart):
def __init__(self, app, name):
- super(QueueStatistics.StatisticsHistory, self).__init__(app, name)
+ super(GeneralQueueStats.EnqueueDequeueRateChart, self).__init__ \
+ (app, name)
- chart = StatValueChart(app, "mdepth")
- chart.stats = ("msgDepth",)
- self.add_child(chart)
+ self.stats = ("msgTotalEnqueues", "msgTotalDequeues")
+ self.mode = "rate"
- chart = StatValueChart(app, "bdepth")
- chart.stats = ("byteDepth",)
- self.add_child(chart)
+ def render_title(self, session, queue):
+ return "Enqueues and Dequeues per Second"
- chart = StatValueChart(app, "consumers")
- chart.stats = ("consumers",)
- self.add_child(chart)
+ class DepthChart(StatValueChart):
+ def __init__(self, app, name):
+ super(GeneralQueueStats.DepthChart, self).__init__(app, name)
- def render_title(self, session):
- return "History"
+ self.stats = ("msgDepth",)
+ def render_title(self, session, queue):
+ return "Queue Depth"
+
class QueueConsumerSet(PaginatedItemSet):
def get_args(self, session):
return self.frame.get_args(session)
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2008-04-15 17:56:07 UTC (rev 1916)
+++ mgmt/cumin/python/cumin/queue.strings 2008-04-15 20:15:25 UTC (rev 1917)
@@ -181,38 +181,26 @@
}())
</script>
-[QueueStatistics.html]
+[QueueStats.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}
- <h2>Persistent Messages</h2>
- {persistent}
- </td>
- <td class="twocol">
- <h2>Transactional Messages</h2>
- {transactional}
- <h2>Transactions</h2>
- {transaction}
- </td>
- </tr>
-</table>
+[GeneralQueueStats.html]
+<div class="rfloat" style="width: 50%">
+ {enqdeq}
-[StatisticsHistory.html]
-<h2>Message Depth</h2>
-<div class="iblock chart">{mdepth}</div>
+ {depth}
-<h2>Byte Depth</h2>
-<div class="iblock chart">{bdepth}</div>
+ {consumers}
+</div>
-<h2>Consumers</h2>
-<div class="iblock chart">{consumers}</div>
+{general}
+<br/>
+<br/>
+<br/>
+<br/>
+
[QueueConsumerSet.html]
<div class="sactions">
<h2>Act on Selected Consumers:</h2>
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-04-15 17:56:07 UTC (rev 1916)
+++ mgmt/cumin/python/cumin/stat.py 2008-04-15 20:15:25 UTC (rev 1917)
@@ -105,6 +105,10 @@
return "stats.png?" + ";".join(params)
+ def render_title(self, session, object):
+ cls = self.app.model.get_class_by_object(object)
+ return getattr(cls, self.stats[0]).title
+
def render_stats(self, session, object):
writer = Writer()
Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings 2008-04-15 17:56:07 UTC (rev 1916)
+++ mgmt/cumin/python/cumin/stat.strings 2008-04-15 20:15:25 UTC (rev 1917)
@@ -41,8 +41,31 @@
}
}
+[StatSet.css]
+table.StatSet {
+ width: 25em;
+ border-collapse: collapse;
+ margin: 0.5em;
+}
+
+table.StatSet tr {
+ border-top: 1px dotted #ccc;
+ vertical-align: top;
+}
+
+table.StatSet td {
+ padding: 0.35em 0.5em;
+}
+
+table.StatSet th {
+ padding: 0.35em 0.5em;
+ text-align: left;
+ font-weight: normal;
+ background-color: #f7f7f7;
+}
+
[StatSet.html]
-<table id="{id}" class="mobjects">
+<table id="{id}" class="StatSet">
<tr>
<th style="width: 45%;">Statistic</th>
<th style="width: 20%;" class="ralign">Current</th>
@@ -79,6 +102,7 @@
img.setattr("src", src);
+/*
var ph = chart.elem("span", "class", "ph")
var statname = ph.getattr("statname")
var statmode = ph.getattr("statmode")
@@ -87,32 +111,40 @@
} else {
ph.text().set(object.stat[statname].value)
}
+*/
}
[StatValueChart.css]
-table.StatValueChart {
+div.StatValueChart {
font-size: 0.9em;
+ margin: 0 0 1em 1em;
+ width: 30em;
}
-table.StatValueChart span.swatch {
- padding: 0 0.4em;
+div.StatValueChart h2 {
+ margin: 0;
}
-table.StatValueChart ul.radiotabs li {
- display: block;
+div.StatValueChart div.duration {
+ margin: 1em 1em 0.5em 1em;
}
+div.StatValueChart ul.radiotabs {
+ margin: 0;
+}
+
+div.StatValueChart img {
+ margin: 0 1em;
+}
+
[StatValueChart.html]
-<table class="StatValueChart" id="{id}">
- <tr>
- <td><img id="{id}" src="{href}" height="100"
width="360"/></td>
- <td>
- <ul>{stats}</ul>
- <br/>
- {duration}
- </td>
- </tr>
-</table>
+<div class="StatValueChart" id="{id}">
+ <h2>{title}</h2>
+
+ <div class="duration">{duration}</div>
+
+ <img id="{id}" src="{href}" height="100"
width="360"/>
+</div>
<script>
cumin.objectListeners["{id}"] = updateChart
</script>