← Back to team overview

graphite-dev team mailing list archive

[Merge] lp:~lapsu/graphite/fix into lp:graphite

 

Matthew Graham has proposed merging lp:~lapsu/graphite/fix into lp:graphite.

Requested reviews:
  graphite-dev (graphite-dev)

For more details, see:
https://code.launchpad.net/~lapsu/graphite/fix/+merge/87042

movingAverage makes the window size a float when generating the new name (even though the window size must be an integer). When bootstrapping holt-winters with the moving average function, this broke things. Now movingAverage doesn't convert to a float and casts it back to an integer if it does come in as a float.

Also, I don't really understand bzr and it took me quite a bit longer to get this patch on launchpad than it took to make it. I would definitely support a move to a git backed hosting service in case anyone is thinking about it.
-- 
https://code.launchpad.net/~lapsu/graphite/fix/+merge/87042
Your team graphite-dev is requested to review the proposed merge of lp:~lapsu/graphite/fix into lp:graphite.
=== modified file 'webapp/graphite/render/functions.py'
--- webapp/graphite/render/functions.py	2011-12-24 22:58:49 +0000
+++ webapp/graphite/render/functions.py	2011-12-28 20:57:23 +0000
@@ -419,11 +419,11 @@
 
   """
   for seriesIndex, series in enumerate(seriesList):
-    newName = "movingAverage(%s,%.1f)" % (series.name, float(windowSize))
+    newName = "movingAverage(%s,%d)" % (series.name, windowSize)
     newSeries = TimeSeries(newName, series.start, series.end, series.step, [])
     newSeries.pathExpression = newName
 
-    windowIndex = windowSize - 1
+    windowIndex = int(windowSize - 1)
 
     for i in range( len(series) ):
       if i < windowIndex: # Pad the beginning with None's since we don't have enough data