feat Prometheus

This commit is contained in:
2026-01-16 22:36:18 +08:00
parent 6d5c7e81e9
commit 53cda1ce5e
6 changed files with 23 additions and 71 deletions

19
internal/global/metric.go Normal file
View 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)
}