Skip to content

Commit

Permalink
collector: don't fail if perf counters are empty.
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed Nov 26, 2024
1 parent ca04ad8 commit 9b5e260
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/collector/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 9b5e260

Please sign in to comment.