.rollup() function is used to aggregate your metrics data inherently in every metrics query. However, appending the
.rollup() function at the end of a query allows you to perform custom time aggregation that overrides the defaults. This function enables you to define:
<interval>: the interval of time your data is aggregated over (if larger than the query-enforced rollup interval).
<aggregator>: How your data points are aggregated within a given rollup time interval.
Note: The Distribution Metric type does not have a rollup
aggregator parameter. This metric type is aggregated both in time and space. See the documentation on rollup for distributions with percentiles to learn more.
The function takes two parameters,
<AGGREGATOR> and optionally
|Can be |
|Time (in seconds) of the interval between two data points displayed. Optional.|
You can use them individually or together, for instance
.rollup(sum,120). The following bar graph displays a week’s worth of CPU usage for a host without using the
The following bar graph displays the same metric, graphed using a day-long rollup with
|Rollup to combine the points in the last X seconds.|
moving_rollup() function to a query allows you to combine points from the most recent specified time range—that is, the last X seconds. Like with
<AGGREGATOR> can be
avg and defines how data points are aggregated within the given time interval.
When graphing, Datadog imposes a limit on the number of points per graph. To respect this limit, Datadog rolls up data points automatically with the
avg method, effectively displaying the average of all data points within a time interval for a given metric. This default time interval varies depending on how the data is being visualized. See the following chart to reference these default time intervals:
|Timeframe||Rollup Interval, Line Graph||Rollup Interval, Bar Graph||Rollup Interval, API|
|The past hour||20s||1m||20s|
|The past four hours||1m||2m||1m|
|The past day||5m||20m||5m|
|The past two days||10m||30m||10m|
|The past week||1hr||2hr||1hr|
|The past month||2hr||12hr||4hr|
.rollup() function can be used to enforce the type of time aggregation applied (
sum) and the time interval to rollup. However, if a custom
.rollup() function is applied and uses a smaller time interval than the Datadog limit, the Datadog limit is used instead while still using the specified rollup method. For example, if you’re requesting
.rollup(20) for a month-long window, data is returned at a rollup greater than 20 seconds in order to prevent returning more than allotted number of points.
Note: Queries for
RATE type metrics have the
.as_count() modifier appended automatically in the UI, which sets the rollup method used to
sum and disables interpolation. This
.as_count() is explicitly visible at the end of the query:
Rollups should usually be avoided in monitor queries, because of the possibility of misalignment between the rollup interval and the evaluation window of the monitor. The start and end of rollup intervals are aligned to UNIX time, not to the start and end of monitor queries. Therefore, a monitor may evaluate (and trigger on) an incomplete rollup interval containing only a small sample of data. To avoid this issue, delay the evaluation of your monitor by (at least) the length of the setup rollup interval.
Consult the other available functions: