Commit ee5f69be by Carl Bergquist Committed by Torkel Ödegaard

metrics: disable gzip for /metrics endpoint (#9468)

Prometheus client lib support gzip by itself. Which caused the
response to be double gzipped sometimes. We should use the Grafana
middle ware instead.

closes #9464
parent 5895f9dc
...@@ -11,6 +11,8 @@ import ( ...@@ -11,6 +11,8 @@ import (
"path" "path"
"time" "time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
gocache "github.com/patrickmn/go-cache" gocache "github.com/patrickmn/go-cache"
...@@ -187,7 +189,9 @@ func (hs *HttpServer) metricsEndpoint(ctx *macaron.Context) { ...@@ -187,7 +189,9 @@ func (hs *HttpServer) metricsEndpoint(ctx *macaron.Context) {
return return
} }
promhttp.Handler().ServeHTTP(ctx.Resp, ctx.Req.Request) promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{
DisableCompression: true,
}).ServeHTTP(ctx.Resp, ctx.Req.Request)
} }
func (hs *HttpServer) healthHandler(ctx *macaron.Context) { func (hs *HttpServer) healthHandler(ctx *macaron.Context) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment