Skip to content

Commit

Permalink
reduce inotify watch
Browse files Browse the repository at this point in the history
  • Loading branch information
MingZhang-YBPS committed Jul 22, 2023
1 parent 248756c commit dcb1803
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions container/raw/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package raw

import (
"fmt"
"github.com/google/cadvisor/container"
"os"
"path"
"strings"
Expand All @@ -27,8 +28,6 @@ import (
"github.com/google/cadvisor/container/common"
"github.com/google/cadvisor/container/libcontainer"
"github.com/google/cadvisor/watcher"

"k8s.io/klog/v2"
)

type rawContainerWatcher struct {
Expand All @@ -42,8 +41,8 @@ type rawContainerWatcher struct {
stopWatcher chan error
}

func NewRawContainerWatcher() (watcher.ContainerWatcher, error) {
cgroupSubsystems, err := libcontainer.GetCgroupSubsystems(nil)
func NewRawContainerWatcher(includedMetrics container.MetricSet) (watcher.ContainerWatcher, error) {
cgroupSubsystems, err := libcontainer.GetCgroupSubsystems(includedMetrics)
if err != nil {
return nil, fmt.Errorf("failed to get cgroup subsystems: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func (m *manager) Start() error {
klog.Errorf("Registration of the raw container factory failed: %v", err)
}

rawWatcher, err := raw.NewRawContainerWatcher()
rawWatcher, err := raw.NewRawContainerWatcher(m.includedMetrics)
if err != nil {
return err
}
Expand Down

0 comments on commit dcb1803

Please sign in to comment.