feat: Tolerate collector failures (#1769)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2024-11-25 21:27:31 +01:00
committed by GitHub
parent fd76be38e0
commit 1a4c6c5ce7
121 changed files with 1726 additions and 1221 deletions

View File

@@ -16,7 +16,6 @@
package ad
import (
"errors"
"fmt"
"log/slog"
@@ -31,6 +30,7 @@ const Name = "ad"
type Config struct{}
//nolint:gochecknoglobals
var ConfigDefaults = Config{}
type Collector struct {
@@ -671,7 +671,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
data, ok := perfData["NTDS"]
if !ok {
return errors.New("perflib query for DirectoryServices (AD) returned empty result set")
return fmt.Errorf("failed to collect DirectoryServices (AD) metrics: %w", types.ErrNoData)
}
ch <- prometheus.MustNewConstMetric(