From 5340d1ec373e6c47493901dc70a318719781673d Mon Sep 17 00:00:00 2001 From: david Date: Fri, 17 Dec 2021 21:31:53 +0100 Subject: [PATCH] add debug log for not existent file Signed-off-by: david --- collector/cpu_linux.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/collector/cpu_linux.go b/collector/cpu_linux.go index 565d4c30..f680871d 100644 --- a/collector/cpu_linux.go +++ b/collector/cpu_linux.go @@ -18,6 +18,7 @@ package collector import ( "fmt" + "os" "path/filepath" "regexp" "strconv" @@ -79,8 +80,11 @@ func NewCPUCollector(logger log.Logger) (Collector, error) { isolcpus, err := sysfs.IsolatedCPUs() if err != nil { - level.Warn(logger).Log("msg", "Unable to get isolated cpus, defaulting to []") - isolcpus = []uint16{} + if os.IsNotExist(err) { + level.Debug(logger).Log("msg", "Could not open isolated file", "error", err) + } else { + return nil, fmt.Errorf("Unable to get isolated cpus: %w", err) + } } c := &cpuCollector{