From 0ea89787889788c0a8a809e9525c6e9c6ff7e377 Mon Sep 17 00:00:00 2001 From: fach Date: Wed, 3 Jun 2020 10:30:18 -0400 Subject: [PATCH] Adding backlog/current queue length to qdisc collector Signed-off-by: fach --- collector/qdisc_linux.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/collector/qdisc_linux.go b/collector/qdisc_linux.go index daba1999..ba462a0e 100644 --- a/collector/qdisc_linux.go +++ b/collector/qdisc_linux.go @@ -32,6 +32,8 @@ type qdiscStatCollector struct { drops typedDesc requeues typedDesc overlimits typedDesc + qlength typedDesc + backlog typedDesc logger log.Logger } @@ -71,6 +73,16 @@ func NewQdiscStatCollector(logger log.Logger) (Collector, error) { "Number of overlimit packets.", []string{"device", "kind"}, nil, ), prometheus.CounterValue}, + qlength: typedDesc{prometheus.NewDesc( + prometheus.BuildFQName(namespace, "qdisc", "current_queue_length"), + "Number of packets currently in queue to be sent.", + []string{"device", "kind"}, nil, + ), prometheus.GaugeValue}, + backlog: typedDesc{prometheus.NewDesc( + prometheus.BuildFQName(namespace, "qdisc", "backlog"), + "Number of bytes currently in queue to be sent.", + []string{"device", "kind"}, nil, + ), prometheus.GaugeValue}, logger: logger, }, nil } @@ -114,6 +126,8 @@ func (c *qdiscStatCollector) Update(ch chan<- prometheus.Metric) error { ch <- c.drops.mustNewConstMetric(float64(msg.Drops), msg.IfaceName, msg.Kind) ch <- c.requeues.mustNewConstMetric(float64(msg.Requeues), msg.IfaceName, msg.Kind) ch <- c.overlimits.mustNewConstMetric(float64(msg.Overlimits), msg.IfaceName, msg.Kind) + ch <- c.qlength.mustNewConstMetric(float64(msg.Qlen), msg.IfaceName, msg.Kind) + ch <- c.backlog.mustNewConstMetric(float64(msg.Backlog), msg.IfaceName, msg.Kind) } return nil