Add Avg logical disk RW Queue metrics

Signed-off-by: Tehseen Shahab <tehseen.shahab@gmail.com>
This commit is contained in:
Tehseen Shahab
2022-12-30 03:15:06 +01:00
committed by Tehseen Shahab
parent 015b7c0666
commit 66a1e18c32
2 changed files with 49 additions and 15 deletions

View File

@@ -30,6 +30,8 @@ var (
// A LogicalDiskCollector is a Prometheus collector for perflib logicalDisk metrics // A LogicalDiskCollector is a Prometheus collector for perflib logicalDisk metrics
type LogicalDiskCollector struct { type LogicalDiskCollector struct {
RequestsQueued *prometheus.Desc RequestsQueued *prometheus.Desc
AvgReadQueue *prometheus.Desc
AvgWriteQueue *prometheus.Desc
ReadBytesTotal *prometheus.Desc ReadBytesTotal *prometheus.Desc
ReadsTotal *prometheus.Desc ReadsTotal *prometheus.Desc
WriteBytesTotal *prometheus.Desc WriteBytesTotal *prometheus.Desc
@@ -60,6 +62,20 @@ func NewLogicalDiskCollector() (Collector, error) {
nil, nil,
), ),
AvgReadQueue: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "avg_read_requests_queued"),
"Average number of read requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskReadQueueLength)",
[]string{"volume"},
nil,
),
AvgWriteQueue: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "avg_write_requests_queued"),
"Average number of write requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskWriteQueueLength)",
[]string{"volume"},
nil,
),
ReadBytesTotal: prometheus.NewDesc( ReadBytesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "read_bytes_total"), prometheus.BuildFQName(Namespace, subsystem, "read_bytes_total"),
"The number of bytes transferred from the disk during read operations (LogicalDisk.DiskReadBytesPerSec)", "The number of bytes transferred from the disk during read operations (LogicalDisk.DiskReadBytesPerSec)",
@@ -172,6 +188,8 @@ func (c *LogicalDiskCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.
type logicalDisk struct { type logicalDisk struct {
Name string Name string
CurrentDiskQueueLength float64 `perflib:"Current Disk Queue Length"` CurrentDiskQueueLength float64 `perflib:"Current Disk Queue Length"`
AvgDiskReadQueueLength float64 `perflib:"Avg. Disk Read Queue Length"`
AvgDiskWriteQueueLength float64 `perflib:"Avg. Disk Write Queue Length"`
DiskReadBytesPerSec float64 `perflib:"Disk Read Bytes/sec"` DiskReadBytesPerSec float64 `perflib:"Disk Read Bytes/sec"`
DiskReadsPerSec float64 `perflib:"Disk Reads/sec"` DiskReadsPerSec float64 `perflib:"Disk Reads/sec"`
DiskWriteBytesPerSec float64 `perflib:"Disk Write Bytes/sec"` DiskWriteBytesPerSec float64 `perflib:"Disk Write Bytes/sec"`
@@ -207,6 +225,20 @@ func (c *LogicalDiskCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.
volume.Name, volume.Name,
) )
ch <- prometheus.MustNewConstMetric(
c.AvgReadQueue,
prometheus.CounterValue,
volume.AvgDiskReadQueueLength*ticksToSecondsScaleFactor,
volume.Name,
)
ch <- prometheus.MustNewConstMetric(
c.AvgWriteQueue,
prometheus.CounterValue,
volume.AvgDiskWriteQueueLength*ticksToSecondsScaleFactor,
volume.Name,
)
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadBytesTotal, c.ReadBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,

View File

@@ -24,6 +24,8 @@ If given, a disk needs to *not* match the blacklist regexp in order for the corr
Name | Description | Type | Labels Name | Description | Type | Labels
-----|-------------|------|------- -----|-------------|------|-------
`requests_queued` | Number of requests outstanding on the disk at the time the performance data is collected | gauge | `volume` `requests_queued` | Number of requests outstanding on the disk at the time the performance data is collected | gauge | `volume`
`avg_read_requests_queued` | Average number of read requests that were queued for the selected disk during the sample interval | counter | `volume`
`avg_write_requests_queued` | Average number of write requests that were queued for the selected disk during the sample interval | counter | `volume`
`read_bytes_total` | Rate at which bytes are transferred from the disk during read operations | counter | `volume` `read_bytes_total` | Rate at which bytes are transferred from the disk during read operations | counter | `volume`
`reads_total` | Rate of read operations on the disk | counter | `volume` `reads_total` | Rate of read operations on the disk | counter | `volume`
`write_bytes_total` | Rate at which bytes are transferred to the disk during write operations | counter | `volume` `write_bytes_total` | Rate at which bytes are transferred to the disk during write operations | counter | `volume`