net/sockstats: disable deltas for the cell radio power state metric

Updates tailscale/corp#9230

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
This commit is contained in:
Mihai Parparita 2023-04-07 17:49:53 -07:00 committed by Mihai Parparita
parent 22680a11ae
commit e978299bf0
1 changed files with 8 additions and 0 deletions

View File

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