[rhmessaging-commits] rhmessaging commits: r4319 - in mgmt/newdata/cumin: resources and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Sep 21 13:59:25 EDT 2010


Author: eallen
Date: 2010-09-21 13:59:24 -0400 (Tue, 21 Sep 2010)
New Revision: 4319

Modified:
   mgmt/newdata/cumin/python/cumin/model.py
   mgmt/newdata/cumin/python/cumin/stat.py
   mgmt/newdata/cumin/python/cumin/stat.strings
   mgmt/newdata/cumin/resources/app.js
Log:
Fix for BZ 635880: Charts were dropping samples when a new sample caused a re-scaling of the y-axis.

Modified: mgmt/newdata/cumin/python/cumin/model.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/model.py	2010-09-21 15:53:24 UTC (rev 4318)
+++ mgmt/newdata/cumin/python/cumin/model.py	2010-09-21 17:59:24 UTC (rev 4319)
@@ -480,6 +480,7 @@
         stat_col = self.table._columns_by_name[stat.name]
         updated_col = self.table._columns_by_name[self.qmf_update_col]
 
+        org_filters = list(self.query.filters)
         max_col = "max(%s) as interval_end" % updated_col.identifier
         value_col = "cast(avg(%s) as integer) as value" % stat_col.identifier
         dev_col = "stddev(%s) as dev" % stat_col.identifier
@@ -494,10 +495,11 @@
         filter = SqlComparisonFilter(updated_col, when, ">=")
         self.query.add_filter(filter)
         when2 = ""
+        filter2 = None
         if secs2:
             when2 = "now() - interval '%i seconds'" % int(secs2)
-            filter = SqlComparisonFilter(updated_col, when2, "<=")
-            self.query.add_filter(filter)
+            filter2 = SqlComparisonFilter(updated_col, when2, "<=")
+            self.query.add_filter(filter2)
 
         options = SqlQueryOptions()
         options.sort_column = "interval_end"
@@ -505,12 +507,18 @@
         options.group_column = "floor(extract(epoch from %s) / %i)" % (updated_col.identifier, interval)
 
         samples = self.get_data({}, options)
+
+        # reset the filters in case we need to re-run the query in this same request
+        del self.query.filters[:]
+        self.query.filters = org_filters
+
         return samples
 
     def samples(self, stat, secs, interval, method, secs2=0, delta=False):
         if method == "avg":
             return self.avg_samples(stat, secs, interval, secs2)
 
+        org_filters = list(self.query.filters)
         stat_col = self.table._columns_by_name[stat.name]
         updated_col = self.table._columns_by_name[self.qmf_update_col]
 
@@ -537,6 +545,11 @@
             options.limit = 2
 
         samples = self.get_data({}, options)
+
+        # restore the filters
+        del self.query.filters[:]
+        self.query.filters = org_filters
+
         return samples
 
     def recent(self):

Modified: mgmt/newdata/cumin/python/cumin/stat.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/stat.py	2010-09-21 15:53:24 UTC (rev 4318)
+++ mgmt/newdata/cumin/python/cumin/stat.py	2010-09-21 17:59:24 UTC (rev 4319)
@@ -112,6 +112,7 @@
         # it's converted to %3A, so we have to change it
         params.append("agent=%s" % object._qmf_agent_id.replace(":", "|"))
 
+        params.append("id=%s" % object._id)
         params.append("object_id=%s" % object._qmf_object_id)
         params.append("chart_id=%s" % self.render_id(session, None))
         params.append("duration=%s" % self.duration.get(session))
@@ -479,6 +480,9 @@
         self.object_id = StringParameter(app, "object_id")
         self.add_parameter(self.object_id)
 
+        self.id = StringParameter(app, "id")
+        self.add_parameter(self.id)
+
         self.rosemary_class = Parameter(app, "rcls")
         self.add_parameter(self.rosemary_class)
 
@@ -524,14 +528,12 @@
                 rosemary_package = self.app.model._packages_by_name[rpackage]
                 rosemary_class = rosemary_package._classes_by_name[rclass]
 
-                object_id =  self.widget.object_id.get(session)
-                #id = self.widget.id.get(session)
+                id =  self.widget.id.get(session)
                 conn = self.app.database.get_connection()
                 cursor = conn.cursor()
 
                 try:
-                    obj = rosemary_class.get_object(cursor, _qmf_object_id=object_id)
-                    #obj = rosemary_class.get_object_by_id(cursor, id)
+                    obj = rosemary_class.get_object(cursor, _id=id)
                 finally:
                     cursor.close()
 
@@ -715,7 +717,8 @@
         if e:
             elapsed = self.get_elapsed(session)
             if elapsed['seconds'] <= self.one_day:
-                duration = elapsed['seconds'] + 1
+                # allow some overlap so we don't drop samples
+                duration = elapsed['seconds'] + 3
         else:
             duration = self.get_time_span(session)
         return duration

Modified: mgmt/newdata/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/stat.strings	2010-09-21 15:53:24 UTC (rev 4318)
+++ mgmt/newdata/cumin/python/cumin/stat.strings	2010-09-21 17:59:24 UTC (rev 4319)
@@ -351,7 +351,7 @@
         window.addEvent('resize', function () {
             var chart = cumin.getFlashChart('{id}');
             if (chart) {
-                chart.height = window.getSize().y - 170;
+                chart.height = window.getSize().y * 0.96;
             }
         });
     }

Modified: mgmt/newdata/cumin/resources/app.js
===================================================================
--- mgmt/newdata/cumin/resources/app.js	2010-09-21 15:53:24 UTC (rev 4318)
+++ mgmt/newdata/cumin/resources/app.js	2010-09-21 17:59:24 UTC (rev 4319)
@@ -262,8 +262,8 @@
             params += ', top=0, left=0'
             params += ', fullscreen=yes';
             var branch = wooly.session.branch(fullpage_url);
-            branch['width'] = screen.width - 40;
-            branch['height'] = screen.height - 300;
+            branch['width'] = Math.floor(screen.width * 0.96);
+            branch['height'] = Math.floor(screen.height * 0.96);
 
             var newwin = window.open(branch.marshal(), 'cuminflash', params);
             if (window.focus) {
@@ -494,3 +494,7 @@
     th.appendChild(s);
 }
 addJavascript('resource?name=incrementalSearch.js', 'head');
+
+function ofc_debug(msg) {
+    wooly.log(msg);
+}



More information about the rhmessaging-commits mailing list