Skip to content

Commit

Permalink
chore(*): refine malachite metric provisioner to skip not exists cgro…
Browse files Browse the repository at this point in the history
…up path
  • Loading branch information
luomingmeng committed Oct 23, 2024
1 parent 5e4eee3 commit d574e24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (c *MalachiteClient) getCgroupStats(cgroupPath string) ([]byte, error) {

defer func() { _ = rsp.Body.Close() }()
if rsp.StatusCode != 200 {
return nil, fmt.Errorf("invalid http response status code %d, url: %s", rsp.StatusCode, req.URL)
return nil, fmt.Errorf("invalid http response status code %d, url: %v", rsp.StatusCode, req.URL)
}

return ioutil.ReadAll(rsp.Body)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ func (m *MalachiteMetricsProvisioner) updateCgroupData() error {
cgroupPaths := m.getCgroupPaths()
errList := make([]error, 0)
for _, path := range cgroupPaths {
if !general.IsPathExists(path) {
general.Warningf("cgroup path %v not existed, ignore it", path)
continue
}

stats, err := m.malachiteClient.GetCgroupStats(path)
if err != nil {
errList = append(errList, err)
Expand Down

0 comments on commit d574e24

Please sign in to comment.