add debug log for not existent file

Signed-off-by: david <davidventura27@gmail.com>
This commit is contained in:
david 2021-12-17 21:31:53 +01:00 committed by DavidVentura
parent c05af934af
commit 5340d1ec37
1 changed files with 6 additions and 2 deletions

View File

@ -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{