statistics code

This commit is contained in:
Gordon
2022-03-01 15:53:33 +08:00
parent 58163cefa0
commit 0e9e02de0b
4 changed files with 12 additions and 8 deletions
+8 -6
View File
@@ -10,11 +10,12 @@ import (
)
var (
rwLock *sync.RWMutex
validate *validator.Validate
ws WServer
rpcSvr RPCServer
count uint64
rwLock *sync.RWMutex
validate *validator.Validate
ws WServer
rpcSvr RPCServer
sendMsgCount uint64
userCount uint64
)
func Init(rpcPort, wsPort int) {
@@ -22,7 +23,8 @@ func Init(rpcPort, wsPort int) {
log.NewPrivateLog(config.Config.ModuleName.LongConnSvrName)
rwLock = new(sync.RWMutex)
validate = validator.New()
statistics.NewStatistics(&count, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second recv to msg_gateway count", count), 10)
statistics.NewStatistics(&sendMsgCount, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second recv to msg_gateway sendMsgCount", sendMsgCount), 10)
statistics.NewStatistics(&userCount, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second add user conn", userCount), 10)
ws.onInit(wsPort)
rpcSvr.onInit(rpcPort)
}