metrics: add SetInt64 to ease using LabelMap for gauge metrics

Set is provided by the underlying Map.

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali 2023-02-18 09:31:01 -08:00
parent 1ba0b7fd79
commit a7eab788e4

View File

@ -33,6 +33,11 @@ type LabelMap struct {
expvar.Map
}
// SetInt64 sets the *Int value stored under the given map key.
func (m *LabelMap) SetInt64(key string, v int64) {
m.Get(key).Set(v)
}
// Get returns a direct pointer to the expvar.Int for key, creating it
// if necessary.
func (m *LabelMap) Get(key string) *expvar.Int {