warn if isolcpus cannot be read and default to an empty slice

Signed-off-by: david <davidventura27@gmail.com>
This commit is contained in:
david 2021-12-16 14:00:54 +01:00 committed by DavidVentura
parent 9ea9a5f029
commit c05af934af

View File

@ -79,7 +79,8 @@ func NewCPUCollector(logger log.Logger) (Collector, error) {
isolcpus, err := sysfs.IsolatedCPUs()
if err != nil {
return nil, fmt.Errorf("failed to read isolcpus from sysfs: %w", err)
level.Warn(logger).Log("msg", "Unable to get isolated cpus, defaulting to []")
isolcpus = []uint16{}
}
c := &cpuCollector{