From e1b1af9a486828840d5add3c4f79744733506cf4 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 14 Sep 2022 18:31:56 +0800 Subject: [PATCH 1/3] private message cache update --- internal/rpc/conversation/conversaion.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index ef86dee3d..3a6af935e 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -148,7 +148,11 @@ func syncPeerUserConversation(conversation *pbConversation.Conversation, operati } err = rocksCache.DelConversationFromCache(conversation.UserID, utils.GetConversationIDBySessionType(conversation.OwnerUserID, constant.SingleChatType)) if err != nil { - log.NewError(operationID, utils.GetSelfFuncName(), "DelConversationFromCache failed", err.Error()) + log.NewError(operationID, utils.GetSelfFuncName(), "DelConversationFromCache failed", err.Error(), conversation.OwnerUserID, conversation.ConversationID) + } + err = rocksCache.DelConversationFromCache(conversation.OwnerUserID, conversation.ConversationID) + if err != nil { + log.NewError(operationID, utils.GetSelfFuncName(), "DelConversationFromCache failed", err.Error(), conversation.OwnerUserID, conversation.ConversationID) } chat.ConversationSetPrivateNotification(operationID, conversation.OwnerUserID, conversation.UserID, conversation.IsPrivateChat) return nil From e78f7a2a37b21ba0e62cb47ebcddd44dfb4faa41 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Wed, 14 Sep 2022 18:47:11 +0800 Subject: [PATCH 2/3] prometheus for statistics --- pkg/common/prometheus/{constant.go => gather.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pkg/common/prometheus/{constant.go => gather.go} (100%) diff --git a/pkg/common/prometheus/constant.go b/pkg/common/prometheus/gather.go similarity index 100% rename from pkg/common/prometheus/constant.go rename to pkg/common/prometheus/gather.go From 8dce5396b07c3b460a51a2d9af0c61dd0c629baa Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Wed, 14 Sep 2022 18:58:30 +0800 Subject: [PATCH 3/3] prometheus for statistics --- pkg/common/prometheus/gather.go | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/pkg/common/prometheus/gather.go b/pkg/common/prometheus/gather.go index 9ced5908d..b5d252e66 100644 --- a/pkg/common/prometheus/gather.go +++ b/pkg/common/prometheus/gather.go @@ -9,6 +9,11 @@ var ( // user rpc UserLoginCounter prometheus.Counter UserRegisterCounter prometheus.Counter + + SeqGetSuccessCounter prometheus.Counter + SeqGetFailedCounter prometheus.Counter + SeqSetSuccessCounter prometheus.Counter + SeqSetFailedCounter prometheus.Counter ) func NewUserLoginCounter() { @@ -18,9 +23,28 @@ func NewUserLoginCounter() { }) } -func NewUserRegisterCounter() { - UserRegisterCounter = promauto.NewCounter(prometheus.CounterOpts{ - Name: "user_register", - Help: "The number of user register", +func NewSeqGetSuccessCounter() { + SeqGetSuccessCounter = promauto.NewCounter(prometheus.CounterOpts{ + Name: "seq_get_success", + Help: "The number of successful get seq", + }) +} +func NewSeqGetFailedCounter() { + SeqGetFailedCounter = promauto.NewCounter(prometheus.CounterOpts{ + Name: "seq_get_failed", + Help: "The number of failed get seq", + }) +} + +func NewSeqSetSuccessCounter() { + SeqSetSuccessCounter = promauto.NewCounter(prometheus.CounterOpts{ + Name: "seq_set_success", + Help: "The number of successful set seq", + }) +} +func NewSeqSetFailedCounter() { + SeqSetFailedCounter = promauto.NewCounter(prometheus.CounterOpts{ + Name: "seq_set_failed", + Help: "The number of failed set seq", }) }