Comment 3 for bug 850475

Revision history for this message
chrismd (chrismd) wrote :

This behavior is actually by design. What is happening is that in the 20 hour graph you're requesting more datapoints than there are pixels available in the graph, try the same request with a wider image and it'll go back to the values you expect. Whenever this happens (more datapoints than pixels), graphite has to aggregate the datapoints. Graphite doesn't know how you want to aggregate the datapoints (yet, this is in the works) so by default it simply averages them. You can change this to summing instead by applying the cumulative() function to the expression but this still leaves you with the problem of not being entirely sure exactly how much aggregation has taken place. It stinks but its the best we can do for default behavior not know more about the user's intentions. What you can do to explicitly specify your desired aggregation behavior is to use the summarize() function.

For some reason summarize() is missing from the docs despite having a proper docstring so I'll look into that, in the mean time the basic usage is this:

summarize(foo.bar.mymetric, "15m", "sum")

The first arg is obviously your metric expression.
The second arg is the size of the time period that the aggregate datapoints wil cover, 15 minutes for each datapoint in this case.
The third arg is the aggregation function and can be: sum, avg, max, min, or last.

I hope that helps.