feat Prometheus
This commit is contained in:
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