mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-11 13:06:36 +00:00
*: Implement collector interface for registry perfdata (#1670)
This commit is contained in:
@@ -9,7 +9,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perflib"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata/perftypes"
|
||||
v1 "github.com/prometheus-community/windows_exporter/internal/perfdata/v1"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
@@ -240,7 +241,7 @@ func (c *Collector) collect(ctx *types.ScrapeContext, logger *slog.Logger, ch ch
|
||||
|
||||
var dst []PhysicalDisk
|
||||
|
||||
if err := perflib.UnmarshalObject(ctx.PerfObjects["PhysicalDisk"], &dst, logger); err != nil {
|
||||
if err := v1.UnmarshalObject(ctx.PerfObjects["PhysicalDisk"], &dst, logger); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -321,21 +322,21 @@ func (c *Collector) collect(ctx *types.ScrapeContext, logger *slog.Logger, ch ch
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.readLatency,
|
||||
prometheus.CounterValue,
|
||||
disk.AvgDiskSecPerRead*perflib.TicksToSecondScaleFactor,
|
||||
disk.AvgDiskSecPerRead*perftypes.TicksToSecondScaleFactor,
|
||||
disk_number,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.writeLatency,
|
||||
prometheus.CounterValue,
|
||||
disk.AvgDiskSecPerWrite*perflib.TicksToSecondScaleFactor,
|
||||
disk.AvgDiskSecPerWrite*perftypes.TicksToSecondScaleFactor,
|
||||
disk_number,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.readWriteLatency,
|
||||
prometheus.CounterValue,
|
||||
disk.AvgDiskSecPerTransfer*perflib.TicksToSecondScaleFactor,
|
||||
disk.AvgDiskSecPerTransfer*perftypes.TicksToSecondScaleFactor,
|
||||
disk_number,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user