From 1a67c6224acdb058571d045076d1cfe86ccf1d19 Mon Sep 17 00:00:00 2001 From: Chris Cleeland Date: Tue, 23 Apr 2024 11:22:29 -0500 Subject: [PATCH] UDP drops should be a counter, not a gauge. I think it makes sense for "drops" to sit alongside the queue length gauges in prom stats because they are all neighbors in procfs (source of these stats). Moreover, in reading the commit log message for the original creating work for udp_queues, I think there may have been some misreading or confusion between the word "state" and the common short-form of "stats" to mean "statistics". The original author "chose the name 'udp_queue' instead of 'udpstat' as UDP has no state"; I believe that 'udpstat' might actually be the more appropriate name. Signed-off-by: Chris Cleeland --- collector/udp_queues_linux.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collector/udp_queues_linux.go b/collector/udp_queues_linux.go index 15beb907..8d7cd690 100644 --- a/collector/udp_queues_linux.go +++ b/collector/udp_queues_linux.go @@ -62,7 +62,7 @@ func (c *udpQueuesCollector) Update(ch chan<- prometheus.Metric) error { ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s4.TxQueueLength), "tx", "v4") ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s4.RxQueueLength), "rx", "v4") if s4.Drops != nil { - ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(*s4.Drops), "drops", "v4") + ch <- prometheus.MustNewConstMetric(c.desc, prometheus.CounterValue, float64(*s4.Drops), "drops", "v4") } } else { if errors.Is(errIPv4, os.ErrNotExist) { @@ -77,7 +77,7 @@ func (c *udpQueuesCollector) Update(ch chan<- prometheus.Metric) error { ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s6.TxQueueLength), "tx", "v6") ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s6.RxQueueLength), "rx", "v6") if s6.Drops != nil { - ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(*s6.Drops), "drops", "v6") + ch <- prometheus.MustNewConstMetric(c.desc, prometheus.CounterValue, float64(*s6.Drops), "drops", "v6") } } else { if errors.Is(errIPv6, os.ErrNotExist) {