-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker metrics (read metrics from cgroups for specified container) #8886
Conversation
Signed-off-by: Gleb M Borisov <borisov.gleb@gmail.com>
return nil | ||
} | ||
|
||
indented := new(bytes.Buffer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use json.Unmarshal and a struct or map for this, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's copy-paste from CmdInspect. I've marked both functions with TODO (will
extract common things and make their code less ugly).
Thanks for the tip, just a first week with Go :)
On Fri 31 Oct 2014 at 10:22 pm Erik Hollensbe notifications@github.com
wrote:
In api/client/commands.go:
@@ -812,6 +812,46 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
return nil
}+func (cli *DockerCli) CmdMetrics(args ...string) error {
- cmd := cli.Subcmd("metrics", "CONTAINER", "Return runtime information on a container")
- if err := cmd.Parse(args); err != nil {
return nil
- }
- if cmd.NArg() < 1 {
cmd.Usage()
return nil
- }
- indented := new(bytes.Buffer)
use json.Unmarshal and a struct or map for this, please.
—
Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/8886/files#r19688050.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool. thanks. just let us know when it's ready for review again.
needs documentation in cli.md, a man page (in |
Hi @crosbymichael and @monsterzz this is along the lines of what we're doing with nsinit at the moment. Nice to see it potentially in docker itself. This patch currently does not work on RHEL-like systems, and I think @monsterzz eluded to the cgroup path config needing some work, which is fine. I didn't look into it deeply but hope that can be resolved.
I would expect a monitoring system will want a global "watch" on all containers, existing and new. Do you agree ? Basically docker would continuously pump all it's stats to a websocket at a certain interval, and the monitoring system would consume at it's own pace. You could have i.e. " docker metrics --all" for the cli. Agreed the stat calculation interval should be tunable; if I could suggest you default to 10s rather than 1s. 1s stat gathering on busy, dense nodes is a costly burden we should reserve for field-debug/troubleshooting. Even 10s might be too aggressive depending on the business. The other thing is the patch itself decides on arbitrary names that closely resemble their cgroup counterparts. Why not get rid of all ambiguity and use the precise names used by the kernel ? |
I wonder if it might be better to fork a separate process from the docker On Thu, Nov 13, 2014 at 12:53 PM, Jeremy Eder notifications@github.com
|
@vishh do you not think the Go scheduler could handle this? As long as this is async I think go should be able to handle the load within one process. We can always break this out into another process later if we find that this is not the case and we are having performance issues. |
We really need this. Can anyone help to review and merge it 😃 |
Unfortunately I have no time to implement push approach at this time. I
|
@monsterzz no problem. I'll take care of finishing this feature. Closing this in favor of #9984 |
Fixes #8842.
This is first and very simple implementation of docker metrics command. A lot of work needed to push it to production.
Roadmap:
cpuacct
,memory
,blkio
, ... controllers)struct
instead ofmap[string]string
(typed data)-f FORMAT
supportPS. PR created for further discussion and this branch will be constantly updated.
/cc @shykes @tobegit3hub @thaJeztah