mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-23 08:36:41 +00:00
fix(metrics): properly surface errors with the metrics server
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
@@ -21,10 +21,16 @@ type Server struct {
|
|||||||
Log *slog.Logger
|
Log *slog.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) Run(ctx context.Context, done func()) error {
|
func (s *Server) Run(ctx context.Context, done func()) {
|
||||||
defer done()
|
defer done()
|
||||||
lg := s.Log.With("subsystem", "metrics")
|
lg := s.Log.With("subsystem", "metrics")
|
||||||
|
|
||||||
|
if err := s.run(ctx, lg); err != nil {
|
||||||
|
lg.Error("can't serve metrics server", "err", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) run(ctx context.Context, lg *slog.Logger) error {
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.HandleFunc("GET /debug/pprof/", pprof.Index)
|
mux.HandleFunc("GET /debug/pprof/", pprof.Index)
|
||||||
mux.HandleFunc("GET /debug/pprof/cmdline", pprof.Cmdline)
|
mux.HandleFunc("GET /debug/pprof/cmdline", pprof.Cmdline)
|
||||||
|
|||||||
Reference in New Issue
Block a user