diff options
author | John Howard <jhoward@microsoft.com> | 2016-09-07 16:08:51 -0700 |
---|---|---|
committer | John Howard <jhoward@microsoft.com> | 2016-09-16 11:56:15 -0700 |
commit | 340e5233b2fb95981ddea610c1667134ed3b2376 (patch) | |
tree | 4720629c98548a0e0d92e75a751355b01ee04627 /client/container_stats.go | |
parent | a7c25f954062de230dea0f1816b553992fa1d967 (diff) | |
download | docker-340e5233b2fb95981ddea610c1667134ed3b2376.tar.gz |
Windows: stats support
Signed-off-by: John Howard <jhoward@microsoft.com>
Diffstat (limited to 'client/container_stats.go')
-rw-r--r-- | client/container_stats.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/client/container_stats.go b/client/container_stats.go index 2cc67c3af1..3be7a988f4 100644 --- a/client/container_stats.go +++ b/client/container_stats.go @@ -1,15 +1,15 @@ package client import ( - "io" "net/url" + "github.com/docker/docker/api/types" "golang.org/x/net/context" ) // ContainerStats returns near realtime stats for a given container. // It's up to the caller to close the io.ReadCloser returned. -func (cli *Client) ContainerStats(ctx context.Context, containerID string, stream bool) (io.ReadCloser, error) { +func (cli *Client) ContainerStats(ctx context.Context, containerID string, stream bool) (types.ContainerStats, error) { query := url.Values{} query.Set("stream", "0") if stream { @@ -18,7 +18,9 @@ func (cli *Client) ContainerStats(ctx context.Context, containerID string, strea resp, err := cli.get(ctx, "/containers/"+containerID+"/stats", query, nil) if err != nil { - return nil, err + return types.ContainerStats{}, err } - return resp.body, err + + osType := GetDockerOS(resp.header.Get("Server")) + return types.ContainerStats{Body: resp.body, OSType: osType}, err } |