mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 05:56:37 +00:00
feat: Tolerate collector failures (#1769)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user