google / cadvisor

Analyzes resource usage and performance characteristics of running containers.
Other
17.2k stars 2.32k forks source link

Add image and write layer size as container disk usage #1849

Open Colstuwjx opened 6 years ago

Colstuwjx commented 6 years ago

As I known, docker offered docker ps -s to collect image and writeable layer disk usage

CONTAINER ID        IMAGE                      COMMAND                  CREATED              STATUS              PORTS               NAMES                                         SIZE
6ca0cef8db8d        nginx                      "nginx -g 'daemon ..."   55 seconds ago       Up 54 seconds       80/tcp, 443/tcp     pedantic_mahavira                             2B (virtual 183MB)

Could us support offer these metrics?

dashpole commented 6 years ago

The writable layer disk usage is already reported for containers. Image disk usage is a seperate concept from container usage, as images can be shared between many containers. It looks like we have some image functionality added, as I can see there is an API type for docker images But it looks like it is only used for the UI. The only reasons I can think of that this isnt exported in the versioned APIs or prometheus is that it is docker specific, and adds additional API calls to the docker daemon, which can easily be overwhelmed. Any implementation would need to be disabled by default.

How are you using cAdvisor? Are you planning to use the Json API directly, or do you plan to use prometheus, or another storage plugin?

Colstuwjx commented 6 years ago

Yeah, I'm using the /metrics exposed by cadvisor and collect them into prometheus. I think image size or total container disk usage in the other word, is really needed for container disk usage monitoring.

timzaak commented 6 years ago

+1 really need it, because someone who brings their project into docker always leave log file inside docker.