mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-04 01:26:37 +00:00
Remove unused *prometheus.Desc return value from collectors collect() function (#1475)
This commit is contained in:
@@ -62,8 +62,8 @@ func (c *collector) Build() error {
|
||||
// Collect sends the metric values for each metric
|
||||
// to the provided prometheus Metric channel.
|
||||
func (c *collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric) error {
|
||||
if desc, err := c.collect(ch); err != nil {
|
||||
_ = level.Error(c.logger).Log("failed collecting user metrics", "desc", desc, "err", err)
|
||||
if err := c.collect(ch); err != nil {
|
||||
_ = level.Error(c.logger).Log("msg", "failed collecting user metrics", "err", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -75,14 +75,14 @@ type Win32_LogonSession struct {
|
||||
LogonType uint32
|
||||
}
|
||||
|
||||
func (c *collector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
||||
func (c *collector) collect(ch chan<- prometheus.Metric) error {
|
||||
var dst []Win32_LogonSession
|
||||
q := wmi.QueryAll(&dst, c.logger)
|
||||
if err := wmi.Query(q, &dst); err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
if len(dst) == 0 {
|
||||
return nil, errors.New("WMI query returned empty result set")
|
||||
return errors.New("WMI query returned empty result set")
|
||||
}
|
||||
|
||||
// Init counters
|
||||
@@ -221,5 +221,5 @@ func (c *collector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, erro
|
||||
float64(cachedunlock),
|
||||
"cached_unlock",
|
||||
)
|
||||
return nil, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user