config path
This commit is contained in:
@@ -32,7 +32,7 @@ func NewGinRouter() *gin.Engine {
|
||||
prome.NewApiRequestCounter()
|
||||
prome.NewApiRequestFailedCounter()
|
||||
prome.NewApiRequestSuccessCounter()
|
||||
r.Use(prome.PromeTheusMiddleware)
|
||||
r.Use(prome.PrometheusMiddleware)
|
||||
r.GET("/metrics", prome.PrometheusHandler())
|
||||
}
|
||||
userRouterGroup := r.Group("/user")
|
||||
|
||||
@@ -40,7 +40,7 @@ func Run(prometheusPort int) {
|
||||
go ws.run()
|
||||
go rpcSvr.run()
|
||||
go func() {
|
||||
err := prome.StartPromeSrv(prometheusPort)
|
||||
err := prome.StartPrometheusSrv(prometheusPort)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -50,18 +50,18 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
|
||||
case constant.WSGetNewestSeq:
|
||||
log.NewInfo(m.OperationID, "getSeqReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||
ws.getSeqReq(conn, &m)
|
||||
prome.PromeInc(prome.GetNewestSeqTotalCounter)
|
||||
prome.Inc(prome.GetNewestSeqTotalCounter)
|
||||
case constant.WSSendMsg:
|
||||
log.NewInfo(m.OperationID, "sendMsgReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||
ws.sendMsgReq(conn, &m)
|
||||
prome.PromeInc(prome.MsgRecvTotalCounter)
|
||||
prome.Inc(prome.MsgRecvTotalCounter)
|
||||
case constant.WSSendSignalMsg:
|
||||
log.NewInfo(m.OperationID, "sendSignalMsgReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||
ws.sendSignalMsgReq(conn, &m)
|
||||
case constant.WSPullMsgBySeqList:
|
||||
log.NewInfo(m.OperationID, "pullMsgBySeqListReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||
ws.pullMsgBySeqListReq(conn, &m)
|
||||
prome.PromeInc(prome.PullMsgBySeqListTotalCounter)
|
||||
prome.Inc(prome.PullMsgBySeqListTotalCounter)
|
||||
case constant.WsLogoutMsg:
|
||||
log.NewInfo(m.OperationID, "conn.Close()", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||
ws.userLogoutReq(conn, &m)
|
||||
|
||||
@@ -203,7 +203,7 @@ func (r *RPCServer) SuperGroupOnlineBatchPushOneMsg(_ context.Context, req *pbRe
|
||||
resultCode := sendMsgBatchToUser(userConn, replyBytes.Bytes(), req, platform, v)
|
||||
if resultCode == 0 && utils.IsContainInt(platform, r.pushTerminal) {
|
||||
tempT.OnlinePush = true
|
||||
prome.PromeInc(prome.MsgOnlinePushSuccessCounter)
|
||||
prome.Inc(prome.MsgOnlinePushSuccessCounter)
|
||||
log.Info(req.OperationID, "PushSuperMsgToUser is success By Ws", "args", req.String(), "recvPlatForm", constant.PlatformIDToName(platform), "recvID", v)
|
||||
temp.ResultCode = resultCode
|
||||
resp = append(resp, temp)
|
||||
|
||||
@@ -351,7 +351,7 @@ func (ws *WServer) addUserConn(uid string, platformID int, conn *UserConn, token
|
||||
for _, v := range ws.wsUserToConn {
|
||||
count = count + len(v)
|
||||
}
|
||||
prome.PromeGaugeInc(prome.OnlineUserGauge)
|
||||
prome.GaugeInc(prome.OnlineUserGauge)
|
||||
log.Debug(operationID, "WS Add operation", "", "wsUser added", ws.wsUserToConn, "connection_uid", uid, "connection_platform", constant.PlatformIDToName(platformID), "online_user_num", len(ws.wsUserToConn), "online_conn_num", count)
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ func (ws *WServer) delUserConn(conn *UserConn) {
|
||||
if callbackResp.ErrCode != 0 {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "callbackUserOffline failed", callbackResp)
|
||||
}
|
||||
prome.PromeGaugeDec(prome.OnlineUserGauge)
|
||||
prome.GaugeDec(prome.OnlineUserGauge)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ func (m *MsgTransfer) Run(promePort int) {
|
||||
go m.historyMongoCH.historyConsumerGroup.RegisterHandleAndConsumer(&m.historyMongoCH)
|
||||
go m.modifyCH.modifyMsgConsumerGroup.RegisterHandleAndConsumer(&m.modifyCH)
|
||||
go func() {
|
||||
err := prome.StartPromeSrv(promePort)
|
||||
err := prome.StartPrometheusSrv(promePort)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func (p *Push) Run(prometheusPort int) {
|
||||
go p.rpcServer.run()
|
||||
go p.pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&p.pushCh)
|
||||
go func() {
|
||||
err := prome.StartPromeSrv(prometheusPort)
|
||||
err := prome.StartPrometheusSrv(prometheusPort)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -187,10 +187,10 @@ func (p *Pusher) OfflinePushMsg(ctx context.Context, sourceID string, msg *sdkws
|
||||
}
|
||||
err = p.offlinePusher.Push(ctx, offlinePushUserIDs, title, content, opts)
|
||||
if err != nil {
|
||||
prome.PromeInc(prome.MsgOfflinePushFailedCounter)
|
||||
prome.Inc(prome.MsgOfflinePushFailedCounter)
|
||||
return err
|
||||
}
|
||||
prome.PromeInc(prome.MsgOfflinePushSuccessCounter)
|
||||
prome.Inc(prome.MsgOfflinePushSuccessCounter)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@ import (
|
||||
|
||||
func (m *msgServer) sendMsgSuperGroupChat(ctx context.Context, req *msg.SendMsgReq) (resp *msg.SendMsgResp, err error) {
|
||||
resp = &msg.SendMsgResp{}
|
||||
promePkg.PromeInc(promePkg.WorkSuperGroupChatMsgRecvSuccessCounter)
|
||||
promePkg.Inc(promePkg.WorkSuperGroupChatMsgRecvSuccessCounter)
|
||||
// callback
|
||||
if err = CallbackBeforeSendGroupMsg(ctx, req); err != nil && err != constant.ErrCallbackContinue {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if _, err = m.messageVerification(ctx, req); err != nil {
|
||||
promePkg.PromeInc(promePkg.WorkSuperGroupChatMsgProcessFailedCounter)
|
||||
promePkg.Inc(promePkg.WorkSuperGroupChatMsgProcessFailedCounter)
|
||||
return nil, err
|
||||
}
|
||||
msgToMQSingle := msg.MsgDataToMQ{MsgData: req.MsgData}
|
||||
@@ -34,7 +34,7 @@ func (m *msgServer) sendMsgSuperGroupChat(ctx context.Context, req *msg.SendMsgR
|
||||
return nil, err
|
||||
}
|
||||
|
||||
promePkg.PromeInc(promePkg.WorkSuperGroupChatMsgProcessSuccessCounter)
|
||||
promePkg.Inc(promePkg.WorkSuperGroupChatMsgProcessSuccessCounter)
|
||||
resp.SendTime = msgToMQSingle.MsgData.SendTime
|
||||
resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID
|
||||
resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID
|
||||
@@ -60,7 +60,7 @@ func (m *msgServer) sendMsgNotification(ctx context.Context, req *msg.SendMsgReq
|
||||
}
|
||||
|
||||
func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *msg.SendMsgReq) (resp *msg.SendMsgResp, err error) {
|
||||
promePkg.PromeInc(promePkg.SingleChatMsgRecvSuccessCounter)
|
||||
promePkg.Inc(promePkg.SingleChatMsgRecvSuccessCounter)
|
||||
if err = CallbackBeforeSendSingleMsg(ctx, req); err != nil && err != constant.ErrCallbackContinue {
|
||||
return nil, err
|
||||
}
|
||||
@@ -89,7 +89,7 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *msg.SendMsgReq)
|
||||
if err != nil && err != constant.ErrCallbackContinue {
|
||||
return nil, err
|
||||
}
|
||||
promePkg.PromeInc(promePkg.SingleChatMsgProcessSuccessCounter)
|
||||
promePkg.Inc(promePkg.SingleChatMsgProcessSuccessCounter)
|
||||
resp.SendTime = msgToMQSingle.MsgData.SendTime
|
||||
resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID
|
||||
resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID
|
||||
@@ -98,7 +98,7 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *msg.SendMsgReq)
|
||||
|
||||
func (m *msgServer) sendMsgGroupChat(ctx context.Context, req *msg.SendMsgReq) (resp *msg.SendMsgResp, err error) {
|
||||
// callback
|
||||
promePkg.PromeInc(promePkg.GroupChatMsgRecvSuccessCounter)
|
||||
promePkg.Inc(promePkg.GroupChatMsgRecvSuccessCounter)
|
||||
err = CallbackBeforeSendGroupMsg(ctx, req)
|
||||
if err != nil && err != constant.ErrCallbackContinue {
|
||||
return nil, err
|
||||
@@ -106,7 +106,7 @@ func (m *msgServer) sendMsgGroupChat(ctx context.Context, req *msg.SendMsgReq) (
|
||||
|
||||
var memberUserIDList []string
|
||||
if memberUserIDList, err = m.messageVerification(ctx, req); err != nil {
|
||||
promePkg.PromeInc(promePkg.GroupChatMsgProcessFailedCounter)
|
||||
promePkg.Inc(promePkg.GroupChatMsgProcessFailedCounter)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ func (m *msgServer) sendMsgGroupChat(ctx context.Context, req *msg.SendMsgReq) (
|
||||
}
|
||||
//
|
||||
|
||||
promePkg.PromeInc(promePkg.GroupChatMsgProcessSuccessCounter)
|
||||
promePkg.Inc(promePkg.GroupChatMsgProcessSuccessCounter)
|
||||
resp.SendTime = msgToMQSingle.MsgData.SendTime
|
||||
resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID
|
||||
resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID
|
||||
|
||||
@@ -57,7 +57,7 @@ func start(rpcPorts []int, rpcRegisterName string, prometheusPorts []int, rpcFn
|
||||
return err
|
||||
}
|
||||
if config.Config.Prometheus.Enable {
|
||||
err := prome.StartPromeSrv(*flagPrometheusPort)
|
||||
err := prome.StartPrometheusSrv(*flagPrometheusPort)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user