[rhmessaging-commits] rhmessaging commits: r4269 - mgmt/newdata/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Sep 9 15:08:08 EDT 2010


Author: eallen
Date: 2010-09-09 15:08:08 -0400 (Thu, 09 Sep 2010)
New Revision: 4269

Modified:
   mgmt/newdata/cumin/python/cumin/stat.py
Log:
Turn sample averaging on for rate charts.

Modified: mgmt/newdata/cumin/python/cumin/stat.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/stat.py	2010-09-09 19:06:43 UTC (rev 4268)
+++ mgmt/newdata/cumin/python/cumin/stat.py	2010-09-09 19:08:08 UTC (rev 4269)
@@ -330,12 +330,8 @@
         if interval != -1:
             return interval
         else:
-            mode = self.mode.get(session)
-            if mode == "rate":
-                return 1
-            else:
-                max_samples = int(width * 1.5)
-                return max(int(duration / max_samples), 1)
+            max_samples = int(width * 1.5)
+            return max(int(duration / max_samples), 1)
 
     def render_samples(self, session, recent):
         c = {(1,0,0): "red", (0,0,1): "blue", (0,1,0): "green"}
@@ -364,10 +360,10 @@
         if self.samples.get(session):
             return self.render_samples(session, recent)
 
-        if recent:
-            cached_png = self.get_cached(session, recent)
-            if cached_png:
-                return cached_png
+        #if recent:
+        #    cached_png = self.get_cached(session, recent)
+        #    if cached_png:
+        #        return cached_png
 
         samples = dict()
         values = dict()
@@ -381,7 +377,8 @@
         chart = TimeSeriesChart(width, height, interval=interval)
 
         if mode == "rate":
-            method = None # don't do averaging
+            #method = None # don't do averaging
+            method = self.method.get(session)
             for stat in stats:
                 os = adapter.samples(stat, duration, interval, method)
                 ns = list()
@@ -414,6 +411,10 @@
         max_value = deviated_values and max(max(deviated_values)) or 1
         min_value = deviated_values and min(min(deviated_values)) or 0
 
+        # convert from decimal to float to avoid exceptions
+        max_value = float(max_value)
+        min_value = float(min_value)
+
         max_value = round(max_value * 1.1 + 1)
 
         if min_value < 0:
@@ -733,8 +734,8 @@
         return False
 
     def fix_method(self, method, mode):
-        if mode == "rate":
-            return None
+        #if mode == "rate":
+        #    return None
         return method
 
     def create(self, session, adapter, stats):



More information about the rhmessaging-commits mailing list