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

@@ -35,6 +35,7 @@ type Config struct {
CollectorsEnabled []string `yaml:"collectors_enabled"`
}
//nolint:gochecknoglobals
var ConfigDefaults = Config{
CollectorsEnabled: []string{"connection", "folder", "volume"},
}
@@ -542,7 +543,7 @@ func (c *Collector) collectPDHConnection(ch chan<- prometheus.Metric) error {
}
if len(perfData) == 0 {
return errors.New("perflib query for DFS Replication Connections returned empty result set")
return fmt.Errorf("failed to collect DFS Replication Connections metrics: %w", types.ErrNoData)
}
for name, connection := range perfData {
@@ -620,7 +621,7 @@ func (c *Collector) collectPDHFolder(ch chan<- prometheus.Metric) error {
}
if len(perfData) == 0 {
return errors.New("perflib query for DFS Replicated Folders returned empty result set")
return fmt.Errorf("failed to collect DFS Replicated Folders metrics: %w", types.ErrNoData)
}
for name, folder := range perfData {
@@ -824,7 +825,7 @@ func (c *Collector) collectPDHVolume(ch chan<- prometheus.Metric) error {
}
if len(perfData) == 0 {
return errors.New("perflib query for DFS Replication Volumes returned empty result set")
return fmt.Errorf("failed to collect DFS Replication Volumes metrics: %w", types.ErrNoData)
}
for name, volume := range perfData {