func resetVarMap(varMap *expvar.Map) {
// There is no easy way to delete/clear expvar.Map. As such there is a slight
// race here. *sigh*
keys := []string{}
varMap.Do(func(kv expvar.KeyValue) {
keys = append(keys, kv.Key)
})
for _, key := range keys {
varMap.Set(key, new(expvar.Int))
}
}
https://www.mikeperham.com/2014/12/17/expvar-metrics-for-golang/
https://sysdig.com/blog/golang-expvar-custom-metrics/
https://medium.com/@piotrrojek/monitoring-apps-with-expvar-and-go-6d314267ee9f
https://github.com/FiloSottile/whoami.filippo.io/blob/7464e26635ec2a31289eb80b73a0312764690137/influxdb.go