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>
pull/7313/head
Maisem Ali 2 years ago
parent 1ba0b7fd79
commit a7eab788e4

@ -33,6 +33,11 @@ type LabelMap struct {
expvar.Map 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 // Get returns a direct pointer to the expvar.Int for key, creating it
// if necessary. // if necessary.
func (m *LabelMap) Get(key string) *expvar.Int { func (m *LabelMap) Get(key string) *expvar.Int {

Loading…
Cancel
Save