update /metrics handler to promhttp.Handler()

This commit is contained in:
utkarshmani1997 2017-09-14 17:09:52 +05:30
parent f870fc3254
commit 4c70969940

View File

@ -21,10 +21,10 @@ import (
"net/http" "net/http"
"sync" "sync"
"github.com/digitalocean/ceph_exporter/collectors"
"github.com/ceph/go-ceph/rados" "github.com/ceph/go-ceph/rados"
"github.com/digitalocean/ceph_exporter/collectors"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
) )
// CephExporter wraps all the ceph collectors and provides a single global // CephExporter wraps all the ceph collectors and provides a single global
@ -140,7 +140,7 @@ func main() {
prometheus.MustRegister(NewCephExporter(conn, "ceph")) prometheus.MustRegister(NewCephExporter(conn, "ceph"))
} }
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) {
w.Write([]byte(`<html> w.Write([]byte(`<html>
<head><title>Ceph Exporter</title></head> <head><title>Ceph Exporter</title></head>