mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-19 02:59:04 +02:00
cache: emit copy-read hit totals as counters (#2602)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Vendored
+6
-3
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/pdh"
|
||||
pdhtypes "github.com/prometheus-community/windows_exporter/internal/pdh/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
@@ -40,7 +41,7 @@ var ConfigDefaults = Config{}
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
perfDataCollector *pdh.Collector[perfDataCounterValues]
|
||||
perfDataCollector pdhtypes.Collector[perfDataCounterValues]
|
||||
perfDataObject []perfDataCounterValues
|
||||
|
||||
asyncCopyReadsTotal *prometheus.Desc
|
||||
@@ -95,7 +96,9 @@ func (c *Collector) GetName() string {
|
||||
}
|
||||
|
||||
func (c *Collector) Close() error {
|
||||
c.perfDataCollector.Close()
|
||||
if c.perfDataCollector != nil {
|
||||
c.perfDataCollector.Close()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -327,7 +330,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric, _ time.Duration) error
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.copyReadHitsTotal,
|
||||
prometheus.GaugeValue,
|
||||
prometheus.CounterValue,
|
||||
c.perfDataObject[0].CopyReadHitsTotal,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user