Merge pull request #2596 from katarzyna-z/kk-logs-resctrl
Verbosity level for resctrl and perf logs
This commit is contained in:
commit
922aa83feb
@ -18,7 +18,6 @@ package manager
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/opencontainers/runc/libcontainer/cgroups/fs2"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
@ -48,6 +47,7 @@ import (
|
|||||||
"github.com/google/cadvisor/watcher"
|
"github.com/google/cadvisor/watcher"
|
||||||
|
|
||||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||||
|
"github.com/opencontainers/runc/libcontainer/cgroups/fs2"
|
||||||
"github.com/opencontainers/runc/libcontainer/intelrdt"
|
"github.com/opencontainers/runc/libcontainer/intelrdt"
|
||||||
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
@ -932,7 +932,7 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche
|
|||||||
perfCgroupPath := path.Join(fs2.UnifiedMountpoint, containerName)
|
perfCgroupPath := path.Join(fs2.UnifiedMountpoint, containerName)
|
||||||
cont.perfCollector, err = m.perfManager.GetCollector(perfCgroupPath)
|
cont.perfCollector, err = m.perfManager.GetCollector(perfCgroupPath)
|
||||||
if err != nil {
|
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 {
|
} else {
|
||||||
devicesCgroupPath, err := handler.GetCgroupPath("devices")
|
devicesCgroupPath, err := handler.GetCgroupPath("devices")
|
||||||
@ -950,18 +950,18 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche
|
|||||||
} else {
|
} else {
|
||||||
cont.perfCollector, err = m.perfManager.GetCollector(perfCgroupPath)
|
cont.perfCollector, err = m.perfManager.GetCollector(perfCgroupPath)
|
||||||
if err != nil {
|
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)
|
resctrlPath, err := intelrdt.GetIntelRdtPath(containerName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Warningf("Error getting resctrl path: %q", err)
|
klog.V(4).Infof("Error getting resctrl path: %q", err)
|
||||||
} else {
|
} else {
|
||||||
cont.resctrlCollector, err = m.resctrlManager.GetCollector(resctrlPath)
|
cont.resctrlCollector, err = m.resctrlManager.GetCollector(resctrlPath)
|
||||||
if err != nil {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
package resctrl
|
package resctrl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/google/cadvisor/stats"
|
"github.com/google/cadvisor/stats"
|
||||||
|
|
||||||
"github.com/opencontainers/runc/libcontainer/intelrdt"
|
"github.com/opencontainers/runc/libcontainer/intelrdt"
|
||||||
@ -29,6 +31,9 @@ type manager struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m manager) GetCollector(resctrlPath string) (stats.Collector, error) {
|
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)
|
collector := newCollector(m.id, resctrlPath)
|
||||||
return collector, nil
|
return collector, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user