mirror of
https://github.com/woodchen-ink/proxy-go.git
synced 2025-07-18 08:31:55 +08:00
feat(main): add metrics routes for enhanced monitoring and remove duplicate route definitions
This commit is contained in:
parent
8770d79bb8
commit
e9e932b0b7
12
main.go
12
main.go
@ -30,6 +30,12 @@ func main() {
|
||||
mirrorHandler := handler.NewMirrorProxyHandler()
|
||||
proxyHandler := handler.NewProxyHandler(cfg)
|
||||
|
||||
// 添加监控路由
|
||||
http.HandleFunc("/metrics", proxyHandler.AuthMiddleware(proxyHandler.MetricsHandler))
|
||||
http.HandleFunc("/metrics/ui", proxyHandler.MetricsPageHandler)
|
||||
http.HandleFunc("/metrics/auth", proxyHandler.MetricsAuthHandler)
|
||||
http.HandleFunc("/metrics/dashboard", proxyHandler.MetricsDashboardHandler)
|
||||
|
||||
// 创建处理器链
|
||||
handlers := []struct {
|
||||
matcher func(*http.Request) bool
|
||||
@ -80,12 +86,6 @@ func main() {
|
||||
handler = middleware.CompressionMiddleware(compManager)(handler)
|
||||
}
|
||||
|
||||
// 添加监控路由
|
||||
http.HandleFunc("/metrics", proxyHandler.AuthMiddleware(proxyHandler.MetricsHandler))
|
||||
http.HandleFunc("/metrics/ui", proxyHandler.MetricsPageHandler)
|
||||
http.HandleFunc("/metrics/auth", proxyHandler.MetricsAuthHandler)
|
||||
http.HandleFunc("/metrics/dashboard", proxyHandler.MetricsDashboardHandler)
|
||||
|
||||
// 创建服务器
|
||||
server := &http.Server{
|
||||
Addr: ":80",
|
||||
|
Loading…
x
Reference in New Issue
Block a user