Merge pull request #2283 from sashankreddya/disable_root_cgroup_knobs

Provide a config knob to disable collecting root Cgroup stats #2259
This commit is contained in:
David Ashpole 2019-08-10 17:10:24 -07:00 committed by GitHub
commit d200c9f558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -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.

View File

@ -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