Compare commits

...

1 Commits

Author SHA1 Message Date
Maisem Ali eaa0a7f8fd metrics: add LabelMap.GetSetFunc
Updates tailscale/corp#7354

Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-07-02 11:36:50 -07:00
1 changed files with 8 additions and 0 deletions

View File

@ -45,6 +45,14 @@ func (m *LabelMap) Get(key string) *expvar.Int {
return m.Map.Get(key).(*expvar.Int) return m.Map.Get(key).(*expvar.Int)
} }
// GetSetFunc returns a function that sets the expvar.Int named by key.
//
// Most callers should not need this; it exists to satisfy an
// interface elsewhere.
func (m *LabelMap) GetSetFunc(key string) func(delta int64) {
return m.Get(key).Set
}
// GetIncrFunc returns a function that increments the expvar.Int named by key. // GetIncrFunc returns a function that increments the expvar.Int named by key.
// //
// Most callers should not need this; it exists to satisfy an // Most callers should not need this; it exists to satisfy an