Files
routedns/vars.go
SeanBurford 482d40a5db Expvar (#84)
* Add metric tracking

* Clean up metrics structures.

* Add available route metric to router.
2020-09-06 09:55:30 -06:00

25 lines
594 B
Go

package rdns
import (
"expvar"
"fmt"
)
// Get an *expvar.Int with the given path.
func getVarInt(base string, id string, name string) *expvar.Int {
fullname := fmt.Sprintf("routedns.%s.%s.%s", base, id, name)
if v := expvar.Get(fullname); v != nil {
return v.(*expvar.Int)
}
return expvar.NewInt(fullname)
}
// Get an *expvar.Map with the given path.
func getVarMap(base string, id string, name string) *expvar.Map {
fullname := fmt.Sprintf("routedns.%s.%s.%s", base, id, name)
if v := expvar.Get(fullname); v != nil {
return v.(*expvar.Map)
}
return expvar.NewMap(fullname)
}