client/local: add method to set gauge metric to a value

The existing client metric methods only support incrementing (or
decrementing) a delta value.  This new method allows setting the metric
to a specific value.

Updates tailscale/corp#35327

Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d
Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
Will Norris
2025-12-15 14:01:00 -08:00
committed by Will Norris
parent f174ecb6fd
commit 0fd1670a59
6 changed files with 52 additions and 25 deletions
+2 -2
View File
@@ -66,8 +66,8 @@ func (menu *Menu) Run(client *local.Client) {
case <-menu.bgCtx.Done():
}
}()
go menu.lc.IncrementGauge(menu.bgCtx, "systray_running", 1)
defer menu.lc.IncrementGauge(menu.bgCtx, "systray_running", -1)
go menu.lc.SetGauge(menu.bgCtx, "systray_running", 1)
defer menu.lc.SetGauge(menu.bgCtx, "systray_running", 0)
systray.Run(menu.onReady, menu.onExit)
}