mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-03 01:52:17 +08:00
feat: add long time push msg in prometheus
This commit is contained in:
parent
8c7de0416b
commit
2d7426c3a8
@ -93,6 +93,7 @@ func (c *ConsumerHandler) handleMs2PsChat(ctx context.Context, msg []byte) {
|
|||||||
nowSec := timeutil.GetCurrentTimestampBySecond()
|
nowSec := timeutil.GetCurrentTimestampBySecond()
|
||||||
|
|
||||||
if nowSec-sec > 10 {
|
if nowSec-sec > 10 {
|
||||||
|
prommetrics.MsgLoneTimePushCounter.Inc()
|
||||||
log.ZWarn(ctx, "long time push msg", nil, "msg", pbData.String(), "sec", sec, "nowSec", nowSec, "nowSec-sec", nowSec-sec)
|
log.ZWarn(ctx, "long time push msg", nil, "msg", pbData.String(), "sec", sec, "nowSec", nowSec, "nowSec-sec", nowSec-sec)
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
|
|||||||
@ -23,4 +23,8 @@ var (
|
|||||||
Name: "msg_offline_push_failed_total",
|
Name: "msg_offline_push_failed_total",
|
||||||
Help: "The number of msg failed offline pushed",
|
Help: "The number of msg failed offline pushed",
|
||||||
})
|
})
|
||||||
|
MsgLoneTimePushCounter = prometheus.NewCounter(prometheus.CounterOpts{
|
||||||
|
Name: "msg_long_time_push_total",
|
||||||
|
Help: "The number of messages with a push time exceeding 10 seconds",
|
||||||
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@ -47,9 +47,17 @@ func GetGrpcCusMetrics(registerName string, share *config.Share) []prometheus.Co
|
|||||||
case share.RpcRegisterName.MessageGateway:
|
case share.RpcRegisterName.MessageGateway:
|
||||||
return []prometheus.Collector{OnlineUserGauge}
|
return []prometheus.Collector{OnlineUserGauge}
|
||||||
case share.RpcRegisterName.Msg:
|
case share.RpcRegisterName.Msg:
|
||||||
return []prometheus.Collector{SingleChatMsgProcessSuccessCounter, SingleChatMsgProcessFailedCounter, GroupChatMsgProcessSuccessCounter, GroupChatMsgProcessFailedCounter}
|
return []prometheus.Collector{
|
||||||
|
SingleChatMsgProcessSuccessCounter,
|
||||||
|
SingleChatMsgProcessFailedCounter,
|
||||||
|
GroupChatMsgProcessSuccessCounter,
|
||||||
|
GroupChatMsgProcessFailedCounter,
|
||||||
|
}
|
||||||
case share.RpcRegisterName.Push:
|
case share.RpcRegisterName.Push:
|
||||||
return []prometheus.Collector{MsgOfflinePushFailedCounter}
|
return []prometheus.Collector{
|
||||||
|
MsgOfflinePushFailedCounter,
|
||||||
|
MsgLoneTimePushCounter,
|
||||||
|
}
|
||||||
case share.RpcRegisterName.Auth:
|
case share.RpcRegisterName.Auth:
|
||||||
return []prometheus.Collector{UserLoginCounter}
|
return []prometheus.Collector{UserLoginCounter}
|
||||||
case share.RpcRegisterName.User:
|
case share.RpcRegisterName.User:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user