rhmessaging commits: r1168 - in mgmt: mint and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-10-26 13:59:32 -0400 (Fri, 26 Oct 2007)
New Revision: 1168
Added:
mgmt/mint/
mgmt/mint/config.xml
mgmt/mint/schemaparser.py
mgmt/mint/xml/
mgmt/mint/xml/MgmtSchema.xml
Log:
adding mint (SQL/python data model for management)
Added: mgmt/mint/config.xml
===================================================================
--- mgmt/mint/config.xml (rev 0)
+++ mgmt/mint/config.xml 2007-10-26 17:59:32 UTC (rev 1168)
@@ -0,0 +1,6 @@
+<config>
+ <configOption name="dsn" value="postgresql://localhost/" />
+ <configOption name="pythonOutput" value="schema.out.py" />
+ <configOption name="sqlOutput" value="schema.out.sql" />
+ <configOption name="schemaXML" value="xml/MgmtSchema.xml" />
+</config>
Added: mgmt/mint/schemaparser.py
===================================================================
--- mgmt/mint/schemaparser.py (rev 0)
+++ mgmt/mint/schemaparser.py 2007-10-26 17:59:32 UTC (rev 1168)
@@ -0,0 +1,128 @@
+import mllib
+from sqlobject import connectionForURI, sqlhub, MixedCaseUnderscoreStyle
+
+# mapping between xml schema types and database column types
+dataTypesMap = {}
+dataTypesMap["string"] = "VARCHAR(2000)"
+dataTypesMap["bool"] = "BOOLEAN"
+dataTypesMap["uint16"] = "INT2"
+dataTypesMap["uint32"] = "INT4"
+dataTypesMap["uint32_wm"] = "INT4"
+dataTypesMap["uint64"] = "INT8"
+dataTypesMap["ipAddress"] = "VARCHAR(100)"
+dataTypesMap["enum"] = "VARCHAR(100) CHECK ("
+dataTypesMap["fieldTable"] = "VARCHAR(2000)"
+
+# Generate Sql
+def generateSql(name, elements, type):
+ sql = startTable(name, type)
+ for elem in elements:
+ sql += generateColumn(elem)
+ return endTable(sql)
+
+def startTable(name, type):
+ if (type == "config"):
+ actualName = name
+ else:
+ actualName = name + "_stats"
+ table = "CREATE TABLE " + actualName + " (\n"
+ table += " id BIGSERIAL PRIMARY KEY,\n"
+ if (type == "inst"):
+ table += " " + name + "_id BIGINT REFERENCES " + name + " ,\n"
+ table += generateTimestampColumn("rec")
+ if (type == "config"):
+ table += generateTimestampColumn("creation")
+ table += generateTimestampColumn("deletion")
+ return table
+
+def generateTimestampColumn(col):
+ column = " " + col + "_time TIMESTAMP,\n"
+ return column
+
+def generateColumn(elem, suffix=""):
+ actualName = style.pythonAttrToDBColumn(elem["@name"] + suffix)
+ if (elem["@type"].startswith("enum")):
+ actualType = "enum"
+ params = actualName + " IN ("
+ for i in elem["@type"].replace("enum(", "").replace(")", "").split(","):
+ params += "'" + i + "',"
+ params = params[:-1] + "))"
+ else:
+ actualType = elem["@type"]
+ params = ""
+ column = " " + actualName + " " + dataTypesMap[actualType] + params + ",\n"
+ if (elem["@type"].endswith("_wm") and suffix == ""):
+ column += generateColumn(elem, "High")
+ column += generateColumn(elem, "Low")
+ return column
+
+def endTable(sql):
+ return sql[:-2] + "\n);\n\n"
+
+
+# Generate Pyhon
+def generatePython(name, elements):
+ name = style.dbColumnToPythonAttr(name)
+ name = name[0].upper() + name[1:]
+ python = startClass(name)
+ for elem in elements:
+ python += generateMethod(elem)
+ python = endClass(python)
+ python += startClass(name + "Stats")
+ python = endClass(python)
+ return python
+
+def startClass(name):
+ result = "class " + name + "(SQLObject):\n"
+ result += " class sqlmeta:\n"
+ result += " fromDatabase = True\n"
+ return result
+
+def generateMethod(elem):
+ if (elem["@desc"] != None):
+ comment = ' """' + elem["@desc"] + '"""\n'
+ else:
+ comment = ""
+ result = " def " + elem["@name"] + "():\n"
+ result += comment
+ result +=" pass\n\n"
+ return result
+
+def endClass(python):
+ return python + "\n"
+
+
+# parse configuration file
+config = mllib.xml_parse("config.xml")
+configOptions = config.query["config/configOption"]
+options = dict()
+for opt in configOptions:
+ options[opt["@name"]] = opt["@value"]
+
+
+
+sqlFile = open(options["sqlOutput"], "w")
+pythonFile = open(options["pythonOutput"], "w")
+
+conn = connectionForURI(options["dsn"])
+sqlhub.processConnection = conn
+
+schema = mllib.xml_parse(options["schemaXML"])
+objects = schema.query["schema/object"]
+
+style = MixedCaseUnderscoreStyle()
+
+pythonFile.write("from sqlobject import *\n\n" + \
+ "conn = connectionForURI('" + options["dsn"] + "')\n" + \
+ "sqlhub.processConnection = conn\n\n")
+
+for obj in objects:
+ actualName = "mgmt_" + obj["@name"]
+ sql = generateSql(actualName, obj.query["configElement"], "config")
+ sql += generateSql(actualName, obj.query["instElement"], "inst")
+ python = generatePython(actualName, obj.query["method"])
+ sqlFile.write(sql)
+ pythonFile.write(python)
+
+sqlFile.close()
+pythonFile.close()
Added: mgmt/mint/xml/MgmtSchema.xml
===================================================================
--- mgmt/mint/xml/MgmtSchema.xml (rev 0)
+++ mgmt/mint/xml/MgmtSchema.xml 2007-10-26 17:59:32 UTC (rev 1168)
@@ -0,0 +1,238 @@
+<schema version="0.1" date="10/22/2007">
+
+ <!-- Type information:
+
+ Numeric types with "_wm" suffix are watermarked numbers. These are compound
+ values containing a current value, and a low and high water mark for the reporting
+ interval. The low and high water marks are set to the current value at the
+ beginning of each interval and track the minimum and maximum values of the statistic
+ over the interval respectively.
+
+ Access rights for configuration elements:
+
+ RO => Read Only
+ RC => Read/Create, can be set at create time only, read-only thereafter
+ RW => Read/Write
+
+ If access rights are omitted for a configElement, they are assumed to be RO.
+
+ -->
+
+ <!-- Questions: Does C++ broker round-robin dests on queues? -->
+
+ <!--
+ ===============================================================
+ Server
+ ===============================================================
+ -->
+ <object name="server" schemaId="1">
+ <configElement name="port" type="uint16" access="RO" desc="TCP Port for AMQP Service"/>
+ <configElement name="workerThreads" type="uint16" access="RO" desc="Thread pool size"/>
+ <configElement name="maxConns" type="uint16" access="RO" desc="Maximum allowed connections"/>
+ <configElement name="connBacklog" type="uint16" access="RO" desc="Connection backlog limit for listening socket"/>
+ <configElement name="stagingThreshold" type="uint32" access="RO" desc="Broker stages messages over this size to disk"/>
+ <configElement name="storeLib" type="string" access="RO" desc="Name of persistent storage library"/>
+ <configElement name="asyncStore" type="bool" access="RO" desc="Use async persistent store"/>
+ <configElement name="mgmtPubInterval" type="uint16" min="1" access="RW" desc="Interval for management broadcasts"/>
+ <configElement name="initialDiskPageSize" type="uint32" access="RO" desc="Number of disk pages allocated for storage"/>
+ <configElement name="initialPagesPerQueue" type="uint32" access="RO" desc="Number of disk pages allocated per queue"/>
+ <configElement name="clusterName" type="string" access="RO"
+ desc="Name of cluster this server is a member of, zero-length for standalone server"/>
+
+ <!-- RT config/instrumentation TBD -->
+
+ <instElement name="version" type="string" desc="Running software version"/>
+
+ <method name="joinCluster">
+ <arg name="clusterName" type="string"/>
+ </method>
+
+ <method name="leaveCluster"/>
+ </object>
+
+ <!--
+ ===============================================================
+ Virtual Host
+ ===============================================================
+ -->
+ <object name="vhost" schemaId="2">
+ <configElement name="name" type="string" access="RC" index="y"/>
+ </object>
+
+ <!--
+ ===============================================================
+ Queue
+ ===============================================================
+ -->
+ <object name="queue" schemaId="3">
+ <configElement name="vhostRef" type="string" access="RC" index="y"/>
+ <configElement name="name" type="string" access="RC" index="y"/>
+
+ <configElement name="durable" type="bool" access="RC"/>
+ <configElement name="autoDelete" type="bool" access="RC"/>
+ <configElement name="exclusive" type="bool" access="RC"/>
+ <configElement name="pageMemoryLimit" type="uint32" access="RO"/>
+
+ <instElement name="diskPageSize" type="uint32"/>
+ <instElement name="diskPages" type="uint32"/>
+ <instElement name="diskAvailableSize" type="uint32"/>
+
+ <instElement name="msgTotalEnqueues" type="uint64" desc="Total messages enqueued"/>
+ <instElement name="msgTotalDequeues" type="uint64" desc="Total messages dequeued"/>
+ <instElement name="msgTxEnqueues" type="uint64" desc="Transactional messages enqueued"/>
+ <instElement name="msgTxDequeues" type="uint64" desc="Transactional messages dequeued"/>
+ <instElement name="msgPersistEnqueues" type="uint64" desc="Persistent messages enqueued"/>
+ <instElement name="msgPersistDequeues" type="uint64" desc="Persistent messages dequeued"/>
+ <instElement name="msgDepth" type="uint32_wm" desc="Current size of queue in messages"/>
+ <instElement name="byteTotalEnqueues" type="uint64" desc="Total messages enqueued"/>
+ <instElement name="byteTotalDequeues" type="uint64" desc="Total messages dequeued"/>
+ <instElement name="byteTxEnqueues" type="uint64" desc="Transactional messages enqueued"/>
+ <instElement name="byteTxDequeues" type="uint64" desc="Transactional messages dequeued"/>
+ <instElement name="bytePersistEnqueues" type="uint64" desc="Persistent messages enqueued"/>
+ <instElement name="bytePersistDequeues" type="uint64" desc="Persistent messages dequeued"/>
+ <instElement name="byteDepth" type="uint32_wm" desc="Current size of queue in bytes"/>
+ <instElement name="enqueueTxStarts" type="uint64" desc="Total enqueue transactions started "/>
+ <instElement name="enqueueTxCommits" type="uint64" desc="Total enqueue transactions committed"/>
+ <instElement name="enqueueTxRejects" type="uint64" desc="Total enqueue transactions rejected"/>
+ <instElement name="enqueueTxCount" type="uint32_wm" desc="Current pending enqueue transactions"/>
+ <instElement name="dequeueTxStarts" type="uint64" desc="Total dequeue transactions started"/>
+ <instElement name="dequeueTxCommits" type="uint64" desc="Total dequeue transactions committed"/>
+ <instElement name="dequeueTxRejects" type="uint64" desc="Total dequeue transactions rejected"/>
+ <instElement name="dequeueTxCount" type="uint32_wm" desc="Current pending dequeue transactions"/>
+ <instElement name="consumers" type="uint32_wm" desc="Current consumers on queue"/>
+ <instElement name="unackedMessages" type="uint32_wm" desc="Messages consumed but not yet acked"/>
+
+ <method name="purge" desc="Discard all messages on queue"/>
+ <method name="increaseDiskSize" desc="Increase number of disk pages allocated for this queue">
+ <arg name="pages" type="uint32" desc="New total page allocation"/>
+ </method>
+ </object>
+
+ <!--
+ ===============================================================
+ Exchange
+ ===============================================================
+ -->
+ <object name="exchange" schemaId="4">
+ <configElement name="vhostRef" type="string" access="RC" index="y"/>
+ <configElement name="name" type="string" access="RC" index="y"/>
+ <configElement name="type" type="string" access="RC"/>
+
+ <instElement name="bindings" type="uint32_wm" desc="Current bindings"/>
+ <instElement name="msgReceives" type="uint64" desc="Total messages received"/>
+ <instElement name="msgDrops" type="uint64" desc="Total messages dropped (no matching key)"/>
+ <instElement name="msgRoutes" type="uint64" desc="Total routed messages"/>
+ <instElement name="byteReceives" type="uint64" desc="Total bytes received"/>
+ <instElement name="byteDrops" type="uint64" desc="Total bytes dropped (no matching key)"/>
+ <instElement name="byteRoutes" type="uint64" desc="Total routed bytes"/>
+ </object>
+
+ <!--
+ ===============================================================
+ Binding
+ ===============================================================
+ -->
+ <object name="binding" schemaId="5">
+ <configElement name="queueRef" type="string" access="RC" index="y"/>
+ <configElement name="exchangeRef" type="string" access="RC" index="y"/>
+ <configElement name="bindingKey" type="string" access="RC"/>
+ <configElement name="arguments" type="fieldTable" access="RC"/>
+
+ <instElement name="msgMatched" type="uint64"/>
+ </object>
+
+ <!--
+ ===============================================================
+ Client
+ ===============================================================
+ -->
+ <object name="client" schemaId="6">
+ <configElement name="ipAddr" type="ipAddress" index="y"/>
+ <configElement name="port" type="uint16" index="y"/>
+
+ <instElement name="authIdentity" type="string"/>
+ <instElement name="msgsProduced" type="uint64"/>
+ <instElement name="msgsConsumed" type="uint64"/>
+ <instElement name="bytesProduced" type="uint64"/>
+ <instElement name="bytesConsumed" type="uint64"/>
+
+ <method name="close"/>
+ <method name="detach"/>
+ </object>
+
+ <!--
+ ===============================================================
+ Session
+ ===============================================================
+ -->
+ <object name="session" schemaId="7">
+ <configElement name="vhostRef" type="string" index="y"/>
+ <configElement name="name" type="string" index="y"/>
+ <configElement name="clientRef" type="string" access="RO"/>
+ <configElement name="detachedLifespan" type="uint32" access="RO"/>
+
+ <instElement name="attached" type="bool"/>
+ <instElement name="remainingLifespan" type="uint32"/>
+ <instElement name="framesOutstanding" type="uint32"/>
+
+ <method name="solicitAck"/>
+ <method name="detach"/>
+ <method name="resetLifespan"/>
+ <method name="close"/>
+ </object>
+
+ <!--
+ ===============================================================
+ Destination
+ ===============================================================
+ -->
+ <object name="destination" schemaId="8">
+ <configElement name="name" type="string" index="y"/>
+
+ <instElement name="flowMode" type="enum(credit,window)"/>
+ <instElement name="maxMsgCredits" type="uint32"/>
+ <instElement name="maxByteCredits" type="uint32"/>
+
+ <instElement name="msgCredits" type="uint32"/>
+ <instElement name="byteCredits" type="uint32"/>
+
+ <method name="throttle" desc="Apply extra rate limiting to destination: 0 = Normal, 10 = Maximum">
+ <arg name="strength" type="uint8" min="0" max="10"/>
+ </method>
+ <method name="stop"/>
+ <method name="start"/>
+ </object>
+
+ <!--
+ ===============================================================
+ Producer
+ ===============================================================
+ -->
+ <object name="producer" schemaId="9">
+ <configElement name="sessionRef" type="string" index="y"/>
+ <configElement name="exchangeRef" type="string" index="y"/>
+
+ <instElement name="destinationRef" type="string"/>
+ <instElement name="msgsProduced" type="uint64"/>
+ <instElement name="bytesProduced" type="uint64"/>
+ </object>
+
+ <!--
+ ===============================================================
+ Consumer
+ ===============================================================
+ -->
+ <object name="consumer" schemaId="10">
+ <configElement name="sessionRef" type="string" index="y"/>
+ <configElement name="queueRef" type="string" index="y"/>
+ <configElement name="name" type="string" index="y"/>
+
+ <instElement name="destinationRef" type="string"/>
+ <instElement name="msgsConsumed" type="uint64"/>
+ <instElement name="bytesConsumed" type="uint64"/>
+ <instElement name="unackedMessages" type="uint32_wm" desc="Messages consumed but not yet acked"/>
+
+ <method name="close"/>
+ </object>
+</schema>
+
17 years, 2 months
rhmessaging commits: r1167 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-26 11:00:45 -0400 (Fri, 26 Oct 2007)
New Revision: 1167
Modified:
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/brokercluster.py
mgmt/cumin/python/cumin/brokercluster.strings
mgmt/cumin/python/cumin/brokergroup.py
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/widgets.py
mgmt/notes/Todo
Log:
Introduces status lights (instead of warning and error counts) in more
places. Changes the error and warning states to display a number.
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2007-10-26 14:02:43 UTC (rev 1166)
+++ mgmt/cumin/python/cumin/broker.strings 2007-10-26 15:00:45 UTC (rev 1167)
@@ -15,7 +15,7 @@
<td>{item_link}</td>
<td>{item_profile_link}</td>
<td>{item_cluster_link}</td>
- <td>0 errors, 0 warnings</td>
+ <td>{item_status}</td>
</tr>
[BrokerSetForm.html]
Modified: mgmt/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/cumin/python/cumin/brokercluster.py 2007-10-26 14:02:43 UTC (rev 1166)
+++ mgmt/cumin/python/cumin/brokercluster.py 2007-10-26 15:00:45 UTC (rev 1167)
@@ -27,11 +27,15 @@
self.page().show_broker_cluster(branch, cluster).show_view(branch)
return mlink(branch.marshal(), "BrokerCluster", cluster.name)
- def render_item_broker_lights(self, session, cluster):
+ def render_item_config(self, session, cluster):
+ count = len(cluster.broker_items())
+ return "%i broker%s" % (count, ess(count))
+
+ def render_item_status(self, session, cluster):
writer = Writer()
for broker in sorted_by(cluster.broker_items()):
- self.broker_tmpl.render(session, broker, writer)
+ writer.write(status(len(broker.errors), len(broker.warnings)))
return writer.to_string()
Modified: mgmt/cumin/python/cumin/brokercluster.strings
===================================================================
--- mgmt/cumin/python/cumin/brokercluster.strings 2007-10-26 14:02:43 UTC (rev 1166)
+++ mgmt/cumin/python/cumin/brokercluster.strings 2007-10-26 15:00:45 UTC (rev 1167)
@@ -26,11 +26,8 @@
[BrokerClusterSet.item_html]
<tr>
<td>{item_link}</td>
- <td>3 brokers</td>
- <td>
- <div>0 errors, 0 warnings</div>
- <div>{item_broker_lights}</div>
- </td>
+ <td>{item_config}</td>
+ <td>{item_status}</td>
</tr>
[BrokerClusterSet.broker_html]
Modified: mgmt/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.py 2007-10-26 14:02:43 UTC (rev 1166)
+++ mgmt/cumin/python/cumin/brokergroup.py 2007-10-26 15:00:45 UTC (rev 1167)
@@ -1,7 +1,7 @@
from wooly import *
from wooly.widgets import *
-from broker import BrokerSet
+from broker import BrokerSetForm
from model import *
from widgets import *
from parameters import *
@@ -30,7 +30,7 @@
return "%i broker%s" % (count, count == 1 and "" or "s")
def render_item_status(self, session, group):
- return "0 errors, 0 warnings"
+ return status(len(group.errors), len(group.warnings))
def render_none(self, session, group):
return none()
@@ -77,7 +77,7 @@
self.page().show_broker_group(branch, group).show_edit(branch)
return branch.marshal()
- class GroupBrokerTab(BrokerSet):
+ class GroupBrokerTab(BrokerSetForm):
def get_items(self, session, group):
return sorted_by(group.broker_items())
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-26 14:02:43 UTC (rev 1166)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-26 15:00:45 UTC (rev 1167)
@@ -171,6 +171,21 @@
self.model = model
self.setDaemon(True)
+ def frob(self, mobject):
+ mobject.lock()
+ try:
+ if isinstance(mobject, MeasuredModelObject):
+ for measure in mobject.measurements:
+ self.frob_measure(measure)
+
+ if hasattr(mobject, "errors"):
+ self.frob_errors(mobject.errors)
+
+ if hasattr(mobject, "warnings"):
+ self.frob_errors(mobject.warnings)
+ finally:
+ mobject.unlock()
+
def frob_measure(self, measure):
if measure.type == "int":
if random() < 0.5:
@@ -183,88 +198,44 @@
else:
measure.add_value(measure.get_value())
+ def frob_errors(self, errors):
+ if random() < 0.005:
+ errors.append(object())
+ if random() < 0.02 and len(errors):
+ del errors[0]
+
+
def run(self):
while True:
sleep(1)
for broker in self.model.get_brokers():
- if random() < 0.005:
- broker.errors.append(object())
+ self.frob(broker)
- if random() < 0.02 and len(broker.errors):
- del broker.errors[0]
-
- if random() < 0.005:
- broker.warnings.append(object())
-
- if random() < 0.02 and len(broker.warnings):
- del broker.warnings[0]
-
for vhost in broker.virtual_host_items():
+ self.frob(vhost)
+
for exchange in vhost.exchange_items():
- exchange.lock()
- try:
- for measure in exchange.measurements:
- self.frob_measure(measure)
- finally:
- exchange.unlock()
-
+ self.frob(exchange)
+
for binding in exchange.binding_items():
- binding.lock()
- try:
- for measure in binding.measurements:
- self.frob_measure(measure)
- finally:
- binding.unlock()
+ self.frob(binding)
for producer in exchange.producer_items():
- producer.lock()
- try:
- for measure in producer.measurements:
- self.frob_measure(measure)
- finally:
- producer.unlock()
-
+ self.frob(producer)
+
for queue in vhost.queue_items():
- queue.lock()
- try:
- for measure in queue.measurements:
- self.frob_measure(measure)
+ self.frob(queue)
- queue.message_count += 1
-
- if random() < 0.01:
- queue.error_count += 1
-
- if random() < 0.01:
- queue.warning_count += 1
- finally:
- queue.unlock()
-
for consumer in queue.consumer_items():
- consumer.lock()
- try:
- for measure in consumer.measurements:
- self.frob_measure(measure)
- finally:
- consumer.unlock()
+ self.frob(consumer)
for client in vhost.client_items():
- client.lock()
- try:
- for measure in client.measurements:
- self.frob_measure(measure)
- finally:
- client.unlock()
+ self.frob(client)
for session in client.session_items():
- session.lock()
- try:
- for measure in session.measurements:
- self.frob_measure(measure)
- finally:
- session.unlock()
+ self.frob(session)
if __name__ == "__main__":
import sys
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-26 14:02:43 UTC (rev 1166)
+++ mgmt/cumin/python/cumin/model.py 2007-10-26 15:00:45 UTC (rev 1167)
@@ -233,6 +233,8 @@
super(BrokerGroup, self).__init__(model, model.broker_group)
self.name = None
+ self.errors = list()
+ self.warnings = list()
class BrokerGroupType(ModelObject):
def __init__(self, model):
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-26 14:02:43 UTC (rev 1166)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-26 15:00:45 UTC (rev 1167)
@@ -343,7 +343,11 @@
width: 1em;
height: 1em;
margin: 0.25em 1px 0 0;
- padding: 0;
+ padding: 0.15em;
+ color: #fff;
+ font-size: 0.8em;
+ text-align: center;
+ line-height: 1.1em;
}
div.statuslight.red {
@@ -351,7 +355,7 @@
}
div.statuslight.yellow {
- background-color: #ee6;
+ background-color: #fd3;
}
div.statuslight.green {
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-26 14:02:43 UTC (rev 1166)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-26 15:00:45 UTC (rev 1167)
@@ -14,9 +14,11 @@
def none():
return "<span class=\"none\">None</span>"
-def status(errs, warns):
- return "<div class=\"statuslight %s\"/>" % \
- (errs + warns == 0 and "green" or (errs and "red" or "yellow"))
+def status(errors, warnings):
+ count = errors + warnings
+ return "<div class=\"statuslight %s\">%s</div>" % \
+ (count == 0 and "green" or (errors and "red" or "yellow"),
+ count == 0 and " " or str(count))
class CuminFrame(Frame, ModeSet):
def __init__(self, app, name):
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-26 14:02:43 UTC (rev 1166)
+++ mgmt/notes/Todo 2007-10-26 15:00:45 UTC (rev 1167)
@@ -63,8 +63,6 @@
- Remove config tab
- * Move q,e to server level (using default vhost)
-
* Cluster
- Add load balance action
@@ -104,4 +102,4 @@
* Right now, non cumin pages don't print their stack traces in the
log
- * Make the 0 errors, 0 warnings thing more compact; maybe just lights
+ * Move q,e to server level (using default vhost)
17 years, 2 months
rhmessaging commits: r1166 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-26 10:02:43 -0400 (Fri, 26 Oct 2007)
New Revision: 1166
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/widgets.py
Log:
Replaces the 0 error, 0 warnings status with a simple indicator like
an led, either red, yellow, or green.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-10-26 13:21:14 UTC (rev 1165)
+++ mgmt/cumin/python/cumin/broker.py 2007-10-26 14:02:43 UTC (rev 1166)
@@ -53,7 +53,7 @@
return none()
def render_item_status(self, session, broker):
- return "0 errors, 0 warnings"
+ return status(len(broker.errors), len(broker.warnings))
def render_item_load(self, session, broker):
return "%.2f" % random()
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-26 13:21:14 UTC (rev 1165)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-26 14:02:43 UTC (rev 1166)
@@ -189,6 +189,18 @@
sleep(1)
for broker in self.model.get_brokers():
+ if random() < 0.005:
+ broker.errors.append(object())
+
+ if random() < 0.02 and len(broker.errors):
+ del broker.errors[0]
+
+ if random() < 0.005:
+ broker.warnings.append(object())
+
+ if random() < 0.02 and len(broker.warnings):
+ del broker.warnings[0]
+
for vhost in broker.virtual_host_items():
for exchange in vhost.exchange_items():
exchange.lock()
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-26 13:21:14 UTC (rev 1165)
+++ mgmt/cumin/python/cumin/model.py 2007-10-26 14:02:43 UTC (rev 1166)
@@ -199,6 +199,9 @@
self.name = None
self.default_virtual_host = None
+ self.errors = list()
+ self.warnings = list()
+
def write_xml(self, writer):
writer.write("<broker id=\"broker-%i\">" % self.id)
writer.write("<name>" + self.name + "</name>")
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-26 13:21:14 UTC (rev 1165)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-26 14:02:43 UTC (rev 1166)
@@ -311,33 +311,53 @@
content: url(resource?name=radio-button-checked.png);
}
-.mstatus {
+div.mstatus {
float: right;
margin: 1em;
padding: 0.75em 1em;
width: 15em;
}
-.mstatus h2 {
+div.mstatus h2 {
font-weight: bold;
margin: 0 0 0.5em 0;
}
-.mstatus.red {
+div.mstatus.red {
border: 1px solid #c99;
background-color: #fcc;
}
-.mstatus.yellow {
+div.mstatus.yellow {
border: 1px solid #cc9;
background-color: #ffc;
}
-.mstatus.green {
+div.mstatus.green {
border: 1px solid #9c9;
background-color: #cfc;
}
+div.statuslight {
+ float: left;
+ width: 1em;
+ height: 1em;
+ margin: 0.25em 1px 0 0;
+ padding: 0;
+}
+
+div.statuslight.red {
+ background-color: #e33;
+}
+
+div.statuslight.yellow {
+ background-color: #ee6;
+}
+
+div.statuslight.green {
+ background-color: #9e9;
+}
+
pre.code {
background-color: #f7f7f7;
padding: 1em;
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-26 13:21:14 UTC (rev 1165)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-26 14:02:43 UTC (rev 1166)
@@ -14,6 +14,10 @@
def none():
return "<span class=\"none\">None</span>"
+def status(errs, warns):
+ return "<div class=\"statuslight %s\"/>" % \
+ (errs + warns == 0 and "green" or (errs and "red" or "yellow"))
+
class CuminFrame(Frame, ModeSet):
def __init__(self, app, name):
super(CuminFrame, self).__init__(app, name)
17 years, 2 months
rhmessaging commits: r1165 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-26 09:21:14 -0400 (Fri, 26 Oct 2007)
New Revision: 1165
Modified:
mgmt/cumin/python/cumin/demo.py
mgmt/notes/Todo
Log:
Introduces a parameter to reduce the size of the demo data, since the
server start time was beginning to be annoying.
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-25 20:58:09 UTC (rev 1164)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-26 13:21:14 UTC (rev 1165)
@@ -8,8 +8,9 @@
return "%s%02i" % (str_, int_)
class DemoData(object):
- def __init__(self, model):
+ def __init__(self, model, mult=5):
self.model = model
+ self.mult = mult
def load(self):
# XXX need some locking in here
@@ -128,38 +129,33 @@
obj.add_config_property(prop)
def load_vhost(self, vhost):
- for name in ("realm0", "realm1", "realm2"):
- realm = Realm(self.model)
- realm.name = name
- vhost.add_realm(realm)
-
for name in ("amq.direct", "amq.fanout",
"amq.topic", "amq.match"):
exchange = Exchange(self.model)
exchange.name = name
vhost.add_exchange(exchange)
- for producer_count in range(10):
+ for producer_count in range(self.mult):
producer = Producer(self.model)
producer.name = fmt("producer", producer_count)
exchange.add_producer(producer)
- for queue_count in range(10):
+ for queue_count in range(self.mult):
queue = Queue(self.model)
queue.name = fmt("queue", queue_count)
vhost.add_queue(queue)
- for consumer_count in range(10):
+ for consumer_count in range(self.mult):
consumer = Consumer(self.model)
consumer.name = fmt("consumer", consumer_count)
queue.add_consumer(consumer)
- for num in range(100, 200, 10):
+ for num in range(100, 100 + self.mult * 10, 10):
client = Client(self.model)
client.address = "192.168.0.%i:16565" % num
vhost.add_client(client)
- for session_count in range(10):
+ for session_count in range(self.mult):
session = Session(self.model)
session.name = fmt("session", session_count)
client.add_session(session)
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-25 20:58:09 UTC (rev 1164)
+++ mgmt/notes/Todo 2007-10-26 13:21:14 UTC (rev 1165)
@@ -65,9 +65,6 @@
* Move q,e to server level (using default vhost)
- * Instead of individual remove links, use checkboxes and a bulk
- remove
-
* Cluster
- Add load balance action
@@ -89,10 +86,6 @@
* Add a frame() accessor to Widget
- * Perhaps make templates do this: <ul>{<li><a href="">somename</a></li>}</ul>
-
- - or this: <ul>{?href <li><a href="$">Add User</A></li>}</ul>
-
* Add a sanity check traversal to the widget tree and to the
registered sets of widgets and parameters
@@ -112,5 +105,3 @@
log
* Make the 0 errors, 0 warnings thing more compact; maybe just lights
-
- * Find out how to make pycairo write to an existing file
17 years, 2 months
rhmessaging commits: r1164 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-25 16:58:09 -0400 (Thu, 25 Oct 2007)
New Revision: 1164
Modified:
mgmt/cumin/python/cumin/charts.py
Log:
Stop writing the chart png in a very hoaky way.
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2007-10-25 20:38:14 UTC (rev 1163)
+++ mgmt/cumin/python/cumin/charts.py 2007-10-25 20:58:09 UTC (rev 1164)
@@ -58,8 +58,8 @@
cr.move_to(x, self.height)
cr.show_text("0")
- def write(self, name):
- self.surface.write_to_png(name)
+ def write(self, writer):
+ self.surface.write_to_png(writer)
class QueueChartPage(Page):
def __init__(self, app, name):
@@ -86,6 +86,8 @@
measures = [queue.get_measurement(x) \
for x in self.measurements.get(session)]
+ # XXX only get the max of the values we're going to display
+
max_value = 0
for m in measures:
max_value = max(max(m.values), max_value)
@@ -103,8 +105,6 @@
chart.plot_frame()
- name = "/tmp/whoa.png"
- chart.write(name)
- file = open(name, "r")
-
- return file.read()
+ writer = Writer()
+ chart.write(writer)
+ return writer.to_string()
17 years, 2 months
rhmessaging commits: r1163 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-25 16:38:14 -0400 (Thu, 25 Oct 2007)
New Revision: 1163
Modified:
mgmt/cumin/python/cumin/charts.py
mgmt/notes/Todo
Log:
Moves frame drawing down so that it overlaps the value lines. Ensures
that we draw value lines all the way to the left edge.
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2007-10-25 19:36:05 UTC (rev 1162)
+++ mgmt/cumin/python/cumin/charts.py 2007-10-25 20:38:14 UTC (rev 1163)
@@ -20,7 +20,8 @@
cr.set_line_width(2)
cr.set_source_rgb(*color)
- for x, value in zip(range(self.width, 0, -interval), reversed(values)):
+ for x, value in zip(range(self.width, 0 - interval, -interval),
+ reversed(values)):
y = self.height - (value / float(self.max_value)) * self.height
cr.line_to(x, y)
@@ -94,13 +95,14 @@
chart.plot_x_intervals()
chart.plot_y_axis()
- chart.plot_frame()
colors = ((1,0,0), (0,0,1), (0,1,0))
for m, c in zip(measures, colors):
chart.plot_values(m.values, color=c)
+ chart.plot_frame()
+
name = "/tmp/whoa.png"
chart.write(name)
file = open(name, "r")
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-25 19:36:05 UTC (rev 1162)
+++ mgmt/notes/Todo 2007-10-25 20:38:14 UTC (rev 1163)
@@ -110,3 +110,7 @@
* Right now, non cumin pages don't print their stack traces in the
log
+
+ * Make the 0 errors, 0 warnings thing more compact; maybe just lights
+
+ * Find out how to make pycairo write to an existing file
17 years, 2 months
rhmessaging commits: r1162 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-25 15:36:05 -0400 (Thu, 25 Oct 2007)
New Revision: 1162
Modified:
mgmt/cumin/python/cumin/charts.py
mgmt/cumin/python/cumin/queue.strings
Log:
Chart improvements.
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2007-10-25 17:38:48 UTC (rev 1161)
+++ mgmt/cumin/python/cumin/charts.py 2007-10-25 19:36:05 UTC (rev 1162)
@@ -9,23 +9,34 @@
def __init__(self, width, height):
self.width = width
self.height = height
- self.surface = ImageSurface(FORMAT_ARGB32, width, height)
-
+ self.surface = ImageSurface(FORMAT_ARGB32, width + 40, height + 20)
+ self.max_value = 1
+
+ def set_max_value(self, value):
+ self.max_value = value
+
def plot_values(self, values, interval=5, color=(0, 0, 0)):
- max_value = max(100, max(values) * 1.2)
-
cr = Context(self.surface)
cr.set_line_width(2)
cr.set_source_rgb(*color)
for x, value in zip(range(self.width, 0, -interval), reversed(values)):
- y = self.height - (value / float(max_value)) * self.height
+ y = self.height - (value / float(self.max_value)) * self.height
cr.line_to(x, y)
cr.stroke()
- def plot_intervals(self, interval=40):
+ def plot_frame(self, color=(0.8, 0.8, 0.8)):
cr = Context(self.surface)
+ cr.set_line_width(1)
+ cr.set_source_rgb(*color)
+
+ cr.rectangle(0.5, 0.5, self.width, self.height)
+
+ cr.stroke()
+
+ def plot_x_intervals(self, interval=40):
+ cr = Context(self.surface)
cr.set_line_width(0.2)
cr.set_source_rgb(0.8, 0.8, 0.8)
@@ -35,6 +46,17 @@
cr.stroke()
+ def plot_y_axis(self):
+ cr = Context(self.surface)
+
+ x = self.width + 2
+
+ cr.move_to(x, 9)
+ cr.show_text(str(self.max_value))
+
+ cr.move_to(x, self.height)
+ cr.show_text("0")
+
def write(self, name):
self.surface.write_to_png(name)
@@ -59,10 +81,21 @@
def do_render(self, session, queue):
chart = LineChart(600, 120)
- chart.plot_intervals()
measures = [queue.get_measurement(x) \
for x in self.measurements.get(session)]
+
+ max_value = 0
+ for m in measures:
+ max_value = max(max(m.values), max_value)
+ max_value = max_value * 1.1
+ max_value = max_value + (100 - max_value % 100)
+ chart.set_max_value(int(max_value))
+
+ chart.plot_x_intervals()
+ chart.plot_y_axis()
+ chart.plot_frame()
+
colors = ((1,0,0), (0,0,1), (0,1,0))
for m, c in zip(measures, colors):
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-10-25 17:38:48 UTC (rev 1161)
+++ mgmt/cumin/python/cumin/queue.strings 2007-10-25 19:36:05 UTC (rev 1162)
@@ -206,10 +206,12 @@
</table>
[StatisticsHistory.css]
+/*
.chart img {
background-color: #f9f9f9;
border: 1px dotted #ddd;
}
+*/
[StatisticsHistory.html]
<h2>Queue Depth</h2>
17 years, 2 months
rhmessaging commits: r1161 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-25 13:38:48 -0400 (Thu, 25 Oct 2007)
New Revision: 1161
Modified:
mgmt/cumin/python/cumin/charts.py
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
Log:
Displays 3 different graphs on the queue stats history tab. Pretties
them up a little. Makes the chart lines issue from the right.
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2007-10-25 14:09:30 UTC (rev 1160)
+++ mgmt/cumin/python/cumin/charts.py 2007-10-25 17:38:48 UTC (rev 1161)
@@ -1,6 +1,7 @@
from cairo import *
from random import random
from wooly import *
+from wooly.parameters import *
from parameters import *
@@ -13,26 +14,26 @@
def plot_values(self, values, interval=5, color=(0, 0, 0)):
max_value = max(100, max(values) * 1.2)
- ctx = Context(self.surface)
- ctx.set_line_width(2)
- ctx.set_source_rgb(*color)
+ cr = Context(self.surface)
+ cr.set_line_width(2)
+ cr.set_source_rgb(*color)
- for x, value in zip(range(0, self.width, interval), values):
- y = (value / float(max_value)) * self.height
- ctx.line_to(x, y)
+ for x, value in zip(range(self.width, 0, -interval), reversed(values)):
+ y = self.height - (value / float(max_value)) * self.height
+ cr.line_to(x, y)
- ctx.stroke()
+ cr.stroke()
def plot_intervals(self, interval=40):
- ctx = Context(self.surface)
- ctx.set_line_width(0.5)
- ctx.set_source_rgb(0.8, 0.8, 0.8)
+ cr = Context(self.surface)
+ cr.set_line_width(0.2)
+ cr.set_source_rgb(0.8, 0.8, 0.8)
for x in range(0, self.width, interval):
- ctx.move_to(x, 0)
- ctx.line_to(x, self.height)
+ cr.move_to(x, 0)
+ cr.line_to(x, self.height)
- ctx.stroke()
+ cr.stroke()
def write(self, name):
self.surface.write_to_png(name)
@@ -41,23 +42,31 @@
def __init__(self, app, name):
super(QueueChartPage, self).__init__(app, name)
- self.param = QueueParameter(app, "id")
+ self.queue = QueueParameter(app, "id")
+ self.add_parameter(self.queue)
+
+ self.param = Parameter(app, "param")
self.add_parameter(self.param)
+ self.measurements = ListParameter(app, "m", self.param)
+ self.add_parameter(self.measurements)
+
def get_object(self, session, object):
- return self.param.get(session)
+ return self.queue.get(session)
def get_content_type(self, session):
return "image/png"
def do_render(self, session, queue):
- messages = queue.get_measurement("msgDepth")
- bytes = queue.get_measurement("byteDepth")
-
chart = LineChart(600, 120)
chart.plot_intervals()
- chart.plot_values(messages.values, color=(1, 0, 0))
- chart.plot_values(bytes.values, color=(0, 0, 1))
+
+ measures = [queue.get_measurement(x) \
+ for x in self.measurements.get(session)]
+ colors = ((1,0,0), (0,0,1), (0,1,0))
+
+ for m, c in zip(measures, colors):
+ chart.plot_values(m.values, color=c)
name = "/tmp/whoa.png"
chart.write(name)
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-25 14:09:30 UTC (rev 1160)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-25 17:38:48 UTC (rev 1161)
@@ -176,13 +176,17 @@
self.setDaemon(True)
def frob_measure(self, measure):
- if measure.type == "int" and random() < 0.33:
+ if measure.type == "int":
if random() < 0.5:
- value = measure.get_value()
- measure.add_value(value + randint(4, 12))
+ if random() < 0.66:
+ 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)
else:
- value = measure.get_value() - randint(3, 9)
- measure.add_value(value > 0 and value or 0)
+ measure.add_value(measure.get_value())
+
def run(self):
while True:
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-25 14:09:30 UTC (rev 1160)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-25 17:38:48 UTC (rev 1161)
@@ -107,7 +107,7 @@
}
.iblock {
- margin: 0;
+ margin: 1em 0;
padding: 0 1em;
}
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-25 14:09:30 UTC (rev 1160)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-25 17:38:48 UTC (rev 1161)
@@ -379,9 +379,16 @@
def render_title(self, session, queue):
return "History"
- def render_chart_url(self, session, queue):
- return "queue.png?id=%i" % queue.id
+ def render_queue_depth_chart_url(self, session, queue):
+ return "queue.png?id=%i;m=msgDepth;m=byteDepth" % queue.id
+ def render_consumers_chart_url(self, session, queue):
+ return "queue.png?id=%i;m=consumers" % queue.id
+
+ def render_transactions_chart_url(self, session, queue):
+ return "queue.png?id=%i;m=enqueueTxCount;m=dequeueTxCount" \
+ % queue.id
+
class ConsumerSet(ItemSet):
def render_title(self, session, queue):
return "Consumers (%i)" % len(queue.consumer_items())
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-10-25 14:09:30 UTC (rev 1160)
+++ mgmt/cumin/python/cumin/queue.strings 2007-10-25 17:38:48 UTC (rev 1161)
@@ -205,20 +205,26 @@
</tr>
</table>
+[StatisticsHistory.css]
+.chart img {
+ background-color: #f9f9f9;
+ border: 1px dotted #ddd;
+}
+
[StatisticsHistory.html]
<h2>Queue Depth</h2>
-<div class="iblock">
- <img src="{chart_url}"/>
+<div class="iblock chart">
+ <img src="{queue_depth_chart_url}"/>
</div>
<h2>Consumers</h2>
-<div class="iblock">
- <img src="{chart_url}"/>
+<div class="iblock chart">
+ <img src="{consumers_chart_url}"/>
</div>
<h2>Transactions</h2>
-<div class="iblock">
- <img src="{chart_url}"/>
+<div class="iblock chart">
+ <img src="{transactions_chart_url}"/>
</div>
[ConsumerSet.html]
17 years, 2 months
rhmessaging commits: r1160 - in mgmt: misc and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-25 10:09:30 -0400 (Thu, 25 Oct 2007)
New Revision: 1160
Added:
mgmt/cumin/python/cumin/charts.py
mgmt/misc/chart.py
Modified:
mgmt/cumin/python/cumin/__init__.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/notes/Todo
Log:
Adds a first rendition of charts for queue stats such as byte and
message depth.
Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py 2007-10-24 21:08:34 UTC (rev 1159)
+++ mgmt/cumin/python/cumin/__init__.py 2007-10-25 14:09:30 UTC (rev 1160)
@@ -11,6 +11,7 @@
from demo import DemoData
from page import CuminPage
from queue import QueueXmlPage
+from charts import QueueChartPage
class Cumin(Application):
def __init__(self, model):
@@ -34,6 +35,7 @@
self.add_page(RandomIntegerPage(self, "randint"))
self.add_page(DevelPage(self, "devel.html"))
self.add_page(QueueXmlPage(self, "queue.xml"))
+ self.add_page(QueueChartPage(self, "queue.png"))
class RandomIntegerPage(Page):
def __init__(self, app, name):
Added: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py (rev 0)
+++ mgmt/cumin/python/cumin/charts.py 2007-10-25 14:09:30 UTC (rev 1160)
@@ -0,0 +1,66 @@
+from cairo import *
+from random import random
+from wooly import *
+
+from parameters import *
+
+class LineChart(object):
+ def __init__(self, width, height):
+ self.width = width
+ self.height = height
+ self.surface = ImageSurface(FORMAT_ARGB32, width, height)
+
+ def plot_values(self, values, interval=5, color=(0, 0, 0)):
+ max_value = max(100, max(values) * 1.2)
+
+ ctx = Context(self.surface)
+ ctx.set_line_width(2)
+ ctx.set_source_rgb(*color)
+
+ for x, value in zip(range(0, self.width, interval), values):
+ y = (value / float(max_value)) * self.height
+ ctx.line_to(x, y)
+
+ ctx.stroke()
+
+ def plot_intervals(self, interval=40):
+ ctx = Context(self.surface)
+ ctx.set_line_width(0.5)
+ ctx.set_source_rgb(0.8, 0.8, 0.8)
+
+ for x in range(0, self.width, interval):
+ ctx.move_to(x, 0)
+ ctx.line_to(x, self.height)
+
+ ctx.stroke()
+
+ def write(self, name):
+ self.surface.write_to_png(name)
+
+class QueueChartPage(Page):
+ def __init__(self, app, name):
+ super(QueueChartPage, self).__init__(app, name)
+
+ self.param = QueueParameter(app, "id")
+ self.add_parameter(self.param)
+
+ def get_object(self, session, object):
+ return self.param.get(session)
+
+ def get_content_type(self, session):
+ return "image/png"
+
+ def do_render(self, session, queue):
+ messages = queue.get_measurement("msgDepth")
+ bytes = queue.get_measurement("byteDepth")
+
+ chart = LineChart(600, 120)
+ chart.plot_intervals()
+ chart.plot_values(messages.values, color=(1, 0, 0))
+ chart.plot_values(bytes.values, color=(0, 0, 1))
+
+ name = "/tmp/whoa.png"
+ chart.write(name)
+ file = open(name, "r")
+
+ return file.read()
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-24 21:08:34 UTC (rev 1159)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-25 14:09:30 UTC (rev 1160)
@@ -98,7 +98,6 @@
h2 {
font-size: 1em;
- font-weight: normal;
margin: 0 0 0.5em 0;
}
@@ -379,6 +378,10 @@
width: 20%;
}
+.browser .nav h2 {
+ font-weight: normal;
+}
+
.browser .nav ul {
margin: 0 0 1em 0;
}
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-24 21:08:34 UTC (rev 1159)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-25 14:09:30 UTC (rev 1160)
@@ -379,6 +379,9 @@
def render_title(self, session, queue):
return "History"
+ def render_chart_url(self, session, queue):
+ return "queue.png?id=%i" % queue.id
+
class ConsumerSet(ItemSet):
def render_title(self, session, queue):
return "Consumers (%i)" % len(queue.consumer_items())
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-10-24 21:08:34 UTC (rev 1159)
+++ mgmt/cumin/python/cumin/queue.strings 2007-10-25 14:09:30 UTC (rev 1160)
@@ -205,6 +205,22 @@
</tr>
</table>
+[StatisticsHistory.html]
+<h2>Queue Depth</h2>
+<div class="iblock">
+ <img src="{chart_url}"/>
+</div>
+
+<h2>Consumers</h2>
+<div class="iblock">
+ <img src="{chart_url}"/>
+</div>
+
+<h2>Transactions</h2>
+<div class="iblock">
+ <img src="{chart_url}"/>
+</div>
+
[ConsumerSet.html]
<select>
<option>Act on Selection...</option>
Added: mgmt/misc/chart.py
===================================================================
--- mgmt/misc/chart.py (rev 0)
+++ mgmt/misc/chart.py 2007-10-25 14:09:30 UTC (rev 1160)
@@ -0,0 +1,39 @@
+from cairo import *
+from random import random
+
+width, height = (600, 150)
+
+surface = ImageSurface(FORMAT_ARGB32, width, height)
+
+ctx = Context(surface)
+
+ctx.set_line_width(2)
+ctx.set_source_rgb(1, 0, 0)
+
+y = 0
+
+for x in range(0, width, 10):
+ change = 2 + (random() * 3)
+
+ if random() > 0.40:
+ if y < height - change:
+ y += change
+
+ else:
+ if y > change:
+ y -= change
+
+ ctx.line_to(x, y)
+
+ctx.stroke()
+
+ctx.set_line_width(0.8)
+ctx.set_source_rgb(0.8, 0.8, 0.8)
+
+for x in range(0, width, 50):
+ ctx.move_to(x, 0)
+ ctx.line_to(x, height)
+
+ctx.stroke()
+
+surface.write_to_png("chart.png")
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-24 21:08:34 UTC (rev 1159)
+++ mgmt/notes/Todo 2007-10-25 14:09:30 UTC (rev 1160)
@@ -107,3 +107,6 @@
* model: get rid of the old *_count stat fields and use the new ones
* Add rates to stats views
+
+ * Right now, non cumin pages don't print their stack traces in the
+ log
17 years, 2 months
rhmessaging commits: r1159 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: cctrieloff
Date: 2007-10-24 17:08:34 -0400 (Wed, 24 Oct 2007)
New Revision: 1159
Modified:
store/trunk/cpp/tests/OrderingTest.cpp
store/trunk/cpp/tests/SimpleTest.cpp
store/trunk/cpp/tests/TransactionalTest.cpp
store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
Log:
- sync async test fix
Modified: store/trunk/cpp/tests/OrderingTest.cpp
===================================================================
--- store/trunk/cpp/tests/OrderingTest.cpp 2007-10-24 16:49:23 UTC (rev 1158)
+++ store/trunk/cpp/tests/OrderingTest.cpp 2007-10-24 21:08:34 UTC (rev 1159)
@@ -104,7 +104,7 @@
void setup(bool async)
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- if (async) store->init("/var",async);
+ store->init("/var",async);
store->truncate();
queue = Queue::shared_ptr(new Queue(name, 0, store.get(), 0));
@@ -146,7 +146,7 @@
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- if (async) store->init("/var",async);
+ store->init("/var",async);
ExchangeRegistry exchanges;
DtxManager mgr(store.get());
RecoveryManagerImpl recoveryMgr(queues, exchanges, mgr, 0);
Modified: store/trunk/cpp/tests/SimpleTest.cpp
===================================================================
--- store/trunk/cpp/tests/SimpleTest.cpp 2007-10-24 16:49:23 UTC (rev 1158)
+++ store/trunk/cpp/tests/SimpleTest.cpp 2007-10-24 21:08:34 UTC (rev 1159)
@@ -113,7 +113,7 @@
void testEmptyRecover(bool async)
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
QueueRegistry registry(&store);
recover(store, registry);
@@ -126,7 +126,7 @@
void testCreateDelete(bool async)
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
string name("CreateDeleteQueue");
Queue queue(name, 0, &store, 0);
@@ -147,7 +147,7 @@
string name("MyDurableQueue");
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
store.create(queue);
@@ -156,7 +156,7 @@
}//db will be closed
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -174,7 +174,7 @@
string name("MyDurableQueue");
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
@@ -184,7 +184,7 @@
}//db will be closed
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -202,7 +202,7 @@
string name("MyDurableQueue");
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
store.create(queue);
@@ -210,7 +210,7 @@
}//db will be closed
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
QueueRegistry registry(&store);
recover(store, registry);
CPPUNIT_ASSERT(!registry.find(name));
@@ -233,7 +233,7 @@
string data2("hijklmn");
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
@@ -252,7 +252,7 @@
}//db will be closed
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -289,7 +289,7 @@
string messageId = "MyMessage";
string data("abcdefg");
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
@@ -304,7 +304,7 @@
}//db will be closed
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -325,7 +325,7 @@
const string data2("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
//create & stage a message
@@ -369,7 +369,7 @@
{
//recover
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
QueueRegistry registry(&store);
ExchangeRegistry exchanges;
DtxManager dtx(&store);
@@ -415,7 +415,7 @@
void testDestroyStagedMessage(bool async)
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
const string data("abcdefg");
@@ -438,7 +438,7 @@
void testDestroyEnqueuedMessage(bool async)
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
const string data("abcdefg");
@@ -471,7 +471,7 @@
args.setString("a", "A");
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
ExchangeRegistry registry;
Exchange::shared_ptr exchange = registry.declare(name, type, true, args).first;
@@ -481,7 +481,7 @@
}//db will be closed
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
ExchangeRegistry registry;
recover(store, registry);
@@ -495,7 +495,7 @@
}
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
ExchangeRegistry registry;
recover(store, registry);
@@ -519,7 +519,7 @@
FieldTable args;
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Exchange::shared_ptr exchange(new DirectExchange(exchangeName, true, args));
Queue::shared_ptr queue(new Queue(queueName, 0, &store, 0));
@@ -530,7 +530,7 @@
}//db will be closed
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
ExchangeRegistry exchanges;
QueueRegistry queues;
@@ -544,7 +544,7 @@
}
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
ExchangeRegistry exchanges;
QueueRegistry queues;
@@ -568,7 +568,7 @@
FieldTable args;
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
store.truncate();//make sure it is empty to begin with
Exchange::shared_ptr exchange(new DirectExchange(exchangeName, true, args));
Queue::shared_ptr queue1(new Queue(queueName1, 0, &store, 0));
@@ -583,7 +583,7 @@
}//db will be closed
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
ExchangeRegistry exchanges;
QueueRegistry queues;
@@ -599,7 +599,7 @@
}
{
BdbMessageStore store;
- if (async) store.init("/var",async);
+ store.init("/var",async);
ExchangeRegistry exchanges;
QueueRegistry queues;
Modified: store/trunk/cpp/tests/TransactionalTest.cpp
===================================================================
--- store/trunk/cpp/tests/TransactionalTest.cpp 2007-10-24 16:49:23 UTC (rev 1158)
+++ store/trunk/cpp/tests/TransactionalTest.cpp 2007-10-24 21:08:34 UTC (rev 1159)
@@ -95,7 +95,7 @@
void setup(bool async)
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- if (async) store->init("/var",async);
+ store->init("/var",async);
store->truncate();
//create two queues:
@@ -119,7 +119,7 @@
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- if (async) store->init("/var",async);
+ store->init("/var",async);
ExchangeRegistry exchanges;
DtxManager mgr(store.get());
RecoveryManagerImpl recovery(queues, exchanges, mgr, 0);
Modified: store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
===================================================================
--- store/trunk/cpp/tests/TwoPhaseCommitTest.cpp 2007-10-24 16:49:23 UTC (rev 1158)
+++ store/trunk/cpp/tests/TwoPhaseCommitTest.cpp 2007-10-24 21:08:34 UTC (rev 1159)
@@ -336,7 +336,7 @@
void setup()
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- if (async) store->init("/var",async);
+ store->init("/var",async);
store->truncate();
//create two queues:
@@ -361,7 +361,7 @@
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- if (async) store->init("/var",async);
+ store->init("/var",async);
ExchangeRegistry exchanges;
dtxmgr = std::auto_ptr<DtxManager>(new DtxManager(store.get()));
RecoveryManagerImpl recovery(queues, exchanges, *dtxmgr, 0);
17 years, 2 months