MCPcopy
hub / github.com/google/cadvisor / Stats

Method Stats

client/v2/client.go:91–108  ·  view source on GitHub ↗

Stats returns stats for the requested container.

(name string, request *v2.RequestOptions)

Source from the content-addressed store, hash-verified

89
90// Stats returns stats for the requested container.
91func (c *Client) Stats(name string, request *v2.RequestOptions) (map[string]v2.ContainerInfo, error) {
92 u := c.statsURL(name)
93 ret := make(map[string]v2.ContainerInfo)
94 data := url.Values{
95 "type": []string{request.IdType},
96 "count": []string{strconv.Itoa(request.Count)},
97 "recursive": []string{strconv.FormatBool(request.Recursive)},
98 }
99 if request.MaxAge != nil {
100 data.Set("max_age", request.MaxAge.String())
101 }
102
103 u = fmt.Sprintf("%s?%s", u, data.Encode())
104 if err := c.httpGetJSONData(&ret, nil, u, "stats"); err != nil {
105 return nil, err
106 }
107 return ret, nil
108}
109
110func (c *Client) machineInfoURL() string {
111 return c.baseURL + path.Join("machine")

Callers 2

TestCrioFilesystemStatsFunction · 0.80

Calls 4

statsURLMethod · 0.95
httpGetJSONDataMethod · 0.95
SetMethod · 0.80
StringMethod · 0.65

Tested by 2

TestCrioFilesystemStatsFunction · 0.64