prometheus for statistics

This commit is contained in:
skiffer-git
2022-09-14 19:36:59 +08:00
parent 266a2b4c76
commit ebdb875c56
6 changed files with 145 additions and 140 deletions
+23 -1
View File
@@ -6,7 +6,6 @@ import (
)
var (
// user rpc
UserLoginCounter prometheus.Counter
UserRegisterCounter prometheus.Counter
@@ -14,6 +13,9 @@ var (
SeqGetFailedCounter prometheus.Counter
SeqSetSuccessCounter prometheus.Counter
SeqSetFailedCounter prometheus.Counter
MsgInsertRedisSuccessCounter prometheus.Counter
MsgInsertRedisFailedCounter prometheus.Counter
)
func NewUserLoginCounter() {
@@ -22,6 +24,12 @@ func NewUserLoginCounter() {
Help: "The number of user login",
})
}
func NewUserRegisterCounter() {
UserRegisterCounter = promauto.NewCounter(prometheus.CounterOpts{
Name: "user_register",
Help: "The number of user register",
})
}
func NewSeqGetSuccessCounter() {
SeqGetSuccessCounter = promauto.NewCounter(prometheus.CounterOpts{
@@ -48,3 +56,17 @@ func NewSeqSetFailedCounter() {
Help: "The number of failed set seq",
})
}
func NewMsgInsertRedisSuccessCounter() {
MsgInsertRedisSuccessCounter = promauto.NewCounter(prometheus.CounterOpts{
Name: "msg_insert_redis_success",
Help: "The number of successful insert msg to redis",
})
}
func NewMsgInsertRedisFailedCounter() {
MsgInsertRedisFailedCounter = promauto.NewCounter(prometheus.CounterOpts{
Name: "msg_insert_redis_failed",
Help: "The number of failed insert msg to redis",
})
}