feat 在线人数埋点
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"fmt"
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
"git.hlsq.asia/mmorpg/service-gateway/config"
|
||||
"git.hlsq.asia/mmorpg/service-gateway/internal/global"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"net/http"
|
||||
"sync"
|
||||
@@ -19,6 +21,13 @@ type ModulePrometheus struct {
|
||||
|
||||
func (m *ModulePrometheus) init() error {
|
||||
m.wg = &sync.WaitGroup{}
|
||||
|
||||
global.OnlineUsersGauge = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "gateway_online_users_total",
|
||||
Help: "Total number of online users in gateway",
|
||||
})
|
||||
prometheus.MustRegister(global.OnlineUsersGauge)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user