Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
add the go routine for http server under allora node start
Browse files Browse the repository at this point in the history
  • Loading branch information
okedeji committed Jul 4, 2024
1 parent 3e35325 commit 035de6f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cmd/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {

Expand Down

0 comments on commit 035de6f

Please sign in to comment.