From 21f9ad83368e01383b207b9fe490441f44628767 Mon Sep 17 00:00:00 2001 From: shashank734 Date: Sat, 29 Jun 2019 12:51:49 +0530 Subject: [PATCH] Updated deprecated prometheus.Handler to promhttp.Handler prometheus.Handler is deprecated and giving an error in new versions "undefined: prometheus.Handler" Updated this with new promhttp.Handler Reference : https://prometheus.io/docs/guides/go-application/ --- namenode_exporter.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/namenode_exporter.go b/namenode_exporter.go index 97114f2..6d84dc0 100644 --- a/namenode_exporter.go +++ b/namenode_exporter.go @@ -7,6 +7,7 @@ import ( "net/http" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/log" ) @@ -309,7 +310,7 @@ func main() { prometheus.MustRegister(exporter) log.Printf("Starting Server: %s", *listenAddress) - http.Handle(*metricsPath, prometheus.Handler()) + http.Handle(*metricsPath, promhttp.Handler()) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(` NameNode Exporter