mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-21 12:09:03 +02:00
pdh: report duplicate instances by occurrence instead of renaming them (#2742)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -284,6 +284,13 @@ func (c *Collector) collectObject(ch chan<- prometheus.Metric, perfDataObject Ob
|
||||
return fmt.Errorf("failed to collect data: %w", err)
|
||||
}
|
||||
|
||||
// Some objects, e.g. Process, report the same instance name more than
|
||||
// once. Each occurrence is published with a "#N" suffix, see the docs.
|
||||
pdh.SuffixDuplicates(rows,
|
||||
func(row *pdh.Row) *string { return &row.Name },
|
||||
func(row *pdh.Row) int { return row.Occurrence },
|
||||
)
|
||||
|
||||
metricTypes := counterMetricTypes(perfDataObject)
|
||||
|
||||
var errs []error
|
||||
|
||||
Reference in New Issue
Block a user