mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-06 02:26:36 +00:00
Remove unused *prometheus.Desc return value from collectors collect() function (#1475)
This commit is contained in:
@@ -115,8 +115,8 @@ func (c *collector) Build() error {
|
||||
// Collect sends the metric values for each metric
|
||||
// to the provided prometheus Metric channel.
|
||||
func (c *collector) Collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metric) error {
|
||||
if desc, err := c.collect(ctx, ch); err != nil {
|
||||
_ = level.Error(c.logger).Log("failed collecting tcp metrics", "desc", desc, "err", err)
|
||||
if err := c.collect(ctx, ch); err != nil {
|
||||
_ = level.Error(c.logger).Log("msg", "failed collecting tcp metrics", "err", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -194,12 +194,12 @@ func writeTCPCounters(metrics tcp, labels []string, c *collector, ch chan<- prom
|
||||
)
|
||||
}
|
||||
|
||||
func (c *collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
||||
func (c *collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metric) error {
|
||||
var dst []tcp
|
||||
|
||||
// TCPv4 counters
|
||||
if err := perflib.UnmarshalObject(ctx.PerfObjects["TCPv4"], &dst, c.logger); err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
if len(dst) != 0 {
|
||||
writeTCPCounters(dst[0], []string{"ipv4"}, c, ch)
|
||||
@@ -207,11 +207,11 @@ func (c *collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
|
||||
|
||||
// TCPv6 counters
|
||||
if err := perflib.UnmarshalObject(ctx.PerfObjects["TCPv6"], &dst, c.logger); err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
if len(dst) != 0 {
|
||||
writeTCPCounters(dst[0], []string{"ipv6"}, c, ch)
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user