Skip to content

Commit 98f099f

Browse files
geek-bitiwankgb
authored andcommitted
Patch to fix issue 2341
1 parent b9342aa commit 98f099f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

container/raw/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
var (
3333
DockerOnly = flag.Bool("docker_only", false, "Only report docker containers in addition to root stats")
34-
disableRootCgroupStats = flag.Bool("disable_root_cgroup_stats", false, "Disable collecting root Cgroup stats")
34+
DisableRootCgroupStats = flag.Bool("disable_root_cgroup_stats", false, "Disable collecting root Cgroup stats")
3535
)
3636

3737
type rawFactory struct {

container/raw/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func (h *rawContainerHandler) getFsStats(stats *info.ContainerStats) error {
227227
}
228228

229229
func (h *rawContainerHandler) GetStats() (*info.ContainerStats, error) {
230-
if *disableRootCgroupStats && isRootCgroup(h.name) {
230+
if *DisableRootCgroupStats && isRootCgroup(h.name) {
231231
return nil, nil
232232
}
233233
stats, err := h.libcontainerHandler.GetStats()

manager/container.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"github.com/google/cadvisor/cache/memory"
3434
"github.com/google/cadvisor/collector"
3535
"github.com/google/cadvisor/container"
36+
"github.com/google/cadvisor/container/raw"
3637
info "github.com/google/cadvisor/info/v1"
3738
v2 "github.com/google/cadvisor/info/v2"
3839
"github.com/google/cadvisor/stats"
@@ -481,7 +482,7 @@ func (cd *containerData) nextHousekeepingInterval() time.Duration {
481482
var empty time.Time
482483
stats, err := cd.memoryCache.RecentStats(cd.info.Name, empty, empty, 2)
483484
if err != nil {
484-
if cd.allowErrorLogging() {
485+
if cd.allowErrorLogging() && !(cd.isRoot() && *raw.DisableRootCgroupStats) {
485486
klog.Warningf("Failed to get RecentStats(%q) while determining the next housekeeping: %v", cd.info.Name, err)
486487
}
487488
} else if len(stats) == 2 {

0 commit comments

Comments
 (0)