diff --git a/manager/manager.go b/manager/manager.go index 6d0c344a..24d70a63 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -18,7 +18,6 @@ package manager import ( "flag" "fmt" - "github.com/opencontainers/runc/libcontainer/cgroups/fs2" "net/http" "os" "path" @@ -48,6 +47,7 @@ import ( "github.com/google/cadvisor/watcher" "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/cgroups/fs2" "github.com/opencontainers/runc/libcontainer/intelrdt" "k8s.io/klog/v2" @@ -932,7 +932,7 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche perfCgroupPath := path.Join(fs2.UnifiedMountpoint, containerName) cont.perfCollector, err = m.perfManager.GetCollector(perfCgroupPath) if err != nil { - klog.Infof("perf_event metrics will not be available for container %s: %s", containerName, err) + klog.V(4).Infof("perf_event metrics will not be available for container %s: %s", containerName, err) } } else { devicesCgroupPath, err := handler.GetCgroupPath("devices") @@ -950,18 +950,18 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche } else { cont.perfCollector, err = m.perfManager.GetCollector(perfCgroupPath) if err != nil { - klog.Infof("perf_event metrics will not be available for container %s: %s", containerName, err) + klog.V(4).Infof("perf_event metrics will not be available for container %s: %s", containerName, err) } } } resctrlPath, err := intelrdt.GetIntelRdtPath(containerName) if err != nil { - klog.Warningf("Error getting resctrl path: %q", err) + klog.V(4).Infof("Error getting resctrl path: %q", err) } else { cont.resctrlCollector, err = m.resctrlManager.GetCollector(resctrlPath) if err != nil { - klog.Infof("resctrl metrics will not be available for container %s: %s", cont.info.Name, err) + klog.V(4).Infof("resctrl metrics will not be available for container %s: %s", cont.info.Name, err) } } diff --git a/resctrl/manager.go b/resctrl/manager.go index bc9f0b35..cceb28e6 100644 --- a/resctrl/manager.go +++ b/resctrl/manager.go @@ -18,6 +18,8 @@ package resctrl import ( + "os" + "github.com/google/cadvisor/stats" "github.com/opencontainers/runc/libcontainer/intelrdt" @@ -29,6 +31,9 @@ type manager struct { } func (m manager) GetCollector(resctrlPath string) (stats.Collector, error) { + if _, err := os.Stat(resctrlPath); err != nil { + return &stats.NoopCollector{}, err + } collector := newCollector(m.id, resctrlPath) return collector, nil }