Adding backlog/current queue length to qdisc collector

Signed-off-by: fach <shaw38@gmail.com>
pull/1732/head
fach 5 years ago
parent 0253277121
commit 0ea8978788

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

Loading…
Cancel
Save