Adding backlog/current queue length to qdisc collector

Signed-off-by: fach <shaw38@gmail.com>
This commit is contained in:
fach 2020-06-03 10:30:18 -04:00
parent 0253277121
commit 0ea8978788
1 changed files with 14 additions and 0 deletions

View File

@ -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