api: move prometheus handler inside api handler /v1/metrics

This commit is contained in:
yusing
2025-02-01 02:09:43 +08:00
parent 6ae391a3c9
commit 0d518166ee
4 changed files with 10 additions and 17 deletions

View File

@@ -15,7 +15,6 @@ import (
"github.com/yusing/go-proxy/internal/entrypoint"
E "github.com/yusing/go-proxy/internal/error"
"github.com/yusing/go-proxy/internal/logging"
"github.com/yusing/go-proxy/internal/metrics"
"github.com/yusing/go-proxy/internal/net/http/server"
"github.com/yusing/go-proxy/internal/notif"
proxy "github.com/yusing/go-proxy/internal/route/provider"
@@ -182,7 +181,7 @@ func (cfg *Config) StartProxyProviders() {
}
type StartServersOptions struct {
Proxy, API, Metrics bool
Proxy, API bool
}
func (cfg *Config) StartServers(opts ...*StartServersOptions) {
@@ -207,14 +206,6 @@ func (cfg *Config) StartServers(opts ...*StartServersOptions) {
Handler: api.NewHandler(cfg),
})
}
if opt.Metrics && common.PrometheusEnabled {
server.StartServer(cfg.task, server.Options{
Name: "metrics",
CertProvider: cfg.AutoCertProvider(),
HTTPAddr: common.MetricsHTTPAddr,
Handler: metrics.NewHandler(),
})
}
}
func (cfg *Config) load() E.Error {