Skip to content

Commit

Permalink
Make summarize() with alignToFrom=true actually work
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Nov 22, 2011
1 parent 4f9165d commit 600c6f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions webapp/graphite/render/evaluator.py
Expand Up @@ -38,6 +38,8 @@ def evaluateTokens(requestContext, tokens):
elif tokens.string:
return str(tokens.string)[1:-1]

elif tokens.boolean:
return tokens.boolean[0] == 'true'


#Avoid import circularities
Expand Down
2 changes: 1 addition & 1 deletion webapp/graphite/render/functions.py
Expand Up @@ -1636,7 +1636,7 @@ def summarize(requestContext, seriesList, intervalString, func='sum', alignToFro
if alignToFrom:
newEnd += interval

newName = "summarize(%s, \"%s\")" % (series.name, intervalString)
newName = "summarize(%s, \"%s\", \"%s\"%s)" % (series.name, intervalString, func, alignToFrom and ", true" or "")
newSeries = TimeSeries(newName, newStart, newEnd, interval, newValues)
newSeries.pathExpression = newName
results.append(newSeries)
Expand Down
6 changes: 6 additions & 0 deletions webapp/graphite/render/grammar.py
Expand Up @@ -23,8 +23,14 @@
(intNumber + afterNumber)
)('number')

boolean = Group(
CaselessKeyword("true") |
CaselessKeyword("false")
)('boolean')

# Function calls
arg = Group(
boolean |
number |
aString |
expression
Expand Down

0 comments on commit 600c6f6

Please sign in to comment.