Skip to content

Commit 1a67c62

Browse files
committed
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 <[email protected]>
1 parent 5a060c2 commit 1a67c62

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

collector/udp_queues_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (c *udpQueuesCollector) Update(ch chan<- prometheus.Metric) error {
6262
ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s4.TxQueueLength), "tx", "v4")
6363
ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s4.RxQueueLength), "rx", "v4")
6464
if s4.Drops != nil {
65-
ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(*s4.Drops), "drops", "v4")
65+
ch <- prometheus.MustNewConstMetric(c.desc, prometheus.CounterValue, float64(*s4.Drops), "drops", "v4")
6666
}
6767
} else {
6868
if errors.Is(errIPv4, os.ErrNotExist) {
@@ -77,7 +77,7 @@ func (c *udpQueuesCollector) Update(ch chan<- prometheus.Metric) error {
7777
ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s6.TxQueueLength), "tx", "v6")
7878
ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s6.RxQueueLength), "rx", "v6")
7979
if s6.Drops != nil {
80-
ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(*s6.Drops), "drops", "v6")
80+
ch <- prometheus.MustNewConstMetric(c.desc, prometheus.CounterValue, float64(*s6.Drops), "drops", "v6")
8181
}
8282
} else {
8383
if errors.Is(errIPv6, os.ErrNotExist) {

0 commit comments

Comments
 (0)