Timeshift

Here is a set of functions of the pattern <TIMEPERIOD>_before(). These functions display the values from the corresponding time period on the graph. On their own, they may not be of high value, but together with the current values they may provide useful insight into the performance of your application.

Timeshift

FunctionDescriptionExample
timeshift()Graph values from an arbitrary <TIME_IN_SECOND> before the current timestamp for the metric.timeshift(<METRIC_NAME>{*}, -<TIME_IN_SECOND>)

For example, if you wanted to use this to compare current system load with load from 2 weeks ago (60*60*24*14 = 1209600), your query would be:

timeshift(avg:system.load.1{*}, -1209600)

Hour before

FunctionDescriptionExample
hour_before()Graph values from an hour before the current timestamp for the metric.hour_before(<METRIC_NAME>{*})

Here is an example of system.load.1 with the hour_before() value shown as a dotted line. In this particular example, you can see the machine was started at 6:30am and the hour_before() values show up at the 7:30 mark. Of course, this example was created specifically so that you can see the hour_before() values match up with the actual values.

simple hour before example

Day before

FunctionDescriptionExample
day_before()Graph values from a day before the current timestamp for the metric.day_before(<METRIC_NAME>{*})

Here is an example of nginx.net.connections with the day_before() value shown as a lighter, thinner line. In this example, you can see a week’s worth of data, which makes the day_before() data easier to identify.

simple day before example

Week before

FunctionDescriptionExample
week_before()Graph values from a week (7 days) before the current timestamp for the metric.week_before(<METRIC_NAME>{*})

Here is an example of cassandra.db.read_count with the week_before() value shown as a dotted line. In this example, you can see about three weeks’ worth of data, which makes the week_before() data easier to identify.

simple week before example

Month before

FunctionDescriptionExample
month_before()Graph values from a month (28 days / 4 weeks) before the current timestamp for the metric.month_before(<METRIC_NAME>{*})

Here is an example of aws.ec2.cpuutilization with the month_before() value shown as a thin, solid line.

simple month before example

Calendar shift

The calendar shift feature is only available for Cloud Cost data sources on private dashboards.
FunctionDescriptionExample
calendar_shift()Graph values from the previous day, week, or month from the current timestamp for the metric.calendar_shift(<METRIC_NAME>{*})

To access the calendar_shift() function click the Add function button, select Timeshift > Month before. The calendar shift allows you to compare the same metric across equivalent timeframes. Here is an example of cloud cost metric aws.cost.net.amortized with the calendar_shift() value from two weeks ago compared to the current value.

Example of a calendar_shift() function used to compare the `aws.cost.net.amortized ` metric value from two weeks ago and the present

Other functions


Further Reading

Additional helpful documentation, links, and articles: