From e978299bf06719042a0eec5c6bc14f52d8c0bb88 Mon Sep 17 00:00:00 2001 From: Mihai Parparita Date: Fri, 7 Apr 2023 17:49:53 -0700 Subject: [PATCH] net/sockstats: disable deltas for the cell radio power state metric Updates tailscale/corp#9230 Signed-off-by: Mihai Parparita --- net/sockstats/sockstats_tsgo.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/sockstats/sockstats_tsgo.go b/net/sockstats/sockstats_tsgo.go index ffbcda964..bccac4c0d 100644 --- a/net/sockstats/sockstats_tsgo.go +++ b/net/sockstats/sockstats_tsgo.go @@ -63,6 +63,14 @@ var sockStats = struct { radioHighMetric: clientmetric.NewGaugeFunc("sockstats_cellular_radio_high_fraction", radio.radioHighPercent), } +func init() { + // Deltas are not useful for this gauge metric, we want the collector to be + // able to get current values without having to wait for the 4 hour + // metricLogNameFrequency interval (by which point the cell radio state may + // be very different). + sockStats.radioHighMetric.DisableDeltas() +} + func withSockStats(ctx context.Context, label Label) context.Context { sockStats.mu.Lock() defer sockStats.mu.Unlock()