From e49a13d0cfeabc3ab00a613401e941b3fbe71c40 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Thu, 19 Mar 2020 19:50:36 +0100 Subject: [PATCH] Catch missing schedstat file (#1641) Suppres error log noise if schedstat file doesn't exist. Signed-off-by: Ben Kochie --- collector/schedstat_linux.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/collector/schedstat_linux.go b/collector/schedstat_linux.go index 6810b931..d2f04f69 100644 --- a/collector/schedstat_linux.go +++ b/collector/schedstat_linux.go @@ -15,8 +15,10 @@ package collector import ( "fmt" + "os" "github.com/go-kit/kit/log" + "github.com/go-kit/kit/log/level" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/procfs" ) @@ -68,6 +70,10 @@ func init() { func (c *schedstatCollector) Update(ch chan<- prometheus.Metric) error { stats, err := c.fs.Schedstat() if err != nil { + if os.IsNotExist(err) { + level.Debug(c.logger).Log("msg", "schedstat file does not exist") + return ErrNoData + } return err }