mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-28 15:46:36 +00:00
feat: Tolerate collector failures (#1769)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
@@ -89,7 +88,7 @@ func (c *Collector) buildVirtualSMB() error {
|
||||
virtualSMBSentBytes,
|
||||
virtualSMBReceivedBytes,
|
||||
})
|
||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Virtual SMB collector: %w", err)
|
||||
}
|
||||
|
||||
@@ -201,7 +200,7 @@ func (c *Collector) buildVirtualSMB() error {
|
||||
|
||||
func (c *Collector) collectVirtualSMB(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorVirtualSMB.Collect()
|
||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Virtual SMB metrics: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user