Skip to content

Commit

Permalink
Merge pull request #2283 from sashankreddya/disable_root_cgroup_knobs
Browse files Browse the repository at this point in the history
Provide a config knob to disable collecting root Cgroup stats #2259
  • Loading branch information
dashpole committed Aug 11, 2019
2 parents 4ecf88e + 249a1d5 commit d200c9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions container/raw/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
)

var dockerOnly = flag.Bool("docker_only", false, "Only report docker containers in addition to root stats")
var disableRootCgroupStats = flag.Bool("disable_root_cgroup_stats", false, "Disable collecting root Cgroup stats")

type rawFactory struct {
// Factory for machine information.
Expand Down
3 changes: 3 additions & 0 deletions container/raw/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ func (self *rawContainerHandler) getFsStats(stats *info.ContainerStats) error {
}

func (self *rawContainerHandler) GetStats() (*info.ContainerStats, error) {
if *disableRootCgroupStats && isRootCgroup(self.name) {
return nil, nil
}
stats, err := self.libcontainerHandler.GetStats()
if err != nil {
return stats, err
Expand Down

0 comments on commit d200c9f

Please sign in to comment.