Skip to content

Commit fdd3d91

Browse files
authored
Merge pull request #3354 from MingZhang-YBPS/reduce_inotify_watch
reduce inotify watch on used cgroup subsystems
2 parents a0708ee + 02478a6 commit fdd3d91

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

container/raw/watcher.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424

2525
inotify "k8s.io/utils/inotify"
2626

27+
"github.com/google/cadvisor/container"
2728
"github.com/google/cadvisor/container/common"
2829
"github.com/google/cadvisor/container/libcontainer"
2930
"github.com/google/cadvisor/watcher"
@@ -42,8 +43,8 @@ type rawContainerWatcher struct {
4243
stopWatcher chan error
4344
}
4445

45-
func NewRawContainerWatcher() (watcher.ContainerWatcher, error) {
46-
cgroupSubsystems, err := libcontainer.GetCgroupSubsystems(nil)
46+
func NewRawContainerWatcher(includedMetrics container.MetricSet) (watcher.ContainerWatcher, error) {
47+
cgroupSubsystems, err := libcontainer.GetCgroupSubsystems(includedMetrics)
4748
if err != nil {
4849
return nil, fmt.Errorf("failed to get cgroup subsystems: %v", err)
4950
}

manager/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func (m *manager) Start() error {
295295
klog.Errorf("Registration of the raw container factory failed: %v", err)
296296
}
297297

298-
rawWatcher, err := raw.NewRawContainerWatcher()
298+
rawWatcher, err := raw.NewRawContainerWatcher(m.includedMetrics)
299299
if err != nil {
300300
return err
301301
}

0 commit comments

Comments
 (0)