func initConnPools() { cfg := g.Config() // init transfer global configs addrs := make([]string, 0) for hn, addr := range cfg.Transfer.Cluster { TransferHostnames = append(TransferHostnames, hn) addrs = append(addrs, addr) TransferMap[hn] = addr } // init transfer send cnt for hn, addr := range cfg.Transfer.Cluster { TransferSendCnt[hn] = nproc.NewSCounterQps(hn + ":" + addr) TransferSendFailCnt[hn] = nproc.NewSCounterQps(hn + ":" + addr) } // init conn pools SenderConnPools = cpool.CreateSafeRpcConnPools(cfg.Transfer.MaxConns, cfg.Transfer.MaxIdle, cfg.Transfer.ConnTimeout, cfg.Transfer.CallTimeout, addrs) }
package g import ( nproc "github.com/toolkits/proc" "log" ) // counter var ( ConfigCronCnt = nproc.NewSCounterQps("ConfigCronCnt") ConfigLastTs = nproc.NewSCounterBase("ConfigLastTs") ConfigLastCnt = nproc.NewSCounterBase("ConfigLastCnt") CollectorCronCnt = nproc.NewSCounterQps("CollectorCronCnt") CollectorLastTs = nproc.NewSCounterBase("CollectorLastTs") CollectorLastCnt = nproc.NewSCounterBase("CollectorLastCnt") CollectorCnt = nproc.NewSCounterQps("CollectorCnt") JudgeCronCnt = nproc.NewSCounterQps("JudgeCronCnt") JudgeLastTs = nproc.NewSCounterBase("JudgeLastTs") SenderCronCnt = nproc.NewSCounterQps("SenderCronCnt") SenderLastTs = nproc.NewSCounterBase("SenderLastTs") SenderCnt = nproc.NewSCounterQps("SenderCnt") ) // flood var ( FloodRate = nproc.NewSCounterBase("FloodRate") Threshold = nproc.NewSCounterBase("Threshold") Blocking = nproc.NewSCounterBase("nodata.blocking")
package proc import ( nproc "github.com/toolkits/proc" "log" ) // 统计指标的整体数据 var ( // http请求次数 HistoryRequestCnt = nproc.NewSCounterQps("HistoryRequestCnt") InfoRequestCnt = nproc.NewSCounterQps("InfoRequestCnt") LastRequestCnt = nproc.NewSCounterQps("LastRequestCnt") LastRawRequestCnt = nproc.NewSCounterQps("LastRawRequestCnt") // http回执的监控数据条数 HistoryResponseCounterCnt = nproc.NewSCounterQps("HistoryResponseCounterCnt") HistoryResponseItemCnt = nproc.NewSCounterQps("HistoryResponseItemCnt") LastRequestItemCnt = nproc.NewSCounterQps("LastRequestItemCnt") LastRawRequestItemCnt = nproc.NewSCounterQps("LastRawRequestItemCnt") // TODO http request delay ) func Start() { log.Println("proc.Start, ok") } func GetAll() []interface{} { ret := make([]interface{}, 0)
package proc import ( nproc "github.com/toolkits/proc" "log" ) // 索引更新 var ( IndexUpdateCnt = nproc.NewSCounterQps("IndexUpdateCnt") IndexUpdateErrorCnt = nproc.NewSCounterQps("IndexUpdateErrorCnt") IndexDeleteCnt = nproc.NewSCounterQps("IndexDeleteCnt") ) // 监控数据采集 var ( CollectorCronCnt = nproc.NewSCounterQps("CollectorCronCnt") ) func Start() { log.Println("proc.Start ok") } func GetAll() []interface{} { ret := make([]interface{}, 0) // index ret = append(ret, IndexUpdateCnt.Get()) ret = append(ret, IndexUpdateErrorCnt.Get()) ret = append(ret, IndexDeleteCnt.Get())
package proc import ( nproc "github.com/toolkits/proc" "log" ) // trace var ( RecvDataTrace = nproc.NewDataTrace("RecvDataTrace", 3) ) // 统计指标的整体数据 var ( // 计数统计,正确计数,错误计数, ... RecvCnt = nproc.NewSCounterQps("RecvCnt") RpcRecvCnt = nproc.NewSCounterQps("RpcRecvCnt") HttpRecvCnt = nproc.NewSCounterQps("HttpRecvCnt") SocketRecvCnt = nproc.NewSCounterQps("SocketRecvCnt") SendToJudgeCnt = nproc.NewSCounterQps("SendToJudgeCnt") SendToGraphCnt = nproc.NewSCounterQps("SendToGraphCnt") SendToGraphMigratingCnt = nproc.NewSCounterQps("SendToGraphMigratingCnt") SendToJudgeDropCnt = nproc.NewSCounterQps("SendToJudgeDropCnt") SendToGraphDropCnt = nproc.NewSCounterQps("SendToGraphDropCnt") SendToGraphMigratingDropCnt = nproc.NewSCounterQps("SendToGraphMigratingDropCnt") SendToJudgeFailCnt = nproc.NewSCounterQps("SendToJudgeFailCnt") SendToGraphFailCnt = nproc.NewSCounterQps("SendToGraphFailCnt") SendToGraphMigratingFailCnt = nproc.NewSCounterQps("SendToGraphMigratingFailCnt")
package proc import ( nproc "github.com/toolkits/proc" ) // 索引增量更新 var ( IndexUpdateIncr = nproc.NewSCounterQps("IndexUpdateIncr") IndexUpdateIncrCnt = nproc.NewSCounterBase("IndexUpdateIncrCnt") IndexUpdateIncrErrorCnt = nproc.NewSCounterQps("IndexUpdateIncrErrorCnt") IndexUpdateIncrDbEndpointSelectCnt = nproc.NewSCounterQps("IndexUpdateIncrDbEndpointSelectCnt") IndexUpdateIncrDbEndpointInsertCnt = nproc.NewSCounterQps("IndexUpdateIncrDbEndpointInsertCnt") IndexUpdateIncrDbTagEndpointSelectCnt = nproc.NewSCounterQps("IndexUpdateIncrDbTagEndpointSelectCnt") IndexUpdateIncrDbTagEndpointInsertCnt = nproc.NewSCounterQps("IndexUpdateIncrDbTagEndpointInsertCnt") IndexUpdateIncrDbEndpointCounterSelectCnt = nproc.NewSCounterQps("IndexUpdateIncrDbEndpointCounterSelectCnt") IndexUpdateIncrDbEndpointCounterInsertCnt = nproc.NewSCounterQps("IndexUpdateIncrDbEndpointCounterInsertCnt") IndexUpdateIncrDbEndpointCounterUpdateCnt = nproc.NewSCounterQps("IndexUpdateIncrDbEndpointCounterUpdateCnt") ) // 索引全量更新 var ( IndexUpdateAll = nproc.NewSCounterQps("IndexUpdateAll") IndexUpdateAllCnt = nproc.NewSCounterBase("IndexUpdateAllCnt") IndexUpdateAllErrorCnt = nproc.NewSCounterQps("IndexUpdateAllErrorCnt") ) // 索引缓存大小
package proc import ( nproc "github.com/toolkits/proc" "log" ) var ( PingCnt = nproc.NewSCounterQps("PingCnt") SendCnt = nproc.NewSCounterQps("SendCnt") SendItemsCnt = nproc.NewSCounterQps("SendItemsCnt") QueryCnt = nproc.NewSCounterQps("QueryCnt") QueryItemsCnt = nproc.NewSCounterQps("QueryItemsCnt") LastCnt = nproc.NewSCounterQps("LastCnt") LastItemsCnt = nproc.NewSCounterQps("LastItemsCnt") ) func Start() { log.Println("proc.Start ok") } func GetAll() []interface{} { ret := make([]interface{}, 0) ret = append(ret, PingCnt.Get()) ret = append(ret, SendCnt.Get()) ret = append(ret, SendItemsCnt.Get())