feat 自定义拦截器

This commit is contained in:
2026-01-16 23:51:45 +08:00
parent b76595d164
commit ba16c2cce3
5 changed files with 20 additions and 4 deletions

View File

@@ -7,13 +7,20 @@ import (
var (
OnlineUsersGauge prometheus.Gauge
FlowCounter prometheus.Counter
)
func init() {
log.Infof("Init prometheus metric...")
OnlineUsersGauge = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "online_users",
Name: "gateway_online_users",
Help: "Total number of online users",
})
prometheus.MustRegister(OnlineUsersGauge)
FlowCounter = prometheus.NewCounter(prometheus.CounterOpts{
Name: "gateway_flow_counter",
Help: "Total number of flow",
})
prometheus.MustRegister(FlowCounter)
}