Don't count empty collection as success (#1613)
Many collectors depend on underlying features to be enabled. This causes confusion about what "success" means. This changes the behavior of the `node_scrape_collector_success` metric. * When a collector is unable to find data don't return success. * Catch the no data error and send to Debug log level to avoid log spam. * Update collectors to support this new functionality. * Fix copy-pasta mistake in infiband debug message. Closes: https://github.com/prometheus/node_exporter/issues/1323 Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
parent
1a75bc7b50
commit
3e1b0f1bee
11 changed files with 26 additions and 12 deletions
|
|
@ -167,11 +167,11 @@ func (c *wifiCollector) Update(ch chan<- prometheus.Metric) error {
|
|||
// Cannot access wifi metrics, report no error.
|
||||
if os.IsNotExist(err) {
|
||||
level.Debug(c.logger).Log("msg", "wifi collector metrics are not available for this system")
|
||||
return nil
|
||||
return ErrNoData
|
||||
}
|
||||
if os.IsPermission(err) {
|
||||
level.Debug(c.logger).Log("msg", "wifi collector got permission denied when accessing metrics")
|
||||
return nil
|
||||
return ErrNoData
|
||||
}
|
||||
|
||||
return fmt.Errorf("failed to access wifi data: %w", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue