2012-04-25 08:44:44 by jdixon
Let's say you want to compare how a particular metric compares to some point in the past. This is a common practice in troubleshooting and capacity planning. What's the best way to achieve this in Graphite?
I might start off by selecting the past four weeks and visually discern the trends from week to week. Here's a graph showing the last month of AMQP activity. We can see that traffic was oscillating quite a bit over the first week and a half before smoothing out and gradually trending downward.
That's useful, but what if we want to directly correlate the activity between now and the same time two weeks ago? This is where the timeShift() function comes in. Let's take a look at the same 4-week period, but this time we'll review two weeks of current data and overlay it with a time-shifted span of the two weeks prior.
Note: If you weren't already aware, you can add the same metric to a graph multiple times by manually adding it via the Graph Data panel or by applying a function to the original metric before you add it again through the Tree or Auto-Completer.
Now we're talking. I don't know about you, but my brain has a much easier time processing this view. We can easily correlate the changes over these two 2-week cycles. And it's almost as if the composer window is wrapping the data for us from one interval to the next.
But what if we want to view each week as a discrete interval over the last month? Let's crank it up a notch.
There are definitely some interesting patterns in there to dive into later. In particular, I'm curious how much we're actually changing from week to week.
Let's go back to our previous example. Except this time we'll add a composite representing the percentage of our current data against its respective 2-week-prior value.
(Click on image for a full-size version)
Go forth and timeShift, my young Padawans.