diff --git a/pkg/api/http_server.go b/pkg/api/http_server.go index 3107dcf7e4b..037d2ae98e5 100644 --- a/pkg/api/http_server.go +++ b/pkg/api/http_server.go @@ -188,9 +188,8 @@ func (hs *HttpServer) metricsEndpoint(ctx *macaron.Context) { return } - promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{ - DisableCompression: true, - }).ServeHTTP(ctx.Resp, ctx.Req.Request) + promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{}). + ServeHTTP(ctx.Resp, ctx.Req.Request) } func (hs *HttpServer) healthHandler(ctx *macaron.Context) { diff --git a/pkg/middleware/util.go b/pkg/middleware/util.go index c392f215450..22d1b56869e 100644 --- a/pkg/middleware/util.go +++ b/pkg/middleware/util.go @@ -21,6 +21,10 @@ func Gziper() macaron.Handler { return } + if strings.HasPrefix(requestPath, "/metrics") { + return + } + ctx.Invoke(macaronGziper) } }