prysm-pulse/shared/prometheus/simple_server.go
2019-06-12 19:58:49 -04:00

18 lines
385 B
Go

package prometheus
import (
"net/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
// RunSimpleServerOrDie is a blocking call to serve /metrics at the given
// address.
func RunSimpleServerOrDie(addr string) {
mux := http.NewServeMux()
mux.Handle("/metrics", promhttp.Handler())
svr := &http.Server{Addr: addr, Handler: mux}
log.Fatal(svr.ListenAndServe())
}