Calculate relative difference over time period

Asked by Stein Bjørndal

I'm trying to make a dashboard that displays the relative offset of the values over the selected time period. The goal is to present a single-stat value (in Grafana) which simply show how many percent the final value is changed in comparison with the initial one.

Calculating this manually is trivial, but I'm struggling to find a method to use in graphite to do the same and have a feeling I'm missing something obvious. I've played around with most of the functions, but nothing gives me the result that I expect.

Additional info: This is meant to go into a scripted Grafana dashboard to display growth of our many volumes with single-stat values and color coding when outside normal growth patterns. We will miss the potential volatile changes over the time period, but are not too concerned about that for this purpose, it's more a capacity control and planning tool for managers.

Any pointers would be welcome.

Question information

Language:
English Edit question
Status:
Solved
For:
Graphite Edit question
Assignee:
No assignee Edit question
Solved by:
Stein Bjørndal
Solved:
Last query:
Last reply:
Revision history for this message
Stein Bjørndal (stein-bjorndal) said :
#1

I've managed to solve this with some help over at stackexchange. The slightly convoluted query is in the form of:

asPercent(absolute(diffSeries(my_metric, timeShift(my_metric, '30d'))), timeShift(my_metric, '30d'))

The only downside to this approach is the fixed time period. I'd very much like to have a dynamic variable that could be adjusted by a user viewing the dashboard, but this will do for now.