You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/06/03 14:02:20 UTC

[GitHub] [pulsar] hangc0276 commented on a change in pull request #10803: use zookeeper prometheus metric provider to export zookeeper metrics

hangc0276 commented on a change in pull request #10803:
URL: https://github.com/apache/pulsar/pull/10803#discussion_r644820249



##########
File path: pulsar-zookeeper/src/main/java/org/apache/pulsar/zookeeper/ZooKeeperStarter.java
##########
@@ -18,49 +18,11 @@
  */
 package org.apache.pulsar.zookeeper;
 
-import java.net.InetSocketAddress;
-
 import org.apache.zookeeper.server.quorum.QuorumPeerMain;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import io.prometheus.client.exporter.MetricsServlet;
-import io.prometheus.client.hotspot.DefaultExports;
 
 public class ZooKeeperStarter {
     public static void main(String[] args) throws Exception {
-        start(args, "8000");
-    }
-
-    protected static void start(String[] args, String defaultStatsPort) throws Exception {
-        // Register basic JVM metrics
-        DefaultExports.initialize();
-
-        // Start Jetty to serve stats
-        int port = Integer.parseInt(System.getProperties().getProperty("stats_server_port", defaultStatsPort));
-
-        log.info("Starting ZK stats HTTP server at port {}", port);
-        InetSocketAddress httpEndpoint = InetSocketAddress.createUnresolved("0.0.0.0", port);
-
-        Server server = new Server(httpEndpoint);
-        ServletContextHandler context = new ServletContextHandler();
-        context.setContextPath("/");
-        server.setHandler(context);
-        context.addServlet(new ServletHolder(new MetricsServlet()), "/metrics");
-        try {
-            server.start();
-        } catch (Exception e) {
-            log.error("Failed to start HTTP server at port {}. Use \"-Dstats_server_port=1234\" to change port number",
-                    port, e);
-            throw e;
-        }
-
         // Start the regular ZooKeeper server
         QuorumPeerMain.main(args);

Review comment:
       OKļ¼Œjust call QuorumMain from CLI scripts is better, i update it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org