logical_disk: remove the *_latency_seconds_total counters (#2763)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-16 20:41:42 +02:00
committed by GitHub
parent f1e6b49c54
commit 3555e9c4bc
9 changed files with 57 additions and 84 deletions
+6 -4
View File
@@ -26,7 +26,11 @@ multi-instance. These notes were recorded on a Windows Server 2025
`rate(windows_logical_disk_{read,write}_seconds_total[5m])`.
- `Avg. Disk sec/Read`, `/Write` and `/Transfer` are `PERF_AVERAGE_TIMER`.
Their base is the operation count and equals `Disk Reads/sec` (3073),
`Disk Writes/sec` (1698) and their sum (4771).
`Disk Writes/sec` (1698) and their sum (4771). Their raw values duplicate the
busy time, so the collector no longer reads them; the former
`*_latency_seconds_total` counters were the busy time, not a latency. The
average latency is `rate(windows_logical_disk_read_seconds_total[5m]) /
rate(windows_logical_disk_reads_total[5m])`.
- `% Idle Time` is a cumulative 100 ns timer as well, not a percentage.
On `C:` it was 115960642 ticks, about 11.6 seconds.
- `Disk Read Bytes/sec` and `Disk Write Bytes/sec` (`PERF_COUNTER_BULK_COUNT`)
@@ -52,9 +56,6 @@ Counters the collector reads:
| `% Disk Write Time` | `PERF_PRECISION_100NS_TIMER` | 11319205 | |
| `% Free Space` | `PERF_RAW_FRACTION` | 49907 | 129254 |
| `% Idle Time` | `PERF_PRECISION_100NS_TIMER` | 115960642 | |
| `Avg. Disk sec/Read` | `PERF_AVERAGE_TIMER` | 9858832 | 3073 |
| `Avg. Disk sec/Transfer` | `PERF_AVERAGE_TIMER` | 21178037 | 4771 |
| `Avg. Disk sec/Write` | `PERF_AVERAGE_TIMER` | 11319205 | 1698 |
| `Current Disk Queue Length` | `PERF_COUNTER_RAWCOUNT` | 0 | |
| `Disk Read Bytes/sec` | `PERF_COUNTER_BULK_COUNT` | 131518976 | |
| `Disk Reads/sec` | `PERF_COUNTER_COUNTER` | 3073 | |
@@ -66,6 +67,7 @@ Counters the collector reads:
Not read by the collector:
- `PERF_AVERAGE_BULK`: `Avg. Disk Bytes/Read`, `Avg. Disk Bytes/Transfer`, `Avg. Disk Bytes/Write`
- `PERF_AVERAGE_TIMER`: `Avg. Disk sec/Read` (raw 9858832, base 3073), `Avg. Disk sec/Transfer` (raw 21178037, base 4771), `Avg. Disk sec/Write` (raw 11319205, base 1698)
- `PERF_COUNTER_100NS_QUEUELEN_TYPE`: `Avg. Disk Queue Length`, `Avg. Disk Read Queue Length` (raw 9858832), `Avg. Disk Write Queue Length` (raw 11319205)
- `PERF_COUNTER_BULK_COUNT`: `Disk Bytes/sec`
- `PERF_COUNTER_COUNTER`: `Disk Transfers/sec`
+13 -58
View File
@@ -94,22 +94,19 @@ type Collector struct {
// lastMountErr is the last logged error of getAllMountedVolumes.
lastMountErr string
freeSpace *prometheus.Desc
idleTime *prometheus.Desc
information *prometheus.Desc
readBytesTotal *prometheus.Desc
readLatency *prometheus.Desc
readOnly *prometheus.Desc
readsTotal *prometheus.Desc
readTime *prometheus.Desc
readWriteLatency *prometheus.Desc
requestsQueued *prometheus.Desc
splitIOs *prometheus.Desc
totalSpace *prometheus.Desc
writeBytesTotal *prometheus.Desc
writeLatency *prometheus.Desc
writesTotal *prometheus.Desc
writeTime *prometheus.Desc
freeSpace *prometheus.Desc
idleTime *prometheus.Desc
information *prometheus.Desc
readBytesTotal *prometheus.Desc
readOnly *prometheus.Desc
readsTotal *prometheus.Desc
readTime *prometheus.Desc
requestsQueued *prometheus.Desc
splitIOs *prometheus.Desc
totalSpace *prometheus.Desc
writeBytesTotal *prometheus.Desc
writesTotal *prometheus.Desc
writeTime *prometheus.Desc
bitlockerStatus *prometheus.Desc
}
@@ -289,27 +286,6 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
nil,
)
c.readLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_latency_seconds_total"),
"Shows the average time, in seconds, of a read operation from the disk (LogicalDisk.AvgDiskSecPerRead)",
[]string{"volume"},
nil,
)
c.writeLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_latency_seconds_total"),
"Shows the average time, in seconds, of a write operation to the disk (LogicalDisk.AvgDiskSecPerWrite)",
[]string{"volume"},
nil,
)
c.readWriteLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_write_latency_seconds_total"),
"Shows the time, in seconds, of the average disk transfer (LogicalDisk.AvgDiskSecPerTransfer)",
[]string{"volume"},
nil,
)
c.bitlockerStatus = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bitlocker_status"),
"BitLocker status for the logical disk",
@@ -463,27 +439,6 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric, _ time.Duration) error
data.SplitIOPerSec,
data.Name,
)
ch <- prometheus.MustNewConstMetric(
c.readLatency,
prometheus.CounterValue,
data.AvgDiskSecPerRead*pdh.TicksToSecondScaleFactor,
data.Name,
)
ch <- prometheus.MustNewConstMetric(
c.writeLatency,
prometheus.CounterValue,
data.AvgDiskSecPerWrite*pdh.TicksToSecondScaleFactor,
data.Name,
)
ch <- prometheus.MustNewConstMetric(
c.readWriteLatency,
prometheus.CounterValue,
data.AvgDiskSecPerTransfer*pdh.TicksToSecondScaleFactor,
data.Name,
)
}
if c.bitlockerEnabled {
@@ -40,18 +40,22 @@ func TestCollector(t *testing.T) {
})
}
// TestCollectorAvgQueueRemoved checks that the removed avg_*_requests_queued gauges are
// gone while their replacements are still emitted. The raw "Avg. Disk Read/Write Queue
// Length" values were the same cumulative values as "% Disk Read/Write Time".
func TestCollectorAvgQueueRemoved(t *testing.T) {
// TestCollectorDuplicatesRemoved checks that the removed avg_*_requests_queued gauges and
// *_latency_seconds_total counters are gone while their replacements are still emitted.
// The raw "Avg. Disk Read/Write Queue Length" and "Avg. Disk sec/Read/Write/Transfer"
// values were the same cumulative values as "% Disk Read/Write Time".
func TestCollectorDuplicatesRemoved(t *testing.T) {
metrics := testutils.TestCollector(t, logical_disk.New, &logical_disk.Config{
CollectorsEnabled: logical_disk.ConfigDefaults.CollectorsEnabled,
VolumeInclude: types.RegExpAny,
})
for removed, replacement := range map[string]string{
"windows_logical_disk_avg_read_requests_queued": "windows_logical_disk_read_seconds_total",
"windows_logical_disk_avg_write_requests_queued": "windows_logical_disk_write_seconds_total",
"windows_logical_disk_avg_read_requests_queued": "windows_logical_disk_read_seconds_total",
"windows_logical_disk_avg_write_requests_queued": "windows_logical_disk_write_seconds_total",
"windows_logical_disk_read_latency_seconds_total": "windows_logical_disk_read_seconds_total",
"windows_logical_disk_write_latency_seconds_total": "windows_logical_disk_write_seconds_total",
"windows_logical_disk_read_write_latency_seconds_total": "windows_logical_disk_write_seconds_total",
} {
require.Empty(t, testutils.MetricValuesByLabel(metrics, removed, "volume"), "%s is still emitted", removed)
require.NotEmpty(t, testutils.MetricValuesByLabel(metrics, replacement, "volume"), "%s was not emitted", replacement)
-3
View File
@@ -20,9 +20,6 @@ package logical_disk
type perfDataCounterValues struct {
Name string
AvgDiskSecPerRead float64 `perfdata:"Avg. Disk sec/Read"`
AvgDiskSecPerTransfer float64 `perfdata:"Avg. Disk sec/Transfer"`
AvgDiskSecPerWrite float64 `perfdata:"Avg. Disk sec/Write"`
CurrentDiskQueueLength float64 `perfdata:"Current Disk Queue Length"`
FreeSpace float64 `perfdata:"Free Megabytes"`
DiskReadBytesPerSec float64 `perfdata:"Disk Read Bytes/sec"`
+6 -3
View File
@@ -86,9 +86,12 @@ var dynamicPrefixes = []string{
//
//nolint:gochecknoglobals
var historicalReferences = map[string]string{
"windows_logical_disk_avg_read_requests_queued": "docs/collector.logical_disk.md: removed in 0.32, use the read/write *_seconds_total rate",
"windows_logical_disk_avg_write_requests_queued": "docs/collector.logical_disk.md: removed in 0.32, use the read/write *_seconds_total rate",
"windows_net_route_info": "docs/collector.net.md: documented but never emitted, removed from the docs",
"windows_logical_disk_avg_read_requests_queued": "docs/collector.logical_disk.md: removed in 0.32, use the read/write *_seconds_total rate",
"windows_logical_disk_avg_write_requests_queued": "docs/collector.logical_disk.md: removed in 0.32, use the read/write *_seconds_total rate",
"windows_logical_disk_read_latency_seconds_total": "docs/collector.logical_disk.md: removed in 0.32, duplicated read_seconds_total",
"windows_logical_disk_read_write_latency_seconds_total": "docs/collector.logical_disk.md: removed in 0.32, the sum of the read and write busy time",
"windows_logical_disk_write_latency_seconds_total": "docs/collector.logical_disk.md: removed in 0.32, duplicated write_seconds_total",
"windows_net_route_info": "docs/collector.net.md: documented but never emitted, removed from the docs",
}
// ignoredReferences are windows_ names that are not metrics of the exporter.