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:
commit
d200c9f558
@ -30,6 +30,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var dockerOnly = flag.Bool("docker_only", false, "Only report docker containers in addition to root stats")
|
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 {
|
type rawFactory struct {
|
||||||
// Factory for machine information.
|
// Factory for machine information.
|
||||||
|
@ -227,6 +227,9 @@ func (self *rawContainerHandler) getFsStats(stats *info.ContainerStats) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *rawContainerHandler) GetStats() (*info.ContainerStats, error) {
|
func (self *rawContainerHandler) GetStats() (*info.ContainerStats, error) {
|
||||||
|
if *disableRootCgroupStats && isRootCgroup(self.name) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
stats, err := self.libcontainerHandler.GetStats()
|
stats, err := self.libcontainerHandler.GetStats()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return stats, err
|
return stats, err
|
||||||
|
Loading…
Reference in New Issue
Block a user