datadog

Metrics number of ecs tasks running historically


I am trying to get a ecs dashboard set up in datadog including the number of ecs tasks running over the past timeframe.

avg:ecs.containerinsights.running_task_count.sum{$ecs_service,$ecs_cluster} by {servicename}.as_count()

This works correctly over 1 or 4 hours, but over longer periods it ends up with larger numbers. The longer, the larger so it seems to be summing everything up.


Solution

  • The answer is to use the rollup() function.

    https://docs.datadoghq.com/dashboards/functions/rollup/