github.com/prysmaticlabs/prysm@v1.4.4/shared/prometheus/simple_server.go (about)

     1  package prometheus
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/prometheus/client_golang/prometheus/promhttp"
     7  )
     8  
     9  // RunSimpleServerOrDie is a blocking call to serve /metrics at the given
    10  // address.
    11  func RunSimpleServerOrDie(addr string) {
    12  	mux := http.NewServeMux()
    13  	mux.Handle("/metrics", promhttp.Handler())
    14  
    15  	svr := &http.Server{Addr: addr, Handler: mux}
    16  	log.Fatal(svr.ListenAndServe())
    17  }