func apiGetProxyList(param martini.Params) (int, string) { proxies, err := models.ProxyList(safeZkConn, globalEnv.ProductName(), nil) if err != nil { log.ErrorErrorf(err, "get proxy list failed") return 500, err.Error() } b, err := json.MarshalIndent(proxies, " ", " ") return 200, string(b) }
func getAllProxyOps() int64 { proxies, err := models.ProxyList(unsafeZkConn, globalEnv.ProductName(), nil) if err != nil { log.ErrorErrorf(err, "get proxy list failed") return -1 } var total int64 for _, p := range proxies { i, err := p.Ops() if err != nil { log.WarnErrorf(err, "get proxy ops failed") } total += i } return total }
// for debug func getAllProxyDebugVars() map[string]map[string]interface{} { proxies, err := models.ProxyList(unsafeZkConn, globalEnv.ProductName(), nil) if err != nil { log.ErrorErrorf(err, "get proxy list failed") return nil } ret := make(map[string]map[string]interface{}) for _, p := range proxies { m, err := p.DebugVars() if err != nil { log.WarnErrorf(err, "get proxy debug varsfailed") } ret[p.Id] = m } return ret }