MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / startMetricsServer

Function startMetricsServer

cmd/main.go:87–101  ·  view source on GitHub ↗

startMetricsServer 启动 Prometheus 监控服务器

(addr string)

Source from the content-addressed store, hash-verified

85
86// startMetricsServer 启动 Prometheus 监控服务器
87func startMetricsServer(addr string) *http.Server {
88 mux := http.NewServeMux()
89 mux.Handle("/metrics", promhttp.Handler())
90
91 server := &http.Server{
92 Addr: addr,
93 Handler: mux,
94 }
95 go func() {
96 if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
97 zap.L().Fatal("Prometheus 启动失败", zap.Error(err))
98 }
99 }()
100 return server
101}

Callers 1

InitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected