diff options
author | Ben Kochie <superq@gmail.com> | 2020-03-19 19:50:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 19:50:36 +0100 |
commit | e49a13d0cfeabc3ab00a613401e941b3fbe71c40 (patch) | |
tree | a55d5fc1008a5780497c2600052bcd0654eb7167 /collector | |
parent | 0107bc794204f50d887898da60032da890637471 (diff) | |
download | prometheus_node_collector-e49a13d0cfeabc3ab00a613401e941b3fbe71c40.tar.bz2 prometheus_node_collector-e49a13d0cfeabc3ab00a613401e941b3fbe71c40.tar.xz prometheus_node_collector-e49a13d0cfeabc3ab00a613401e941b3fbe71c40.zip |
Catch missing schedstat file (#1641)
Suppres error log noise if schedstat file doesn't exist.
Signed-off-by: Ben Kochie <superq@gmail.com>
Diffstat (limited to 'collector')
-rw-r--r-- | collector/schedstat_linux.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/collector/schedstat_linux.go b/collector/schedstat_linux.go index 6810b93..d2f04f6 100644 --- a/collector/schedstat_linux.go +++ b/collector/schedstat_linux.go | |||
@@ -15,8 +15,10 @@ package collector | |||
15 | 15 | ||
16 | import ( | 16 | import ( |
17 | "fmt" | 17 | "fmt" |
18 | "os" | ||
18 | 19 | ||
19 | "github.com/go-kit/kit/log" | 20 | "github.com/go-kit/kit/log" |
21 | "github.com/go-kit/kit/log/level" | ||
20 | "github.com/prometheus/client_golang/prometheus" | 22 | "github.com/prometheus/client_golang/prometheus" |
21 | "github.com/prometheus/procfs" | 23 | "github.com/prometheus/procfs" |
22 | ) | 24 | ) |
@@ -68,6 +70,10 @@ func init() { | |||
68 | func (c *schedstatCollector) Update(ch chan<- prometheus.Metric) error { | 70 | func (c *schedstatCollector) Update(ch chan<- prometheus.Metric) error { |
69 | stats, err := c.fs.Schedstat() | 71 | stats, err := c.fs.Schedstat() |
70 | if err != nil { | 72 | if err != nil { |
73 | if os.IsNotExist(err) { | ||
74 | level.Debug(c.logger).Log("msg", "schedstat file does not exist") | ||
75 | return ErrNoData | ||
76 | } | ||
71 | return err | 77 | return err |
72 | } | 78 | } |
73 | 79 | ||