From 64bf0a65511803cec2a1b3a725215fa627ec12fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Tue, 26 Nov 2024 23:56:36 +0100 Subject: [PATCH] collector: don't fail if perf counters are empty. (#1776) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- pkg/collector/collect.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/collector/collect.go b/pkg/collector/collect.go index 0a68f98bd..c684dc691 100644 --- a/pkg/collector/collect.go +++ b/pkg/collector/collect.go @@ -204,12 +204,9 @@ func (c *Collection) collectCollector(ch chan<- prometheus.Metric, logger *slog. return pending } - if err != nil { + if err != nil && !errors.Is(err, perfdata.ErrNoData) && !errors.Is(err, types.ErrNoData) { loggerFn := logger.Warn - if errors.Is(err, types.ErrNoData) || - errors.Is(err, perfdata.ErrNoData) || - errors.Is(err, perfdata.ErrPerformanceCounterNotInitialized) || - errors.Is(err, mi.MI_RESULT_INVALID_NAMESPACE) { + if errors.Is(err, perfdata.ErrPerformanceCounterNotInitialized) || errors.Is(err, mi.MI_RESULT_INVALID_NAMESPACE) { loggerFn = logger.Debug }