diff --git a/internal/msg_gateway/gate/init.go b/internal/msg_gateway/gate/init.go index 03f82f3ad..47d1dcedb 100644 --- a/internal/msg_gateway/gate/init.go +++ b/internal/msg_gateway/gate/init.go @@ -3,6 +3,8 @@ package gate import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" + "Open_IM/pkg/statistics" + "fmt" "github.com/go-playground/validator/v10" "sync" ) @@ -12,6 +14,7 @@ var ( validate *validator.Validate ws WServer rpcSvr RPCServer + count uint64 ) func Init(rpcPort, wsPort int) { @@ -19,6 +22,7 @@ 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) ws.onInit(wsPort) rpcSvr.onInit(rpcPort) } diff --git a/internal/msg_gateway/gate/logic.go b/internal/msg_gateway/gate/logic.go index d1756093c..2aa19f609 100644 --- a/internal/msg_gateway/gate/logic.go +++ b/internal/msg_gateway/gate/logic.go @@ -142,6 +142,7 @@ func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullM } func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) { + count++ log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID) nReply := new(pbChat.SendMsgResp) isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg) diff --git a/internal/push/logic/init.go b/internal/push/logic/init.go index 3581a361e..253aea2b2 100644 --- a/internal/push/logic/init.go +++ b/internal/push/logic/init.go @@ -11,7 +11,8 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/kafka" "Open_IM/pkg/common/log" - "time" + "Open_IM/pkg/statistics" + "fmt" ) var ( @@ -19,6 +20,7 @@ var ( pushCh PushConsumerHandler pushTerminal []int32 producer *kafka.Producer + count uint64 ) func Init(rpcPort int) { @@ -29,20 +31,10 @@ func Init(rpcPort int) { } func init() { producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic) + statistics.NewStatistics(&count, config.Config.ModuleName.PushName, fmt.Sprintf("%d second push to msg_gateway count", count), 10) } func Run() { go rpcServer.run() go pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&pushCh) - go stat() -} -func stat() { - t := time.NewTicker(time.Second * 10) - defer t.Stop() - for { - select { - case <-t.C: - } - log.Debug("", "10 second handle msg to mongo is ") - } } diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index fa147e762..b6a624f91 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -47,6 +47,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) { } } log.InfoByKv("push_result", pushMsg.OperationID, "result", wsResult, "sendData", pushMsg.MsgData) + count++ //if isOfflinePush && pushMsg.PushToUserID != pushMsg.MsgData.SendID { // for _, v := range wsResult { // if v.ResultCode == 0 {