Author: justi9
Date: 2007-11-05 10:49:48 -0500 (Mon, 05 Nov 2007)
New Revision: 1232
Modified:
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/measurement.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/queue.py
mgmt/notes/justin-todo.txt
Log:
Makes some values in the stats view link to relevant tabs.
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-11-05 13:38:46 UTC (rev 1231)
+++ mgmt/cumin/python/cumin/exchange.py 2007-11-05 15:49:48 UTC (rev 1232)
@@ -76,6 +76,14 @@
def render_item_status(self, session, exchange):
return status(len(exchange.errors), len(exchange.warnings))
+def show_producers(page, session, exchange):
+ frame = page.show_exchange(session, exchange).show_view(session)
+ return frame.show_producers(session)
+
+def show_bindings(page, session, exchange):
+ frame = page.show_exchange(session, exchange).show_view(session)
+ return frame.show_bindings(session)
+
class ExchangeFrame(CuminFrame):
def __init__(self, app, name):
super(ExchangeFrame, self).__init__(app, name)
@@ -88,6 +96,13 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
+ # XXX not awesome
+ def get_object(self, session, object):
+ exchange = self.param.get(session)
+ exchange.get_measurement("producers").link_cb = show_producers
+ exchange.get_measurement("bindings").link_cb = show_bindings
+ return exchange
+
def render_title(self, session, exchange):
return "Exchange '%s'" % exchange.name
@@ -105,9 +120,19 @@
self.add_child(self.tabs)
self.tabs.add_tab(ExchangeStatistics(app, "stats"))
- self.tabs.add_tab(ExchangeProducerSet(app, "producers"))
- self.tabs.add_tab(ExchangeBindingSet(app, "bindings"))
+ self.producers = ExchangeProducerSet(app, "producers")
+ self.tabs.add_tab(self.producers)
+
+ self.bindings = ExchangeBindingSet(app, "bindings")
+ self.tabs.add_tab(self.bindings)
+
+ def show_producers(self, session):
+ self.tabs.show_mode(session, self.producers);
+
+ def show_bindings(self, session):
+ self.tabs.show_mode(session, self.bindings);
+
def render_title(self, session, exchange):
return "Exchange '%s'" % exchange.name
Modified: mgmt/cumin/python/cumin/measurement.py
===================================================================
--- mgmt/cumin/python/cumin/measurement.py 2007-11-05 13:38:46 UTC (rev 1231)
+++ mgmt/cumin/python/cumin/measurement.py 2007-11-05 15:49:48 UTC (rev 1232)
@@ -17,10 +17,15 @@
self.category = category
- def get_items(self, session, queue):
- measures = list(queue.measurements)
+ self.object = Attribute(app, "object");
+ self.add_attribute(self.object);
- for measure in queue.measurements:
+ def get_items(self, session, object):
+ self.object.set(session, object);
+
+ measures = list(object.measurements)
+
+ for measure in object.measurements:
if self.category not in measure.categories:
measures.remove(measure)
@@ -30,7 +35,12 @@
return measure.title
def render_item_value(self, session, measure):
- return measure.get_value()
+ if measure.link_cb:
+ branch = session.branch()
+ measure.link_cb(self.page(), branch, self.object.get(session))
+ return link(branch.marshal(), measure.get_value())
+ else:
+ return measure.get_value()
def render_item_extra(self, session, measure):
if measure.highlow:
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-05 13:38:46 UTC (rev 1231)
+++ mgmt/cumin/python/cumin/model.py 2007-11-05 15:49:48 UTC (rev 1232)
@@ -327,6 +327,7 @@
self.__value = None
self.__values = list()
self.class_ = class_
+ self.link_cb = None
self.highlow = False
self.__high = None
@@ -435,6 +436,12 @@
measure.categories = ("byte", "general")
self.measurements.append(measure)
+ measure = Measurement("unackedMessages", "int")
+ measure.title = "Msgs. Unacked"
+ measure.unit = "message"
+ measure.categories = ("general")
+ self.measurements.append(measure)
+
measure = Measurement("consumers", "int")
measure.title = "Consumers"
measure.unit = "consumer"
@@ -442,10 +449,11 @@
measure.highlow = True
self.measurements.append(measure)
- measure = Measurement("unackedMessages", "int")
- measure.title = "Msgs. Unacked"
- measure.unit = "message"
+ measure = Measurement("bindings", "int")
+ measure.title = "Bindings"
+ measure.unit = "binding"
measure.categories = ("general")
+ measure.highlow = True
self.measurements.append(measure)
# Disk
@@ -633,13 +641,6 @@
self.errors = list()
self.warnings = list()
- measure = Measurement("bindings", "int")
- measure.title = "Bindings"
- measure.unit = "binding"
- measure.categories = ("general")
- measure.highlow = True
- self.measurements.append(measure)
-
measure = Measurement("msgReceives", "int")
measure.title = "Msgs. Received"
measure.unit = "message"
@@ -676,6 +677,20 @@
measure.categories = ("byte", "general")
self.measurements.append(measure)
+ measure = Measurement("producers", "int")
+ measure.title = "Producers"
+ measure.unit = "producer"
+ measure.categories = ("general")
+ measure.highlow = True
+ self.measurements.append(measure)
+
+ measure = Measurement("bindings", "int")
+ measure.title = "Bindings"
+ measure.unit = "binding"
+ measure.categories = ("general")
+ measure.highlow = True
+ self.measurements.append(measure)
+
def remove(self):
for binding in self.binding_items().copy():
binding.remove()
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-05 13:38:46 UTC (rev 1231)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-05 15:49:48 UTC (rev 1232)
@@ -69,6 +69,14 @@
def render_item_status(self, session, queue):
return status(len(queue.errors), len(queue.warnings))
+def show_consumers(page, session, queue):
+ frame = page.show_queue(session, queue).show_view(session)
+ return frame.show_consumers(session)
+
+def show_bindings(page, session, queue):
+ frame = page.show_queue(session, queue).show_view(session)
+ return frame.show_bindings(session)
+
class QueueFrame(CuminFrame):
def __init__(self, app, name):
super(QueueFrame, self).__init__(app, name)
@@ -81,6 +89,13 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
+ # XXX not awesome
+ def get_object(self, session, object):
+ queue = self.param.get(session)
+ queue.get_measurement("consumers").link_cb = show_consumers
+ queue.get_measurement("bindings").link_cb = show_bindings
+ return queue
+
def render_title(self, session, queue):
return "Queue '%s'" % queue.name
@@ -132,9 +147,19 @@
self.add_child(self.tabs)
self.tabs.add_tab(QueueStatistics(app, "stats"))
- self.tabs.add_tab(QueueConsumerSet(app, "consumers"))
- self.tabs.add_tab(QueueBindingSet(app, "bindings"))
+ self.consumers = QueueConsumerSet(app, "consumers")
+ self.tabs.add_tab(self.consumers)
+
+ self.bindings = QueueBindingSet(app, "bindings")
+ self.tabs.add_tab(self.bindings)
+
+ def show_consumers(self, session):
+ self.tabs.show_mode(session, self.consumers);
+
+ def show_bindings(self, session):
+ self.tabs.show_mode(session, self.bindings);
+
def render_title(self, session, queue):
return "Queue '%s'" % queue.name
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-11-05 13:38:46 UTC (rev 1231)
+++ mgmt/notes/justin-todo.txt 2007-11-05 15:49:48 UTC (rev 1232)
@@ -4,16 +4,10 @@
- Find/connect in bulk
- * queue: link bindings, consumers stat to respective views
+ * Queue: Add created, deleted, updated timestamps
- * exch: link bindings, producers stats to respective views
-
- * Make queue status ajaxy again
-
Deferred
- * Queue: Add created, deleted, updated timestamps
-
* Queue: Add a msg enq rate msg deq rate chart
* Make the status lights also be links to an appropriate view