Search code examples
graphitegrafana

How to compare cumulative counter vs the best, average and worst using Graphite?


I have a counter that measures the number items sold every 10 minutes. I currently use this to track the cumulative number of items:

alias(integral(app.items_sold), 'Today')

And it looks like this:

today's data

Now, what I want to do to show how well we were are doing TODAY vs best, avg (or may median) worst day we've had for the past say 90 days. I tried something like this:

alias(integral(maxSeries(timeStack(app.items_sold, '1d', 0, 90))),'Max') 
alias(integral(averageSeries(timeStack(app.items_sold, '1d', 0,90))), 'Avg')    
alias(integral(minSeries(timeStack(app.items_sold, '1d',0, 90))), 'Min')

today's vs max/avg/min

which looks great but actually shows me the cumulative amount of all the max, avg and min for all series interval.

Can anyone suggest a way to achieve what I'm looking for? i.e. determine what the best (and worst and median) day was for the past 90 days and plot that. Can it be done using purely Graphite functions?

Thanks.


Solution

  • The answer was to just flip the order to the function calls: (maxSeries before integral)

    Thanks to turner on the grafana@groups.io board for the answer

    alias(maxSeries(integral(timeStack(app.items_sold, '1d', 0, 90))),'Max')
    alias(averageSeries(integral(timeStack(app.items_sold, '1d', 0,90))), 'Avg')
    alias(minSeries(integral(timeStack(app.items_sold, '1d',0, 90))), 'Min')