replace prometheus.Handler with promhttp.Handler

This commit is contained in:
Azanx 2019-06-20 16:45:51 +02:00
parent af6943b1bc
commit 689aedff1c

View File

@ -31,6 +31,7 @@ import (
"github.com/hpcloud/tail" "github.com/hpcloud/tail"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
) )
var ( var (
@ -691,7 +692,7 @@ func main() {
} }
prometheus.MustRegister(exporter) prometheus.MustRegister(exporter)
http.Handle(*metricsPath, prometheus.Handler()) http.Handle(*metricsPath, promhttp.Handler())
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
_, err = w.Write([]byte(` _, err = w.Write([]byte(`
<html> <html>