diff --git a/cmd/node/main.go b/cmd/node/main.go index ded30a2..1be542a 100644 --- a/cmd/node/main.go +++ b/cmd/node/main.go @@ -448,15 +448,6 @@ func run() int { } log = log.Level(level) - // Start HTTP server for Prometheus metrics. - http.Handle("/metrics", promhttp.Handler()) - go func() { - log.Info().Msg("Starting metrics server on :2112") - if err := http.ListenAndServe(":2112", nil); err != nil { - log.Error().Err(err).Str("level", cfg.Log.Level).Msg("could not start metric server") - } - }() - // Determine node role. role, err := parseNodeRole(cfg.Role) if err != nil { @@ -672,6 +663,17 @@ func run() int { log.Info().Msg("Allora Node stopped") }() + // Start HTTP server for Prometheus metrics. + http.Handle("/metrics", promhttp.Handler()) + go func() { + log.Info().Str("role", role.String()).Msg("Starting metrics server on :2112") + if err := http.ListenAndServe(":2112", nil); err != nil { + log.Error().Err(err).Msg("could not start metric server") + } + + log.Info().Msg("Allora Node stopped") + }() + // If we're a head node - start the REST API. if role == blockless.HeadNode {