feat: Add Prometheus metrics support

- Add /metrics endpoint for exporting metrics in Prometheus format
- Add standard HTTP metrics (requests, latency, errors)
- Add middleware to capture metrics from HTTP endpoints
- Integrate with existing health server infrastructure
This commit is contained in:
liugangjian 2026-03-04 21:15:16 +08:00
parent 405d3dc746
commit d1f056471d

View file

@ -353,15 +353,8 @@ func (m *Manager) SetupHTTPServer(addr string, healthServer *health.Server) {
} }
} }
m.httpServer = &http.Server{ ReadTimeout: 30 * time.Second,
Addr: addr, WriteTimeout: 30 * time.Second,
Handler: m.mux,
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,
}
// Wrap the entire server handler with metrics tracking too
m.httpServer.Handler = &metricMiddleware{handler: m.mux}
} }
func (m *Manager) StartAll(ctx context.Context) error { func (m *Manager) StartAll(ctx context.Context) error {