Search code examples
datadog

Graphing a cumulative sum of a metric, instead of an average, in a zoomed out Datadog view


I'm trying to graph a custom gauge metric in Datadog, and it works when I zoom in on part of the time frame. As you can see in the first screenshot, there are 3 distinct custom metrics graphed, with values of 5, 15, and 10, respectively. But then when I zoom out (in the second screenshot), those three distinct metrics get collapsed to their average (10). Does anyone know how to make the zoomed out view a cumulative sum, instead of an average? I don't see a way of modifying that setting.

3 distinct metricscollapsed into average


Solution

  • Time aggregation is avg by default for gauges. You can override it with the rollup function.

    https://docs.datadoghq.com/dashboards/guide/query-to-the-graph/#proceed-to-time-aggregation

    no need to set any value in the function, just leaving it as (default) while setting the rollup to sum will work.

    enter image description here

    I believe for count metrics this happens automatically. But gauges aren't usually aggregated as a sum when you compress it over time (for example it would not make sense to add up all the CPU% values reported), so the default doesn't make sense for your metric.