mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-07 11:06:36 +00:00
feat: Tolerate collector failures (#1769)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -31,6 +31,7 @@ const Name = "nps"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
type Collector struct {
|
||||
@@ -313,7 +314,7 @@ func (c *Collector) collectAccept(ch chan<- prometheus.Metric) error {
|
||||
|
||||
data, ok := perfData[perfdata.InstanceEmpty]
|
||||
if !ok {
|
||||
return errors.New("perflib query for NPS Authentication Server returned empty result set")
|
||||
return fmt.Errorf("failed to collect NPS Authentication Server metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
@@ -405,7 +406,7 @@ func (c *Collector) collectAccounting(ch chan<- prometheus.Metric) error {
|
||||
|
||||
data, ok := perfData[perfdata.InstanceEmpty]
|
||||
if !ok {
|
||||
return errors.New("perflib query for NPS Accounting Server returned empty result set")
|
||||
return fmt.Errorf("failed to collect NPS Accounting Server metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
|
||||
Reference in New Issue
Block a user