mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/persistentqueue: add vm_persistentqueue_bytes_pending
metric (#619)
Metric `vm_persistentqueue_bytes_pending` is a gauge that shows current amount of bytes in persistentqueue flushed on disk as a difference between write and read offsets. This metric is very similar to `vmagent_remotewrite_pending_data_bytes` except of accounting for bytes in-memory.
This commit is contained in:
parent
829ec4f9cf
commit
19dd121968
1 changed files with 5 additions and 0 deletions
|
@ -62,6 +62,8 @@ type Queue struct {
|
|||
|
||||
blocksRead *metrics.Counter
|
||||
bytesRead *metrics.Counter
|
||||
|
||||
bytesPending *metrics.Gauge
|
||||
}
|
||||
|
||||
// ResetIfEmpty resets q if it is empty.
|
||||
|
@ -166,6 +168,9 @@ func tryOpeningQueue(path, name string, chunkFileSize, maxBlockSize, maxPendingB
|
|||
q.bytesWritten = metrics.GetOrCreateCounter(fmt.Sprintf(`vm_persistentqueue_bytes_written_total{path=%q}`, path))
|
||||
q.blocksRead = metrics.GetOrCreateCounter(fmt.Sprintf(`vm_persistentqueue_blocks_read_total{path=%q}`, path))
|
||||
q.bytesRead = metrics.GetOrCreateCounter(fmt.Sprintf(`vm_persistentqueue_bytes_read_total{path=%q}`, path))
|
||||
q.bytesPending = metrics.GetOrCreateGauge(fmt.Sprintf(`vm_persistentqueue_bytes_pending{path=%q}`, path), func() float64 {
|
||||
return float64(q.GetPendingBytes())
|
||||
})
|
||||
|
||||
cleanOnError := func() {
|
||||
if q.reader != nil {
|
||||
|
|
Loading…
Reference in a new issue