Author: justi9
Date: 2007-11-02 11:05:32 -0400 (Fri, 02 Nov 2007)
New Revision: 1212
Modified:
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
Log:
Fixes depth acceleration calculations. Labels them as "Accel.".
Makes Measurement.get_values pad its returned set if it's too small.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-02 14:37:54 UTC (rev 1211)
+++ mgmt/cumin/python/cumin/model.py 2007-11-02 15:05:32 UTC (rev 1212)
@@ -350,27 +350,23 @@
def get_value(self):
return self.__value
- # get recent values, with latest value at index 0
+ # Get recent values, with latest value at index 0
def get_values(self, limit=100):
- if len(self.__values) == 0:
- values = [0, 0]
- else:
- values = self.__values[-limit:]
- values.reverse()
+ values = self.__values[-limit:]
+ values.reverse()
- if len(values) == 1:
+ # Pad the values if there are too few
+
+ if len(values) < limit:
+ for i in range(len(values), limit):
values.append(0)
return values
- def get_rate(self, interval=3):
- values = self.get_values(2)
+ def get_rate(self, interval=1):
+ curr, prev = self.get_values(2)
+ return (curr - prev) / float(interval)
- if len(values) > 1 and values[0] != None:
- return (values[0] - values[1]) / interval
- else:
- return 0
-
def get_high(self):
return self.__high
@@ -393,54 +389,52 @@
# General
- MgmtQueueStats = None
-
- measure = Measurement("msgDepth", "int", MgmtQueueStats)
+ measure = Measurement("msgDepth", "int")
measure.title = "Message Depth"
measure.unit = "message"
measure.categories = ("message", "general")
measure.highlow = True
self.measurements.append(measure)
- measure = Measurement("msgTotalEnqueues", "int",
MgmtQueueStats)
+ measure = Measurement("msgTotalEnqueues", "int")
measure.title = "Msgs. Enqueued"
measure.unit = "message"
measure.categories = ("message", "general")
self.measurements.append(measure)
- measure = Measurement("msgTotalDequeues", "int",
MgmtQueueStats)
+ measure = Measurement("msgTotalDequeues", "int")
measure.title = "Msgs. Dequeued"
measure.unit = "message"
measure.categories = ("message", "general")
self.measurements.append(measure)
- measure = Measurement("byteDepth", "int", MgmtQueueStats)
+ measure = Measurement("byteDepth", "int")
measure.title = "Byte Depth"
measure.unit = "byte"
measure.categories = ("byte", "general")
measure.highlow = True
self.measurements.append(measure)
- measure = Measurement("byteTotalEnqueues", "int",
MgmtQueueStats)
+ measure = Measurement("byteTotalEnqueues", "int")
measure.title = "Bytes Enqueued"
measure.unit = "byte"
measure.categories = ("byte", "general")
self.measurements.append(measure)
- measure = Measurement("byteTotalDequeues", "int",
MgmtQueueStats)
+ measure = Measurement("byteTotalDequeues", "int")
measure.title = "Bytes Dequeued"
measure.unit = "byte"
measure.categories = ("byte", "general")
self.measurements.append(measure)
- measure = Measurement("consumers", "int", MgmtQueueStats)
+ measure = Measurement("consumers", "int")
measure.title = "Consumers"
measure.unit = "consumer"
measure.categories = ("general")
measure.highlow = True
self.measurements.append(measure)
- measure = Measurement("unackedMessages", "int",
MgmtQueueStats)
+ measure = Measurement("unackedMessages", "int")
measure.title = "Msgs. Unacked"
measure.unit = "message"
measure.categories = ("general")
@@ -453,7 +447,7 @@
#measure.categories = ("disk")
#self.measurements.append(measure)
- measure = Measurement("diskPages", "int", MgmtQueueStats)
+ measure = Measurement("diskPages", "int")
measure.title = "Disk Pages"
measure.unit = "page"
measure.categories = ("general")
@@ -466,74 +460,74 @@
# Transactional
- measure = Measurement("msgTxEnqueues", "int",
MgmtQueueStats)
+ measure = Measurement("msgTxEnqueues", "int")
measure.title = "Msgs. Enqueued"
measure.unit = "message"
measure.categories = ("message", "transactional")
self.measurements.append(measure)
- measure = Measurement("msgTxDequeues", "int",
MgmtQueueStats)
+ measure = Measurement("msgTxDequeues", "int")
measure.title = "Msgs. Dequeued"
measure.unit = "message"
measure.categories = ("message", "transactional")
self.measurements.append(measure)
- measure = Measurement("byteTxEnqueues", "int",
MgmtQueueStats)
+ measure = Measurement("byteTxEnqueues", "int")
measure.title = "Bytes Enqueued"
measure.unit = "byte"
measure.categories = ("byte", "transactional")
self.measurements.append(measure)
- measure = Measurement("byteTxDequeues", "int",
MgmtQueueStats)
+ measure = Measurement("byteTxDequeues", "int")
measure.title = "Bytes Dequeued"
measure.unit = "byte"
measure.categories = ("byte", "transactional")
self.measurements.append(measure)
- measure = Measurement("enqueueTxStarts", "int",
MgmtQueueStats)
+ measure = Measurement("enqueueTxStarts", "int")
measure.title = "Enq. Trans. Started"
measure.unit = "transaction"
measure.categories = ("transaction")
self.measurements.append(measure)
- measure = Measurement("enqueueTxCommits", "int",
MgmtQueueStats)
+ measure = Measurement("enqueueTxCommits", "int")
measure.title = "Enq. Trans. Committed"
measure.unit = "transaction"
measure.categories = ("transaction")
self.measurements.append(measure)
- measure = Measurement("enqueueTxRejects", "int",
MgmtQueueStats)
+ measure = Measurement("enqueueTxRejects", "int")
measure.title = "Enq. Trans. Rejected"
measure.unit = "transaction"
measure.categories = ("transaction")
self.measurements.append(measure)
- measure = Measurement("enqueueTxCount", "int",
MgmtQueueStats)
+ measure = Measurement("enqueueTxCount", "int")
measure.title = "Enq. Trans. Pending"
measure.unit = "transaction"
measure.categories = ("transaction")
measure.highlow = True
self.measurements.append(measure)
- measure = Measurement("dequeueTxStarts", "int",
MgmtQueueStats)
+ measure = Measurement("dequeueTxStarts", "int")
measure.title = "Deq. Trans. Started"
measure.unit = "transaction"
measure.categories = ("transaction")
self.measurements.append(measure)
- measure = Measurement("dequeueTxCommits", "int",
MgmtQueueStats)
+ measure = Measurement("dequeueTxCommits", "int")
measure.title = "Deq. Trans. Committed"
measure.unit = "transaction"
measure.categories = ("transaction")
self.measurements.append(measure)
- measure = Measurement("dequeueTxRejects", "int",
MgmtQueueStats)
+ measure = Measurement("dequeueTxRejects", "int")
measure.title = "Deq. Trans. Rejected"
measure.unit = "transaction"
measure.categories = ("transaction")
self.measurements.append(measure)
- measure = Measurement("dequeueTxCount", "int",
MgmtQueueStats)
+ measure = Measurement("dequeueTxCount", "int")
measure.title = "Deq. Trans. Pending"
measure.unit = "transaction"
measure.categories = ("transaction")
@@ -542,25 +536,25 @@
# Persistent
- measure = Measurement("msgPersistEnqueues", "int",
MgmtQueueStats)
+ measure = Measurement("msgPersistEnqueues", "int")
measure.title = "Msgs. Enqueued"
measure.unit = "message"
measure.categories = ("message", "persistent")
self.measurements.append(measure)
- measure = Measurement("msgPersistDequeues", "int",
MgmtQueueStats)
+ measure = Measurement("msgPersistDequeues", "int")
measure.title = "Msgs. Dequeued"
measure.unit = "message"
measure.categories = ("message", "persistent")
self.measurements.append(measure)
- measure = Measurement("bytePersistEnqueues", "int",
MgmtQueueStats)
+ measure = Measurement("bytePersistEnqueues", "int")
measure.title = "Bytes Enqueued"
measure.unit = "byte"
measure.categories = ("byte", "persistent")
self.measurements.append(measure)
- measure = Measurement("bytePersistDequeues", "int",
MgmtQueueStats)
+ measure = Measurement("bytePersistDequeues", "int")
measure.title = "Bytes Dequeued"
measure.unit = "byte"
measure.categories = ("byte", "persistent")
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-02 14:37:54 UTC (rev 1211)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-02 15:05:32 UTC (rev 1212)
@@ -89,13 +89,11 @@
key = self.unit.get(session) == "b" and "byteDepth" or
"msgDepth"
return queue.get_measurement(key).get_value()
- def render_item_ratio(self, session, queue):
+ def render_item_depth_accel(self, session, queue):
key = self.unit.get(session) == "b" and "byteDepth" or
"msgDepth"
- values = queue.get_measurement(key).get_values(2)
+ curr, prev = queue.get_measurement(key).get_values(2)
+ return "%0.00f" % ((curr - prev) / float(1))
- if len(values) > 1 and values[0] != None:
- return "%0.00f" % (values[0] - values[1] / 3)
-
def render_item_status(self, session, queue):
return status(len(queue.errors), len(queue.warnings))
@@ -140,12 +138,10 @@
def render_message_depth(self, session, queue):
return queue.get_measurement("msgDepth").get_value()
- def render_message_depth_ratio(self, session, queue):
+ def render_message_depth_accel(self, session, queue):
curr, prev = queue.get_measurement("msgDepth").get_values(2)
+ return "%.00f" % ((curr - prev) / float(1))
- 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")
@@ -157,12 +153,10 @@
def render_byte_depth(self, session, queue):
return queue.get_measurement("byteDepth").get_value()
- def render_byte_depth_ratio(self, session, queue):
+ def render_byte_depth_accel(self, session, queue):
curr, prev = queue.get_measurement("byteDepth").get_values(2)
+ return "%.00f" % ((curr - prev) / float(1))
- if prev != 0:
- return "%0.00f" % (curr / float(prev))
-
# def render_error_info(self, session, queue):
# return "%i %s, %i %s" % \
# (queue.error_count,
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-02 14:37:54 UTC (rev 1211)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-02 15:05:32 UTC (rev 1212)
@@ -26,7 +26,7 @@
<th class="ralign">Enqueues</th>
<th class="ralign">Dequeues</th>
<th class="ralign">Depth</th>
- <th class="ralign">Ratio</th>
+ <th class="ralign">Accel.</th>
<th>Status</th>
</tr>
@@ -43,7 +43,7 @@
<td class="ralign">{item_enqueues}</td>
<td class="ralign">{item_dequeues}</td>
<td class="ralign">{item_depth}</td>
- <td class="ralign">{item_ratio}</td>
+ <td class="ralign">{item_depth_accel}</td>
<td>{item_status}</td>
</tr>
@@ -123,12 +123,6 @@
<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>
@@ -151,9 +145,9 @@
<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>
+ <th>Accel.</th>
+ <td class="ralign">{message_depth_accel}</td>
+ <td class="ralign">{byte_depth_accel}</td>
</tr>
</table>
</div>