jonnenauha / prometheus_varnish_exporter

Varnish exporter for Prometheus
MIT License
177 stars 101 forks source link

incompatible with prometheus/client_golang:master #45

Closed filex closed 5 years ago

filex commented 5 years ago

today, go build does not work anymore :(

$ (master) go build
# github.com/jonnenauha/prometheus_varnish_exporter
./main.go:179:33: undefined: prometheus.Handler

There is a recent change in the prometheus/client_golang repo prometheus/client_golang/pull/600 that seems to break the varnish exporter build.

The change in that PR suggest that the Handler now lives in promhttp:

diff --git a/main.go b/main.go
index 7c55c21..72abfd2 100644
--- a/main.go
+++ b/main.go
@@ -176,7 +176,7 @@ func main() {
                http.Handle(StartParams.Path, handler)
        } else {
                prometheus.MustRegister(PrometheusExporter)
-               http.Handle(StartParams.Path, prometheus.Handler())
+               http.Handle(StartParams.Path, promhttp.Handler())
        }

        if StartParams.Path != "/" {
tomaaron commented 5 years ago

Your fix works very well. I would appreciate the merge of the related PR!

filex commented 5 years ago

Fixed in #46