mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
e59d54bd99
Signed-off-by: David Calavera <david.calavera@gmail.com>
22 lines
492 B
Go
22 lines
492 B
Go
package lib
|
|
|
|
import (
|
|
"io"
|
|
"net/url"
|
|
)
|
|
|
|
// 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(containerID string, stream bool) (io.ReadCloser, error) {
|
|
query := url.Values{}
|
|
query.Set("stream", "0")
|
|
if stream {
|
|
query.Set("stream", "1")
|
|
}
|
|
|
|
resp, err := cli.get("/containers/"+containerID+"/stats", query, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return resp.body, err
|
|
}
|