Remove Prometheus metrics

This commit is contained in:
sergystepanov 2026-07-02 21:22:25 +03:00
parent 68ac6afab4
commit 00d93c0a00
5 changed files with 1 additions and 29 deletions

3
go.mod
View file

@ -3,7 +3,6 @@ module github.com/giongto35/cloud-game/v3
go 1.26
require (
github.com/VictoriaMetrics/metrics v1.44.0
github.com/cavaliergopher/grab/v3 v3.0.1
github.com/fsnotify/fsnotify v1.10.1
github.com/go-gst/go-gst v1.4.0
@ -53,8 +52,6 @@ require (
github.com/pion/transport/v4 v4.0.2 // indirect
github.com/pion/turn/v5 v5.0.10 // indirect
github.com/tinylib/msgp v1.6.4 // indirect
github.com/valyala/fastrand v1.1.0 // indirect
github.com/valyala/histogram v1.2.0 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
github.com/zeebo/xxh3 v1.1.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect

6
go.sum
View file

@ -1,5 +1,3 @@
github.com/VictoriaMetrics/metrics v1.44.0 h1:Fr8yqQSV+ZfYaDD/anqk1E8e9YPgfleSleJmAI0M0Tw=
github.com/VictoriaMetrics/metrics v1.44.0/go.mod h1:xDM82ULLYCYdFRgQ2JBxi8Uf1+8En1So9YUwlGTOqTc=
github.com/cavaliergopher/grab/v3 v3.0.1 h1:4z7TkBfmPjmLAAmkkAZNX/6QJ1nNFdv3SdIHXju0Fr4=
github.com/cavaliergopher/grab/v3 v3.0.1/go.mod h1:1U/KNnD+Ft6JJiYoYBAimKH2XrYptb8Kl3DFGmsjpq4=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
@ -109,10 +107,6 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/tinylib/msgp v1.6.4 h1:mOwYbyYDLPj35mkA2BjjYejgJk9BuHxDdvRnb6v2ZcQ=
github.com/tinylib/msgp v1.6.4/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA=
github.com/valyala/fastrand v1.1.0 h1:f+5HkLW4rsgzdNoleUOB69hyT9IlD2ZQh9GyDMfb5G8=
github.com/valyala/fastrand v1.1.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
github.com/valyala/histogram v1.2.0 h1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OLoQ=
github.com/valyala/histogram v1.2.0/go.mod h1:Hb4kBwb4UxsaNbbbh+RRz8ZR6pdodR57tzWUS3BUzXY=
github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU=
github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=

View file

@ -52,7 +52,6 @@ coordinator:
port: 6601
# enable Go profiler HTTP server
profilingEnabled: false
metricEnabled: false
urlPrefix: /coordinator
# a custom Origins for incoming Websocket connections:
# "" -- checks same origin policy
@ -105,8 +104,6 @@ worker:
# monitoring server port
port: 6602
profilingEnabled: false
# monitoring server URL prefix
metricEnabled: false
urlPrefix: /worker
server:
address: :9000

View file

@ -25,11 +25,10 @@ func (l Library) GetSupportedExtensions() []string { return l.Supported }
type Monitoring struct {
Port int
URLPrefix string
MetricEnabled bool `json:"metric_enabled"`
ProfilingEnabled bool `json:"profiling_enabled"`
}
func (c *Monitoring) IsEnabled() bool { return c.MetricEnabled || c.ProfilingEnabled }
func (c *Monitoring) IsEnabled() bool { return c.ProfilingEnabled }
type Server struct {
Address string

View file

@ -6,14 +6,12 @@ import (
"net/http/pprof"
"strconv"
"github.com/VictoriaMetrics/metrics"
"github.com/giongto35/cloud-game/v3/pkg/config"
"github.com/giongto35/cloud-game/v3/pkg/logger"
"github.com/giongto35/cloud-game/v3/pkg/network/httpx"
)
const debugEndpoint = "/debug/pprof"
const metricsEndpoint = "/metrics"
type Monitoring struct {
conf config.Monitoring
@ -42,12 +40,6 @@ func New(conf config.Monitoring, baseAddr string, log *logger.Logger) *Monitorin
Handle("/mutex", pprof.Handler("mutex")).
Handle("/threadcreate", pprof.Handler("threadcreate"))
}
if conf.MetricEnabled {
h.Prefix(conf.URLPrefix)
h.HandleFunc(metricsEndpoint, func(w httpx.ResponseWriter, _ *httpx.Request) {
metrics.WritePrometheus(w, true)
})
}
h.Prefix("")
return h
},
@ -75,10 +67,6 @@ func (m *Monitoring) String() string {
return fmt.Sprintf("monitoring::%s:%d", m.conf.URLPrefix, m.conf.Port)
}
func (m *Monitoring) GetMetricsPublicAddress() string {
return m.server.GetProtocol() + "://" + m.server.Addr + m.conf.URLPrefix + metricsEndpoint
}
func (m *Monitoring) GetProfilingAddress() string {
return m.server.GetProtocol() + "://" + m.server.Addr + m.conf.URLPrefix + debugEndpoint
}
@ -88,8 +76,5 @@ func (m *Monitoring) printInfo() {
if m.conf.ProfilingEnabled {
message = message.Str("profiler", m.GetProfilingAddress())
}
if m.conf.MetricEnabled {
message = message.Str("prometheus", m.GetMetricsPublicAddress())
}
message.Msg("Monitoring")
}