Skip to content

[BUG] docker.container.size_* Metrics not Available when configured via com.datadoghq.ad.checks and Metrics Being Collected #39084

@colinbjohnson

Description

@colinbjohnson

Agent Environment

agent version = Agent 7.68.1 - Commit: 1667c7b7a6 - Serialization version: v5.0.155 - Go version: go1.24.4
agent status autodiscovery --json = {"adConfigErrors":{},"adEnabledFeatures":{"docker":{}},"filterErrors":{}}

Describe what happened:

No docker.container.size_* metrics are available within the DataDog interface but other docker.container.* metrics are produced when a Docker Container is started as follows:

# taken from https://docs.datadoghq.com/containers/docker/?tab=amazonlinux
docker run \
 --cgroupns host --pid host \
 --volume /var/run/docker.sock:/var/run/docker.sock:ro \
 --volume /proc/:/host/proc/:ro \
 --volume /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
 --label com.datadoghq.ad.checks='{
    "docker": {
      "instances": [
        {
          "collect_container_size": true,
          "collect_container_size_frequency": 1,
          "collected_event_types": ["oom"]
        }
      ]
    }
  }' \
 --env DD_API_KEY=a1b2c3d4 \
 --env DD_SITE=datadoghq.com \
 --env DD_LOGS_ENABLED=false \
 public.ecr.aws/datadog/agent:latest

The command agent check docker returns the following (note I have removed some elements from the Series for readability - you can clearly see docker.container.open_fds is available as is the metric I desire to collect docker.container.size_rw.

root@9b33c48908f9:/# agent check docker
=== Series ===
[
  {
    "metric": "docker.mem.rss",
    "points": [
      [
        1753041009,
        1.30043904e+08
      ]
    ],
    "tags": [
      "container_id:9b33c48908f94a2b0b5f1f733c67e22483379eb2898d7a5e9ed3bc145770c6b8",
      "container_name:goofy_dijkstra",
      "docker_image:public.ecr.aws/datadog/agent:latest",
      "git.commit.sha:1667c7b7a6a3f96a74dbde81e2695ad9b6286a35",
      "git.repository_url:https://github.com/DataDog/datadog-agent",
      "image_id:sha256:6459c86eec1dd9c7dbdaf8b90ed147cf59e5fb3073d629a8e22ce56b65ff1672",
      "image_name:public.ecr.aws/datadog/agent",
      "image_tag:latest",
      "runtime:docker",
      "short_image:agent"
    ],
    "host": "i-0776f5a09cc6ca58d",
    "type": "gauge",
    "interval": 0,
    "source_type_name": "System"
  },
  {
    "metric": "docker.container.open_fds",
    "points": [
      [
        1753041009,
        100
      ]
    ],
    "tags": [
      "container_id:9b33c48908f94a2b0b5f1f733c67e22483379eb2898d7a5e9ed3bc145770c6b8",
      "container_name:goofy_dijkstra",
      "docker_image:public.ecr.aws/datadog/agent:latest",
      "git.commit.sha:1667c7b7a6a3f96a74dbde81e2695ad9b6286a35",
      "git.repository_url:https://github.com/DataDog/datadog-agent",
      "image_id:sha256:6459c86eec1dd9c7dbdaf8b90ed147cf59e5fb3073d629a8e22ce56b65ff1672",
      "image_name:public.ecr.aws/datadog/agent",
      "image_tag:latest",
      "runtime:docker",
      "short_image:agent"
    ],
    "host": "i-0776f5a09cc6ca58d",
    "type": "gauge",
    "interval": 0,
    "source_type_name": "System"
  },
  {
    "metric": "docker.container.size_rw",
    "points": [
      [
        1753041009,
        4.520991e+06
      ]
    ],
    "tags": [
      "container_id:9b33c48908f94a2b0b5f1f733c67e22483379eb2898d7a5e9ed3bc145770c6b8",
      "container_name:goofy_dijkstra",
      "docker_image:public.ecr.aws/datadog/agent:latest",
      "git.commit.sha:1667c7b7a6a3f96a74dbde81e2695ad9b6286a35",
      "git.repository_url:https://github.com/DataDog/datadog-agent",
      "image_id:sha256:6459c86eec1dd9c7dbdaf8b90ed147cf59e5fb3073d629a8e22ce56b65ff1672",
      "image_name:public.ecr.aws/datadog/agent",
      "image_tag:latest",
      "short_image:agent"
    ],
    "host": "i-0776f5a09cc6ca58d",
    "type": "gauge",
    "interval": 0,
    "source_type_name": "System"
  },
  {
    "metric": "docker.containers.running",
    "points": [
      [
        1753041009,
        1
      ]
    ],
    "tags": [
      "docker_image:public.ecr.aws/datadog/agent:latest",
      "git.commit.sha:1667c7b7a6a3f96a74dbde81e2695ad9b6286a35",
      "git.repository_url:https://github.com/DataDog/datadog-agent",
      "image_id:sha256:6459c86eec1dd9c7dbdaf8b90ed147cf59e5fb3073d629a8e22ce56b65ff1672",
      "image_name:public.ecr.aws/datadog/agent",
      "image_tag:latest",
      "short_image:agent"
    ],
    "host": "i-0776f5a09cc6ca58d",
    "type": "gauge",
    "interval": 0,
    "source_type_name": "System"
  },
  {
    "metric": "docker.container.size_rootfs",
    "points": [
      [
        1753041009,
        8.22630846e+08
      ]
    ],
    "tags": [
      "container_id:9b33c48908f94a2b0b5f1f733c67e22483379eb2898d7a5e9ed3bc145770c6b8",
      "container_name:goofy_dijkstra",
      "docker_image:public.ecr.aws/datadog/agent:latest",
      "git.commit.sha:1667c7b7a6a3f96a74dbde81e2695ad9b6286a35",
      "git.repository_url:https://github.com/DataDog/datadog-agent",
      "image_id:sha256:6459c86eec1dd9c7dbdaf8b90ed147cf59e5fb3073d629a8e22ce56b65ff1672",
      "image_name:public.ecr.aws/datadog/agent",
      "image_tag:latest",
      "short_image:agent"
    ],
    "host": "i-0776f5a09cc6ca58d",
    "type": "gauge",
    "interval": 0,
    "source_type_name": "System"
  }
]
=== Service Checks ===
[
  {
    "check": "docker.service_up",
    "host_name": "i-0776f5a09cc6ca58d",
    "timestamp": 1753041009,
    "status": 0,
    "message": "",
    "tags": [
      "docker_image:public.ecr.aws/datadog/agent:latest",
      "git.commit.sha:1667c7b7a6a3f96a74dbde81e2695ad9b6286a35",
      "git.repository_url:https://github.com/DataDog/datadog-agent",
      "image_id:sha256:6459c86eec1dd9c7dbdaf8b90ed147cf59e5fb3073d629a8e22ce56b65ff1672",
      "image_name:public.ecr.aws/datadog/agent",
      "image_tag:latest",
      "short_image:agent"
    ]
  }
]


  Running Checks
  ==============

    docker
    ------
      Instance ID: docker [OK]
      Configuration Source: container:docker://9b33c48908f94a2b0b5f1f733c67e22483379eb2898d7a5e9ed3bc145770c6b8
      Total Runs: 1
      Metric Samples: Last Run: 10, Total: 10
      Events: Last Run: 0, Total: 0
      Service Checks: Last Run: 1, Total: 1
      Average Execution Time : 25ms
      Last Execution Date : 2025-07-20 19:50:09 UTC (1753041009000)
      Last Successful Execution Date : 2025-07-20 19:50:09 UTC (1753041009000)


  Metadata
  ========
    config.hash: docker
    config.provider: container
Check has run only once, if some metrics are missing you can try again with --check-rate to see any other metric if available.
This check type has 1 instances. If you're looking for a different check instance, try filtering on a specific one using the --instance-filter flag or set --discovery-min-instances to a higher value

Describe what you expected:

I expected the metrics docker.container.size_rw and docker.container.size_rootfs to be available within the DataDog site at https://app.datadoghq.com/.

Steps to reproduce the issue:

Run the following:

# taken from https://docs.datadoghq.com/containers/docker/?tab=amazonlinux
docker run \
 --cgroupns host --pid host \
 --volume /var/run/docker.sock:/var/run/docker.sock:ro \
 --volume /proc/:/host/proc/:ro \
 --volume /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
 --label com.datadoghq.ad.checks='{
    "docker": {
      "instances": [
        {
          "collect_container_size": true,
          "collect_container_size_frequency": 1,
          "collected_event_types": ["oom"]
        }
      ]
    }
  }' \
 --env DD_API_KEY=a1b2c3d4 \
 --env DD_SITE=datadoghq.com \
 --env DD_LOGS_ENABLED=false \
 public.ecr.aws/datadog/agent:latest

Additional environment details (Operating System, Cloud provider, etc):

  • Linux Version: Amazon Linux 2
  • AMI Version: ami-05dc67d613ea82750
  • CloudProvider: AWS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions