package io.vertx.ext.prometheus.server;

import io.prometheus.client.CollectorRegistry;
import io.vertx.core.Closeable;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpServer;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.core.net.SocketAddress;
import io.vertx.ext.web.Router;
import org.jetbrains.annotations.NotNull;

import java.util.function.Function;

public enum MetricsServer {
  ;
  private static final @NotNull Logger log = LoggerFactory.getLogger(MetricsServer.class);

  public static @NotNull Function<CollectorRegistry, Function<SocketAddress, Closeable>> create(@NotNull Vertx vertx) {
    final HttpServer server = vertx.createHttpServer();
    final Router router = Router.router(vertx);
    return registry -> {
      router.route("/metrics").handler(new MetricsHandler(registry));
      return address -> {
        server.requestHandler(router::accept).listen(address.port(), address.host());
        log.info("Prometheus metrics server started at " + address);
        return server::close;
      };
    };
  }
}

@@ -175,24 +175,69 @@
 HttpServer;%0A
+import io.vertx.core.http.HttpServerOptions;%0A
 import io.ve
@@ -701,16 +701,132 @@
 ertx) %7B%0A
+    final HttpServerOptions options = new HttpServerOptions().setCompressionSupported(true).setCompressionLevel(6);%0A
     fina
@@ -870,16 +870,23 @@
 pServer(
+options
 );%0A    f

compress exposed metrics #13 (cherry picked from commit 1f89830)