Author: justi9
Date: 2008-03-27 14:47:36 -0400 (Thu, 27 Mar 2008)
New Revision: 1806
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Use types directly in stat declarations.
Simplify the value formatting based on types.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-03-27 17:44:39 UTC (rev 1805)
+++ mgmt/cumin/python/cumin/model.py 2008-03-27 18:47:36 UTC (rev 1806)
@@ -183,10 +183,11 @@
if value is None:
text = ""
- elif value == 0:
- text = "0"
- elif isinstance(value, IntType) or isinstance(value, LongType):
- text = "%i" % value
+ elif self.type is int:
+ if value == 0:
+ text = "0"
+ else:
+ text = "%i" % value
else:
text = "%r" % value
@@ -357,150 +358,150 @@
def __init__(self, model):
super(CuminQueue, self).__init__(model, "queue", Queue, QueueStats)
- stat = CuminStat(self, "consumers", "int")
+ stat = CuminStat(self, "consumers", int)
stat.title = "Consumers"
stat.unit = "consumer"
stat.categories = ("general")
stat.highlow = True
- stat = CuminStat(self, "bindings", "int")
+ stat = CuminStat(self, "bindings", int)
stat.title = "Bindings"
stat.unit = "binding"
stat.categories = ("general")
stat.highlow = True
- stat = CuminStat(self, "msgDepth", "int")
+ stat = CuminStat(self, "msgDepth", int)
stat.title = "Message Depth"
stat.unit = "message"
stat.categories = ("message", "general")
stat.highlow = True
- stat = CuminStat(self, "msgTotalEnqueues", "int")
+ stat = CuminStat(self, "msgTotalEnqueues", int)
stat.title = "Msgs. Enqueued"
stat.unit = "message"
stat.categories = ("message", "general")
- stat = CuminStat(self, "msgTotalDequeues", "int")
+ stat = CuminStat(self, "msgTotalDequeues", int)
stat.title = "Msgs. Dequeued"
stat.unit = "message"
stat.categories = ("message", "general")
- stat = CuminStat(self, "byteDepth", "int")
+ stat = CuminStat(self, "byteDepth", int)
stat.title = "Byte Depth"
stat.unit = "byte"
stat.categories = ("byte", "general")
stat.highlow = True
- stat = CuminStat(self, "byteTotalEnqueues", "int")
+ stat = CuminStat(self, "byteTotalEnqueues", int)
stat.title = "Bytes Enqueued"
stat.unit = "byte"
stat.categories = ("byte", "general")
- stat = CuminStat(self, "byteTotalDequeues", "int")
+ stat = CuminStat(self, "byteTotalDequeues", int)
stat.title = "Bytes Dequeued"
stat.unit = "byte"
stat.categories = ("byte", "general")
- stat = CuminStat(self, "unackedMessages", "int")
+ stat = CuminStat(self, "unackedMessages", int)
stat.title = "Msgs. Unacked"
stat.unit = "message"
stat.categories = ("general")
stat.highlow = True
- stat = CuminStat(self, "messageLatencyMin", "int")
+ stat = CuminStat(self, "messageLatencyMin", int)
stat.title = "Min. Msg. Latency"
stat.unit = "nanosecond"
stat.categories = ("general")
- stat = CuminStat(self, "messageLatencyMax", "int")
+ stat = CuminStat(self, "messageLatencyMax", int)
stat.title = "Max. Msg. Latency"
stat.unit = "nanosecond"
stat.categories = ("general")
- stat = CuminStat(self, "messageLatencyAverage", "int")
+ stat = CuminStat(self, "messageLatencyAverage", int)
stat.title = "Avg. Msg. Latency"
stat.unit = "nanosecond"
stat.categories = ("general")
- stat = CuminStat(self, "messageLatencySamples", "int")
+ stat = CuminStat(self, "messageLatencySamples", int)
stat.title = "Msg. Latency Samples"
stat.unit = "sample"
stat.categories = ("general")
# Disk
- #stat = CuminStat(self, "diskPageSize", "int")
+ #stat = CuminStat(self, "diskPageSize", int)
#stat.title = "Page size"
#stat.categories = ("disk")
- #stat = CuminStat(self, "diskPages", "int")
+ #stat = CuminStat(self, "diskPages", int)
#stat.title = "Disk Pages"
#stat.unit = "page"
#stat.categories = ("general")
- #stat = CuminStat(self, "diskAvailableSize", "int")
+ #stat = CuminStat(self, "diskAvailableSize", int)
#stat.title = "Available size"
#stat.categories = ("disk")
# Transactional
- stat = CuminStat(self, "msgTxnEnqueues", "int")
+ stat = CuminStat(self, "msgTxnEnqueues", int)
stat.title = "Msgs. Enqueued"
stat.unit = "message"
stat.categories = ("message", "transactional")
- stat = CuminStat(self, "msgTxnDequeues", "int")
+ stat = CuminStat(self, "msgTxnDequeues", int)
stat.title = "Msgs. Dequeued"
stat.unit = "message"
stat.categories = ("message", "transactional")
- stat = CuminStat(self, "byteTxnEnqueues", "int")
+ stat = CuminStat(self, "byteTxnEnqueues", int)
stat.title = "Bytes Enqueued"
stat.unit = "byte"
stat.categories = ("byte", "transactional")
- stat = CuminStat(self, "byteTxnDequeues", "int")
+ stat = CuminStat(self, "byteTxnDequeues", int)
stat.title = "Bytes Dequeued"
stat.unit = "byte"
stat.categories = ("byte", "transactional")
- stat = CuminStat(self, "enqueueTxnStarts", "int")
+ stat = CuminStat(self, "enqueueTxnStarts", int)
stat.title = "Enq. Trans. Started"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "enqueueTxnCommits", "int")
+ stat = CuminStat(self, "enqueueTxnCommits", int)
stat.title = "Enq. Trans. Committed"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "enqueueTxnRejects", "int")
+ stat = CuminStat(self, "enqueueTxnRejects", int)
stat.title = "Enq. Trans. Rejected"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "enqueueTxnCount", "int")
+ stat = CuminStat(self, "enqueueTxnCount", int)
stat.title = "Enq. Trans. Pending"
stat.unit = "transaction"
stat.categories = ("transaction")
stat.highlow = True
- stat = CuminStat(self, "dequeueTxnStarts", "int")
+ stat = CuminStat(self, "dequeueTxnStarts", int)
stat.title = "Deq. Trans. Started"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "dequeueTxnCommits", "int")
+ stat = CuminStat(self, "dequeueTxnCommits", int)
stat.title = "Deq. Trans. Committed"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "dequeueTxnRejects", "int")
+ stat = CuminStat(self, "dequeueTxnRejects", int)
stat.title = "Deq. Trans. Rejected"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "dequeueTxnCount", "int")
+ stat = CuminStat(self, "dequeueTxnCount", int)
stat.title = "Deq. Trans. Pending"
stat.unit = "transaction"
stat.categories = ("transaction")
@@ -508,22 +509,22 @@
# Persistent
- stat = CuminStat(self, "msgPersistEnqueues", "int")
+ stat = CuminStat(self, "msgPersistEnqueues", int)
stat.title = "Msgs. Enqueued"
stat.unit = "message"
stat.categories = ("message", "persistent")
- stat = CuminStat(self, "msgPersistDequeues", "int")
+ stat = CuminStat(self, "msgPersistDequeues", int)
stat.title = "Msgs. Dequeued"
stat.unit = "message"
stat.categories = ("message", "persistent")
- stat = CuminStat(self, "bytePersistEnqueues", "int")
+ stat = CuminStat(self, "bytePersistEnqueues", int)
stat.title = "Bytes Enqueued"
stat.unit = "byte"
stat.categories = ("byte", "persistent")
- stat = CuminStat(self, "bytePersistDequeues", "int")
+ stat = CuminStat(self, "bytePersistDequeues", int)
stat.title = "Bytes Dequeued"
stat.unit = "byte"
stat.categories = ("byte", "persistent")
@@ -545,44 +546,44 @@
super(CuminExchange, self).__init__(model, "exchange",
Exchange, ExchangeStats)
- stat = CuminStat(self, "producers", "int")
+ stat = CuminStat(self, "producers", int)
stat.title = "Producers"
stat.unit = "producer"
stat.categories = ("general")
stat.highlow = True
- stat = CuminStat(self, "bindings", "int")
+ stat = CuminStat(self, "bindings", int)
stat.title = "Bindings"
stat.unit = "binding"
stat.categories = ("general")
stat.highlow = True
- stat = CuminStat(self, "msgReceives", "int")
+ stat = CuminStat(self, "msgReceives", int)
stat.title = "Msgs. Received"
stat.unit = "message"
stat.categories = ("general")
- stat = CuminStat(self, "msgRoutes", "int")
+ stat = CuminStat(self, "msgRoutes", int)
stat.title = "Msgs. Routed"
stat.unit = "message"
stat.categories = ("general")
- stat = CuminStat(self, "msgDrops", "int")
+ stat = CuminStat(self, "msgDrops", int)
stat.title = "Msgs. Dropped"
stat.unit = "message"
stat.categories = ("general")
- stat = CuminStat(self, "byteReceives", "int")
+ stat = CuminStat(self, "byteReceives", int)
stat.title = "Bytes Received"
stat.unit = "message"
stat.categories = ("general")
- stat = CuminStat(self, "byteRoutes", "int")
+ stat = CuminStat(self, "byteRoutes", int)
stat.title = "Bytes Routed"
stat.unit = "message"
stat.categories = ("general")
- stat = CuminStat(self, "byteDrops", "int")
+ stat = CuminStat(self, "byteDrops", int)
stat.title = "Bytes Dropped"
stat.unit = "message"
stat.categories = ("general")
@@ -595,7 +596,7 @@
super(CuminBinding, self).__init__(model, "binding",
Binding, BindingStats)
- stat = CuminStat(self, "msgMatched", "int")
+ stat = CuminStat(self, "msgMatched", int)
stat.title = "Msgs. Matched"
stat.unit = "message"
stat.categories = ("general")
@@ -610,26 +611,26 @@
def __init__(self, model):
super(CuminClient, self).__init__(model, "client", Client,
ClientStats)
- stat = CuminStat(self, "closing", "bool")
+ stat = CuminStat(self, "closing", bool)
stat.title = "Closing Down"
stat.categories = ("general")
- stat = CuminStat(self, "bytesFromClient", "int")
+ stat = CuminStat(self, "bytesFromClient", int)
stat.title = "Bytes Sent"
stat.unit = "byte"
stat.categories = ("general")
- stat = CuminStat(self, "bytesToClient", "int")
+ stat = CuminStat(self, "bytesToClient", int)
stat.title = "Bytes Received"
stat.unit = "byte"
stat.categories = ("general")
- stat = CuminStat(self, "framesFromClient", "int")
+ stat = CuminStat(self, "framesFromClient", int)
stat.title = "Frames Sent"
stat.unit = "frame"
stat.categories = ("general")
- stat = CuminStat(self, "framesToClient", "int")
+ stat = CuminStat(self, "framesToClient", int)
stat.title = "Frames Received"
stat.unit = "frame"
stat.categories = ("general")
@@ -654,16 +655,16 @@
super(CuminSession, self).__init__(model, "session",
Session, SessionStats)
- stat = CuminStat(self, "expireTime", "datetime")
+ stat = CuminStat(self, "expireTime", datetime)
stat.title = "Expiration"
stat.categories = ("general")
- stat = CuminStat(self, "framesOutstanding", "int")
+ stat = CuminStat(self, "framesOutstanding", int)
stat.title = "Frames Outstanding"
stat.unit = "frame"
stat.categories = ("general")
- stat = CuminStat(self, "attached", "bool")
+ stat = CuminStat(self, "attached", bool)
stat.title = "Attached"
stat.categories = ("general")
@@ -707,26 +708,26 @@
def __init__(self, model):
super(CuminLink, self).__init__(model, "link", Link, LinkStats)
- stat = CuminStat(self, "closing", "bool")
+ stat = CuminStat(self, "closing", bool)
stat.title = "Closing Down"
stat.categories = ("general")
- stat = CuminStat(self, "framesFromPeer", "int")
+ stat = CuminStat(self, "framesFromPeer", int)
stat.title = "Frames from Peer"
stat.unit = "frame"
stat.categories = ("general")
- stat = CuminStat(self, "framesToPeer", "int")
+ stat = CuminStat(self, "framesToPeer", int)
stat.title = "Frames to Peer"
stat.unit = "frame"
stat.categories = ("general")
- stat = CuminStat(self, "bytesFromPeer", "int")
+ stat = CuminStat(self, "bytesFromPeer", int)
stat.title = "Bytes from Peer"
stat.unit = "byte"
stat.categories = ("general")
- stat = CuminStat(self, "bytesToPeer", "int")
+ stat = CuminStat(self, "bytesToPeer", int)
stat.title = "Bytes to Peer"
stat.unit = "byte"
stat.categories = ("general")