Merge lp:~lapsu/graphite/fix into lp:~graphite-dev/graphite/main

Proposed by Matthew Graham
Status: Merged
Merge reported by: Michael Leinartas
Merged at revision: not available
Proposed branch: lp:~lapsu/graphite/fix
Merge into: lp:~graphite-dev/graphite/main
Diff against target: 17 lines (+2/-2)
1 file modified
webapp/graphite/render/functions.py (+2/-2)
To merge this branch: bzr merge lp:~lapsu/graphite/fix
Reviewer Review Type Date Requested Status
Michael Leinartas Approve
Review via email: mp+87042@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Michael Leinartas (mleinartas) wrote :

I feel your bzr pain.. Feel free to just open a bug with a diff attached next time if it's less hassle.

I haven't run into a problem with this, but it is clear that the window should be an integer. I've merged it into the main branch.

Thanks for the fix!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'webapp/graphite/render/functions.py'
2--- webapp/graphite/render/functions.py 2011-12-24 22:58:49 +0000
3+++ webapp/graphite/render/functions.py 2011-12-28 20:57:23 +0000
4@@ -419,11 +419,11 @@
5
6 """
7 for seriesIndex, series in enumerate(seriesList):
8- newName = "movingAverage(%s,%.1f)" % (series.name, float(windowSize))
9+ newName = "movingAverage(%s,%d)" % (series.name, windowSize)
10 newSeries = TimeSeries(newName, series.start, series.end, series.step, [])
11 newSeries.pathExpression = newName
12
13- windowIndex = windowSize - 1
14+ windowIndex = int(windowSize - 1)
15
16 for i in range( len(series) ):
17 if i < windowIndex: # Pad the beginning with None's since we don't have enough data