Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix thermal_zone collector noise #2554

Merged
merged 1 commit into from
Dec 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
discordianfish marked this conversation as resolved.
Show resolved Hide resolved
level.Debug(c.logger).Log("msg", "Could not read thermal zone stats", "err", err)
return ErrNoData
}
return err
}

Expand Down