feat Prometheus
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package global
|
||||
|
||||
import "github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
const (
|
||||
KeyGatewayAccessToken = "gateway:token:access:%v"
|
||||
KeyGatewayRefreshToken = "gateway:token:refresh:%v"
|
||||
@@ -14,7 +12,3 @@ const (
|
||||
MaxOnlineSize = 100 // 最大在线人数
|
||||
MaxQueueUpSize = 100 // 最大排队人数
|
||||
)
|
||||
|
||||
var (
|
||||
OnlineUsersGauge prometheus.Gauge
|
||||
)
|
||||
|
||||
19
internal/global/metric.go
Normal file
19
internal/global/metric.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package global
|
||||
|
||||
import (
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
var (
|
||||
OnlineUsersGauge prometheus.Gauge
|
||||
)
|
||||
|
||||
func init() {
|
||||
log.Infof("Init prometheus metric...")
|
||||
OnlineUsersGauge = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "online_users",
|
||||
Help: "Total number of online users",
|
||||
})
|
||||
prometheus.MustRegister(OnlineUsersGauge)
|
||||
}
|
||||
Reference in New Issue
Block a user