Use updated Prometheus handler.

This commit is contained in:
Robert Jacob 2018-10-27 17:07:08 +02:00
parent 69f1b5db51
commit af0f4f2b10

View file

@ -7,6 +7,7 @@ import (
netatmo "github.com/exzz/netatmo-api-go"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func main() {
@ -26,7 +27,7 @@ func main() {
}
prometheus.MustRegister(metrics)
http.Handle("/metrics", prometheus.UninstrumentedHandler())
http.Handle("/metrics", promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{}))
http.Handle("/", http.RedirectHandler("/metrics", http.StatusFound))
log.Printf("Listen on %s...", cfg.Addr)