From dc5a94c803e8451859e7775ae83bd719e70c2acf Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Fri, 5 Feb 2021 18:16:17 +0100 Subject: [PATCH] Fix rapl collector log noise Catch permission denined errors in the rapl collector. Signed-off-by: Ben Kochie --- collector/rapl_linux.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/collector/rapl_linux.go b/collector/rapl_linux.go index bbcdbef0..8a5f5f3f 100644 --- a/collector/rapl_linux.go +++ b/collector/rapl_linux.go @@ -60,6 +60,10 @@ func (c *raplCollector) Update(ch chan<- prometheus.Metric) error { level.Debug(c.logger).Log("msg", "Platform doesn't have powercap files present", "err", err) return ErrNoData } + if errors.Is(err, os.ErrPermission) { + level.Debug(c.logger).Log("msg", "Can't access powercap files", "err", err) + return ErrNoData + } return fmt.Errorf("failed to retrieve rapl stats: %w", err) }