Преглед на файлове

prometheus: enable gzip for /metrics endpoint

closes #9464
bergquist преди 8 години
родител
ревизия
139f077453
променени са 2 файла, в които са добавени 6 реда и са изтрити 3 реда
  1. 2 3
      pkg/api/http_server.go
  2. 4 0
      pkg/middleware/util.go

+ 2 - 3
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) {

+ 4 - 0
pkg/middleware/util.go

@@ -21,6 +21,10 @@ func Gziper() macaron.Handler {
 			return
 		}
 
+		if strings.HasPrefix(requestPath, "/metrics") {
+			return
+		}
+
 		ctx.Invoke(macaronGziper)
 	}
 }