mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-11 15:36:37 +00:00
vmware: refactor collector (#1727)
This commit is contained in:
@@ -4,6 +4,8 @@ import "github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
const EmptyInstance = "------"
|
||||
|
||||
var TotalInstance = []string{"_Total"}
|
||||
|
||||
type CounterValues struct {
|
||||
Type prometheus.ValueType
|
||||
FirstValue float64
|
||||
|
||||
@@ -166,10 +166,12 @@ func (c *Collector) Collect() (map[string]map[string]perftypes.CounterValues, er
|
||||
metricType = prometheus.GaugeValue
|
||||
}
|
||||
|
||||
_, isTotalCounterRequests := c.counters["_Total"]
|
||||
|
||||
for _, item := range items {
|
||||
if item.RawValue.CStatus == PdhCstatusValidData || item.RawValue.CStatus == PdhCstatusNewData {
|
||||
instanceName := windows.UTF16PtrToString(item.SzName)
|
||||
if strings.HasSuffix(instanceName, "_Total") {
|
||||
if strings.HasSuffix(instanceName, "_Total") && !isTotalCounterRequests {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user