Example #1
0
// Get stats, converting as many values to numbers as possible.
// ...unless there's no connection, in which case we'll return empty stats.
func getNumericStats(client fetcher, which string) (rv map[string]interface{}) {
	if client == nil {
		rv = make(map[string]interface{})
	} else {
		rv = mapconv.Numerify(client.StatsMap(which))
	}
	return
}
Example #2
0
// Get stats, converting as many values to numbers as possible.
// ...unless there's no connection, in which case we'll return empty stats.
func getNumericStats(client fetcher, which string) (rv map[string]map[string]interface{}) {
	rv = make(map[string]map[string]interface{})

	if client != nil {
		tmp := client.GetStats(which)
		for k, v := range tmp {
			rv[k] = mapconv.Numerify(v, nil)
		}
	}
	return
}