Rollup
Rollup is Datadog's time aggregation that groups metric data points into time intervals and folds each interval into a single point. It determines the spacing between points on a graph and whether the values within an interval are folded by average or by sum.
Overview
Datadog metric queries are always folded along the time axis before they are drawn, even if you specify nothing. The .rollup() function is how you decide this folding yourself instead of leaving it to the display. It is the first concept to check in situations such as a peak disappearing just because you changed the display period from 1 hour to 1 week, the total of a count metric being smaller than expected, or the numbers for the same query not matching between a monitor and a dashboard. The default interval changes with the display period and the type of graph, so you need to align the intervals before comparing numbers.
The process that folds the points in an interval into one
Every metric query returns values aggregated along the time axis. What overrides the default folding is .rollup(<AGGREGATOR>,<INTERVAL>), appended to the end of the query (as of October 2026; Source: Rollup). <AGGREGATOR> is how the points in an interval are folded, chosen from avg / sum / min / max / count, and it is avg if not specified. <INTERVAL> is the number of seconds between the points drawn, and it can be omitted. This is a separate stage from space aggregation, which combines across hosts and tags, and the relationship between the two stages is left to Metric Types. The DISTRIBUTION type has no <AGGREGATOR> specification and is aggregated in both time and space.
How extending the period widens the interval
There is a limit on the number of points in a single series drawn on a graph, and for line graphs and bar graphs it is 1,500 points (as of October 2026; Source: Rollup). As the period lengthens, the interval widens to stay within the limit, and the points in the interval are automatically folded with the default avg. The default interval is determined by the combination of the period and the way the graph is drawn.
| Display period | Line graph | Bar graph |
|---|---|---|
| Past 1 hour | 20 seconds | 1 minute |
| Past 4 hours | 1 minute | 2 minutes |
| Past 1 day | 5 minutes | 20 minutes |
| Past 1 week | 1 hour | 2 hours |
| Past 1 month | 4 hours | 12 hours |
The Metrics overview page gives an example of folding 4 hours into 2-minute intervals, but the interval changes with how the graph is drawn, and in this table it is 1 minute for line graphs and 2 minutes for bar graphs. For a series folded with avg, even over the same 1 week, one bar in a bar graph is the average of 2 hours, so short peaks are smoothed out and appear lower than in a line graph. The Query Value Widget has a target of 150 points, so for the same period the interval becomes coarser still. You can widen the interval with .rollup(), but you cannot make it finer than the 1,500-point limit allows; for 1 day, that is at most one point per minute.
Folding counts with avg makes the total come out small
When an interval is folded with avg, the value of one point becomes the average of the points in the interval. When you view a count such as the number of requests as one bar per day, leaving it as an average means the height of the bar is not the total for the day. If you want the total, append .rollup(sum), and if you also want to set the interval, add the number of seconds, as in .rollup(sum,86400) (as of October 2026; Source: Rollup). For queries of the COUNT type and the RATE type, .as_count() is automatically added in the UI, the folding becomes sum, and interpolation is disabled. Only these two types get it automatically, so a metric whose counts were sent as a GAUGE is still folded with avg. You can check the correspondence between types and how they are sent in Metric Types.
Fold by the most recent seconds, or divide by the calendar?
moving_rollup(<METRIC_NAME>, <INTERVAL>, <AGGREGATOR>) is a function that combines the specified number of most recent seconds for each point (as of October 2026; Source: Rollup). The folding is chosen from the same five options as .rollup(). The boundaries of intervals in seconds align to UNIX time (the monitors section of the same page), so an 86400-second interval works out to break at midnight UTC, which is 9:00 a.m. Japan time. When dividing by calendar day, week, or month, pass daily / weekly / monthly instead of a number of seconds. The syntax is .rollup(<AGGREGATOR>, <CALENDAR_UNIT>, <ALIGNMENT>, '<TIMEZONE>'). If you omit the start of the week it is Sunday, and if you omit the time zone it is UTC, so to divide days by Japan time, specify the name in IANA format.
Why do you want to avoid rollups in monitors?
The official documentation recommends, as a rule, avoiding rollups in monitor queries (as of October 2026; Source: Rollup). This is because the boundaries of the intervals do not align with the boundaries of the monitor's evaluation window. At the time of evaluation, the monitor may read an interval that has received only some of its points, and an alert may fire on that small value. The remedy if you do use one is to delay the evaluation by at least the length of the rollup interval. When a monitor unexpectedly goes to No Data, the combination of rollup and evaluation window is also listed as something to review. The overall monitor settings are summarized in Monitors. Look for queries containing .rollup( in your monitors, and check them one by one to see whether the evaluation delay is shorter than that interval.