GeorryHuang commented on a change in pull request #1292: HBASE-23994:Add WebUI 
to Canary
URL: https://github.com/apache/hbase/pull/1292#discussion_r399784604
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java
 ##########
 @@ -123,6 +127,31 @@
 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS)
 public class CanaryTool implements Tool, Canary {
 
+
+  private void putUpWebUI() throws IOException {
+    if (zookeeperMode) {
+      LOG.info("WebUI is not supported in Zookeeper mode");
+    } else if (regionServerMode) {
+      LOG.info("WebUI is not supported in RegionServer mode");
+    } else {
+      Configuration conf = new Configuration();
+      int port = conf.getInt(HConstants.HBASE_CANARY_INFO_PORT, 
DEFAULT_CANARY_INFOPORT);
+      // -1 is for disabling info server
+      if (port < 0) return;
+      String addr = conf.get(HBASE_CANARY_INFO_BINDADDRESS, "0.0.0.0");
+      try {
+        InfoServer infoServer = new InfoServer("canary", addr, port, false, 
conf);
+        infoServer.addUnprivilegedServlet("canary", "/canary-status", 
CanaryStatusServlet.class);
+        infoServer.setAttribute("sink", this.sink);
+        infoServer.start();
+        LOG.info("Bind Canary http info server to port: " + port);
+      } catch (BindException e) {
+        e.printStackTrace();
 
 Review comment:
   > Avoid using e.printStackTrace directly?
   
   yes, It's a mistake
   
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to