Skip to content

Commit

Permalink
Merge pull request #2554 from prometheus/superq/fix_thermal_missing
Browse files Browse the repository at this point in the history
Fix thermal_zone collector noise
  • Loading branch information
SuperQ authored Dec 29, 2022
2 parents d647e2a + efa7f24 commit b9eef57
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions collector/thermal_zone_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
package collector

import (
"errors"
"fmt"
"os"

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs/sysfs"
)
Expand Down Expand Up @@ -70,6 +73,10 @@ func NewThermalZoneCollector(logger log.Logger) (Collector, error) {
func (c *thermalZoneCollector) Update(ch chan<- prometheus.Metric) error {
thermalZones, err := c.fs.ClassThermalZoneStats()
if err != nil {
if errors.Is(err, os.ErrNotExist) || errors.Is(err, os.ErrPermission) || errors.Is(err, os.ErrInvalid) {
level.Debug(c.logger).Log("msg", "Could not read thermal zone stats", "err", err)
return ErrNoData
}
return err
}

Expand Down

0 comments on commit b9eef57

Please sign in to comment.