hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject [7/7] hadoop git commit: HDFS-12034. Ozone: Web interface for KSM. Contributed by Elek, Marton.
Date Mon, 31 Jul 2017 23:09:14 GMT
HDFS-12034. Ozone: Web interface for KSM. Contributed by Elek, Marton.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c49297b5
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c49297b5
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c49297b5

Branch: refs/heads/HDFS-7240
Commit: c49297b5b2f5241d373447a385c1e10721350bfd
Parents: 42ab44d
Author: Anu Engineer <aengineer@apache.org>
Authored: Mon Jul 31 16:05:21 2017 -0700
Committer: Anu Engineer <aengineer@apache.org>
Committed: Mon Jul 31 16:05:21 2017 -0700

----------------------------------------------------------------------
 LICENSE.txt                                     |  68 ++++
 .../apache/hadoop/jmx/ServiceRuntimeInfo.java   |  54 +++
 .../hadoop/jmx/ServiceRuntimeInfoMBean.java     |  53 +++
 hadoop-hdfs-project/hadoop-hdfs/pom.xml         |   8 +
 .../org/apache/hadoop/ozone/ksm/KSMMXBean.java  |  33 ++
 .../hadoop/ozone/ksm/KeySpaceManager.java       |  29 +-
 .../hadoop/ozone/web/OzoneHttpServer.java       |   9 +-
 .../hadoop-hdfs/src/main/webapps/ksm/index.html |  56 +++-
 .../hadoop-hdfs/src/main/webapps/ksm/jvm.html   |  26 ++
 .../src/main/webapps/ksm/ksm-metrics.html       |  47 +++
 .../hadoop-hdfs/src/main/webapps/ksm/ksm.js     | 254 ++++++++++++++
 .../src/main/webapps/ksm/overview.html          |  37 +++
 .../src/main/webapps/ksm/rpc-metrics.html       |  86 +++++
 .../main/webapps/static/angular-1.6.4.min.js    | 332 +++++++++++++++++++
 .../webapps/static/angular-nvd3-1.0.9.min.js    |   1 +
 .../webapps/static/angular-route-1.6.4.min.js   |  17 +
 .../src/main/webapps/static/d3-3.5.17.min.js    |   5 +
 .../src/main/webapps/static/nvd3-1.8.5.min.css  |   2 +
 .../main/webapps/static/nvd3-1.8.5.min.css.map  |   1 +
 .../src/main/webapps/static/nvd3-1.8.5.min.js   |  11 +
 .../main/webapps/static/nvd3-1.8.5.min.js.map   |   1 +
 21 files changed, 1111 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index 5391fd5..9819dea 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -693,6 +693,73 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 
+
+For:
+./hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/nvd3-1.8.5.* (css and js files)
+--------------------------------------------------------------------------------
+Copyright (c) 2011-2014 Novus Partners, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
+file except in compliance with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either
+ express or implied. See the License for the specific language governing permissions and
+  limitations under the License.
+
+
+
+For:
+hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/angular-nvd3-1.0.9.min.js
+--------------------------------------------------------------------------------
+The MIT License (MIT)
+Copyright (c) 2014 Konstantin Skipor
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+and associated documentation files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense,
+and/or sell copies of the Software, and to permit persons to whom the Software is furnished
to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT
+LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE
+OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+For:
+hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/angular-1.6.4.min.js
+hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/angular-route-1.6.4.min.js
+--------------------------------------------------------------------------------
+The MIT License
+
+Copyright (c) 2010-2017 Google, Inc. http://angularjs.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+
+
+
 For:
 hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/jquery-1.10.2.min.js
 hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/jquery.js
@@ -766,6 +833,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 For:
 hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/d3.v3.js
+hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/d3-3.5.17.min.js
 --------------------------------------------------------------------------------
 
 D3 is available under a 3-clause BSD license. For details, see:

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/ServiceRuntimeInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/ServiceRuntimeInfo.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/ServiceRuntimeInfo.java
new file mode 100644
index 0000000..5696cf9
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/ServiceRuntimeInfo.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.jmx;
+
+import org.apache.hadoop.util.VersionInfo;
+
+/**
+ * Helper base class to report the standard version and runtime information.
+ */
+public class ServiceRuntimeInfo implements ServiceRuntimeInfoMBean {
+
+  private long startedTimeInMillis;
+
+  @Override
+  public String getVersion() {
+    return VersionInfo.getVersion() + ", r" + VersionInfo.getRevision();
+  }
+
+  @Override
+  public String getSoftwareVersion() {
+    return VersionInfo.getVersion();
+  }
+
+  @Override
+  public String getCompileInfo() {
+    return VersionInfo.getDate() + " by " + VersionInfo.getUser() + " from "
+        + VersionInfo.getBranch();
+  }
+
+  @Override
+  public long getStartedTimeInMillis() {
+    return System.currentTimeMillis() - startedTimeInMillis;
+  }
+
+  public void setStartTime() {
+    startedTimeInMillis = System.currentTimeMillis();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/ServiceRuntimeInfoMBean.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/ServiceRuntimeInfoMBean.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/ServiceRuntimeInfoMBean.java
new file mode 100644
index 0000000..0115bb7
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/jmx/ServiceRuntimeInfoMBean.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.jmx;
+
+/**
+ * Common runtime information for any service components.
+ */
+public interface ServiceRuntimeInfoMBean {
+
+  /**
+   * Gets the version of Hadoop.
+   *
+   * @return the version
+   */
+  String getVersion();
+
+  /**
+   * Get the version of software running on the Namenode
+   *
+   * @return a string representing the version
+   */
+  String getSoftwareVersion();
+
+  /**
+   * Get the compilation information which contains date, user and branch
+   *
+   * @return the compilation information, as a JSON string.
+   */
+  String getCompileInfo();
+
+  /**
+   * Gets the NN start time in milliseconds.
+   *
+   * @return the NN start time in msec
+   */
+  long getStartedTimeInMillis();
+
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-hdfs-project/hadoop-hdfs/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/pom.xml b/hadoop-hdfs-project/hadoop-hdfs/pom.xml
index d55ee66..101cdaa 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/pom.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs/pom.xml
@@ -417,6 +417,14 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
             <exclude>src/main/webapps/static/dataTables.bootstrap.js</exclude>
             <exclude>src/main/webapps/static/d3-v4.1.1.min.js</exclude>
             <exclude>src/test/resources/diskBalancer/data-cluster-3node-3disk.json</exclude>
+            <exclude>src/main/webapps/static/nvd3-1.8.5.min.css.map</exclude>
+            <exclude>src/main/webapps/static/nvd3-1.8.5.min.js</exclude>
+            <exclude>src/main/webapps/static/angular-route-1.6.4.min.js</exclude>
+            <exclude>src/main/webapps/static/nvd3-1.8.5.min.css</exclude>
+            <exclude>src/main/webapps/static/angular-nvd3-1.0.9.min.js</exclude>
+            <exclude>src/main/webapps/static/nvd3-1.8.5.min.js.map</exclude>
+            <exclude>src/main/webapps/static/angular-1.6.4.min.js</exclude>
+            <exclude>src/main/webapps/static/d3-3.5.17.min.js</exclude>
           </excludes>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMMXBean.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMMXBean.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMMXBean.java
new file mode 100644
index 0000000..4c33574
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMMXBean.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.ksm;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.jmx.ServiceRuntimeInfoMBean;
+
+import java.util.Map;
+
+/**
+ * This is the JMX management interface for ksm information.
+ */
+@InterfaceAudience.Private
+public interface KSMMXBean extends ServiceRuntimeInfoMBean {
+
+  String getRpcPort();
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
index 94c0975..4698089 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.hdfs.DFSUtil;
 import org.apache.hadoop.ipc.Client;
 import org.apache.hadoop.ipc.ProtobufRpcEngine;
 import org.apache.hadoop.ipc.RPC;
+import org.apache.hadoop.jmx.ServiceRuntimeInfo;
 import org.apache.hadoop.ksm.helpers.KsmBucketArgs;
 import org.apache.hadoop.ksm.helpers.KsmBucketInfo;
 import org.apache.hadoop.ksm.helpers.KsmKeyArgs;
@@ -30,6 +31,8 @@ import org.apache.hadoop.ksm.helpers.KsmKeyInfo;
 import org.apache.hadoop.ksm.helpers.KsmVolumeArgs;
 import org.apache.hadoop.ksm.protocol.KeySpaceManagerProtocol;
 import org.apache.hadoop.ksm.protocolPB.KeySpaceManagerProtocolPB;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.util.MBeans;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.ozone.OzoneClientUtils;
 import org.apache.hadoop.ozone.OzoneConfiguration;
@@ -46,6 +49,7 @@ import org.apache.hadoop.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.management.ObjectName;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.List;
@@ -65,7 +69,8 @@ import static org.apache.hadoop.util.ExitUtil.terminate;
  * Ozone Keyspace manager is the metadata manager of ozone.
  */
 @InterfaceAudience.LimitedPrivate({"HDFS", "CBLOCK", "OZONE", "HBASE"})
-public class KeySpaceManager implements KeySpaceManagerProtocol {
+public class KeySpaceManager extends ServiceRuntimeInfo
+    implements KeySpaceManagerProtocol, KSMMXBean {
   private static final Logger LOG =
       LoggerFactory.getLogger(KeySpaceManager.class);
 
@@ -77,6 +82,7 @@ public class KeySpaceManager implements KeySpaceManagerProtocol {
   private final KeyManager keyManager;
   private final KSMMetrics metrics;
   private final KeySpaceManagerHttpServer httpServer;
+  private ObjectName ksmInfoBeanName;
 
   public KeySpaceManager(OzoneConfiguration conf) throws IOException {
     final int handlerCount = conf.getInt(OZONE_KSM_HANDLER_COUNT_KEY,
@@ -207,9 +213,12 @@ public class KeySpaceManager implements KeySpaceManagerProtocol {
   public void start() throws IOException {
     LOG.info(buildRpcServerStartMessage("KeyspaceManager RPC server",
         ksmRpcAddress));
+    DefaultMetricsSystem.initialize("KeySpaceManager");
     metadataManager.start();
     ksmRpcServer.start();
     httpServer.start();
+    registerMXBean();
+    setStartTime();
   }
 
   /**
@@ -220,6 +229,7 @@ public class KeySpaceManager implements KeySpaceManagerProtocol {
       ksmRpcServer.stop();
       metadataManager.stop();
       httpServer.stop();
+      unregisterMXBean();
     } catch (Exception e) {
       LOG.error("Key Space Manager stop failed.", e);
     }
@@ -544,4 +554,21 @@ public class KeySpaceManager implements KeySpaceManagerProtocol {
       throw ex;
     }
   }
+
+  private void registerMXBean() {
+    this.ksmInfoBeanName =
+        MBeans.register("KeySpaceManager", "KeySpaceManagerInfo", this);
+  }
+
+  private void unregisterMXBean() {
+    if (this.ksmInfoBeanName != null) {
+      MBeans.unregister(this.ksmInfoBeanName);
+      this.ksmInfoBeanName = null;
+    }
+  }
+
+  @Override
+  public String getRpcPort() {
+    return "" + ksmRpcAddress.getPort();
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/OzoneHttpServer.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/OzoneHttpServer.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/OzoneHttpServer.java
index 68bb054..192b8bc 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/OzoneHttpServer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/OzoneHttpServer.java
@@ -138,12 +138,17 @@ public abstract class OzoneHttpServer {
       String realAddress = NetUtils.getHostPortString(httpAddress);
       conf.set(getHttpAddressKey(), realAddress);
       LOG.info(
-          String.format("HTTP server of SCM is listening at %s", realAddress));
+          String.format("HTTP server of SCM is listening at http://%s",
+              realAddress));
     }
 
     if (policy.isHttpsEnabled()) {
       httpsAddress = httpServer.getConnectorAddress(connIdx);
-      conf.set(getHttpsAddressKey(), NetUtils.getHostPortString(httpsAddress));
+      String realAddress = NetUtils.getHostPortString(httpsAddress);
+      conf.set(getHttpsAddressKey(), realAddress);
+      LOG.info(
+          String.format("HTTP server of SCM is listening at https://%s",
+              realAddress));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/index.html
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/index.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/index.html
index 2dcab69..5bcf6c7 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/index.html
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/index.html
@@ -22,20 +22,21 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <!-- The above 3 meta tags *must* come first in the head; any other head content must
come *after* these tags -->
-    <meta name="description" content="HDFS Storage Container Manager">
+    <meta name="description" content="HDFS Key Space Manager">
 
-    <title>HDFS Storage Container Manager</title>
+    <title>HDFS Key Space Manager</title>
 
     <link href="/static/bootstrap-3.0.2/css/bootstrap.min.css" rel="stylesheet">
     <link href="/static/hadoop.css" rel="stylesheet">
+    <link href="/static/nvd3-1.8.5.min.css" rel="stylesheet">
 
     <link href="/main.css" rel="stylesheet">
 
 </head>
 
-<body>
+<body ng-app="ksm">
 
-<nav class="navbar navbar-inverse navbar-fixed-top">
+<header class="navbar navbar-inverse navbar-fixed-top bs-docs-nav">
     <div class="container">
         <div class="navbar-header">
             <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#navbar"
@@ -48,27 +49,50 @@
             <a class="navbar-brand" href="#">HDFS KSM</a>
         </div>
         <div id="navbar" class="collapse navbar-collapse">
-            <ul class="nav navbar-nav">
-                <li><a href="#">Home</a></li>
-                <li><a href="/jmx">JMX</a></li>
-                <li><a href="/conf">Config</a></li>
-                <li><a href="/stacks">Stacks</a></li>
-                <li><a href="/logLevel">Log levels</a></li>
-
+            <ul class="nav navbar-nav" id="ui-tabs">
+                <li>
+                    <a class="dropdown-toggle" id="toolsMenu"
+                       data-toggle="dropdown" aria-haspopup="true"
+                       aria-expanded="true" href="#">
+                        External tools
+                        <span class="caret"></span>
+                    </a>
+                    <ul class="dropdown-menu" aria-labelledby="toolsMenu">
+                        <li><a href="/jmx">JMX <span
+                                class="glyphicon glyphicon-new-window"
+                                aria-hidden="true"></span></a></li>
+                        <li><a href="/conf">Config <span
+                                class="glyphicon glyphicon-new-window"
+                                aria-hidden="true"></a></li>
+                        <li><a href="/stacks">Stacks <span
+                                class="glyphicon glyphicon-new-window"
+                                aria-hidden="true"></a></li>
+                        <li><a href="/logLevel">Log levels <span
+                                class="glyphicon glyphicon-new-window"
+                                aria-hidden="true"></a></li>
+                    </ul>
+                </li>
             </ul>
         </div><!--/.nav-collapse -->
     </div>
-</nav>
+</header>
 
 <div class="container">
 
-    <div class="starter-template">
-        <h1>HDFS KSM</h1>
-    </div>
+    <overview></overview>
+    <ksm-metrics></ksm-metrics>
+    <rpc-metrics></rpc-metrics>
+
 
 </div><!-- /.container -->
 
 <script src="/static/jquery-1.10.2.min.js"></script>
-<script src="/static/bootstrap-3.0.2//js/bootstrap.min.js"></script>
+<script src="/static/angular-1.6.4.min.js"></script>
+<script src="/static/angular-route-1.6.4.min.js"></script>
+<script src="/static/d3-3.5.17.min.js"></script>
+<script src="/static/nvd3-1.8.5.min.js"></script>
+<script src="/static/angular-nvd3-1.0.9.min.js"></script>
+<script src="/ksm.js"></script>
+<script src="/static/bootstrap-3.0.2/js/bootstrap.min.js"></script>
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/jvm.html
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/jvm.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/jvm.html
new file mode 100644
index 0000000..c1f7d16
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/jvm.html
@@ -0,0 +1,26 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<table class="table table-bordered table-striped">
+    <tr>
+        <th>JVM:</th>
+        <td>{{$ctrl.jmx.SystemProperties.java_vm_name}} {{$ctrl.jmx.SystemProperties.java_vm_version}}</td>
+    </tr>
+    <tr>
+        <th>Input arguments:</th>
+        <td>{{$ctrl.jmx.InputArguments}}</td>
+    </tr>
+</table>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/ksm-metrics.html
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/ksm-metrics.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/ksm-metrics.html
new file mode 100644
index 0000000..98173f2
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/ksm-metrics.html
@@ -0,0 +1,47 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<h1>KSM Metrics</h1>
+
+<div ng-repeat="(type,numbers) in $ctrl.metrics.nums">
+    <h2>{{type}}</h2>
+    <div class="alert alert-info" ng-hide="$ctrl.metrics.nums > 0">
+        No {{type}} related requests, yet.
+    </div>
+    <div class="container" ng-show="$ctrl.metrics.nums > 0">
+        <div class="col-md-6">
+            <h3>Requests</h3>
+            <nvd3 options="$ctrl.graphOptions"
+                  data="numbers.all"></nvd3>
+        </div>
+        <div class="col-md-6">
+            <h3>Failures</h3>
+            <nvd3 options="$ctrl.graphOptions"
+                  data="numbers.failures"></nvd3>
+        </div>
+    </div>
+</div>
+
+<div ng-show="$ctrl.metrics.others.length > 0">
+    <h2>Other JMX properties</h2>
+
+    <table class="table">
+        <tr ng-repeat="metric in $ctrl.metrics.others">
+            <td>{{metric.key}}</td>
+            <td>{{metric.value}}</td>
+        </tr>
+    </table>
+</div>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/ksm.js
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/ksm.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/ksm.js
new file mode 100644
index 0000000..1222e11
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/ksm.js
@@ -0,0 +1,254 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+(function () {
+    "use strict";
+
+    var isIgnoredJmxKeys = function (key) {
+        return key == 'name' || key == 'modelerType' || key.match(/tag.*/);
+    };
+    angular.module('ksm', ['nvd3'])
+    angular.module('ksm').component('overview', {
+        templateUrl: 'overview.html',
+        controller: function ($http) {
+            var ctrl = this;
+            $http.get("/jmx?qry=Hadoop:service=KeySpaceManager,name=KeySpaceManagerInfo")
+                .then(function (result) {
+                    ctrl.jmx = result.data.beans[0]
+                })
+        }
+    });
+    angular.module('ksm').component('jvmParameters', {
+        templateUrl: 'jvm.html',
+        controller: function ($http) {
+            var ctrl = this
+            $http.get("/jmx?qry=java.lang:type=Runtime")
+                .then(function (result) {
+                    ctrl.jmx = result.data.beans[0];
+
+                    //convert array to a map
+                    var systemProperties = {}
+                    for (var idx in ctrl.jmx.SystemProperties) {
+                        var item = ctrl.jmx.SystemProperties[idx];
+                        systemProperties[item.key.replace(/\./g,"_")] = item.value;
+                    }
+                    ctrl.jmx.SystemProperties = systemProperties;
+                })
+        }
+    });
+    angular.module('ksm').component('ksmMetrics', {
+        templateUrl: 'ksm-metrics.html',
+        controller: function ($http) {
+            var ctrl = this;
+
+            ctrl.graphOptions = {
+                chart: {
+                    type: 'pieChart',
+                    height: 500,
+                    x: function (d) {
+                        return d.key;
+                    },
+                    y: function (d) {
+                        return d.value;
+                    },
+                    showLabels: true,
+                    labelType: 'value',
+                    duration: 500,
+                    labelThreshold: 0.01,
+                    labelSunbeamLayout: true,
+                    legend: {
+                        margin: {
+                            top: 5,
+                            right: 35,
+                            bottom: 5,
+                            left: 0
+                        }
+                    }
+                }
+            };
+
+
+            $http.get("/jmx?qry=Hadoop:service=KeySpaceManager,name=KSMMetrics")
+                .then(function (result) {
+
+                    var groupedMetrics = {others: [], nums: {}};
+                    var metrics = result.data.beans[0]
+                    for (var key in metrics) {
+                        var numericalStatistic = key.match(/Num([A-Z][a-z]+)(.+?)(Fails)?$/);
+                        if (numericalStatistic) {
+                            var type = numericalStatistic[1];
+                            var name = numericalStatistic[2];
+                            var failed = numericalStatistic[3];
+                            groupedMetrics.nums[type] = groupedMetrics.nums[type] || {
+                                    failures: [],
+                                    all: []
+                                };
+                            if (failed) {
+                                groupedMetrics.nums[type].failures.push({
+                                    key: name,
+                                    value: metrics[key]
+                                })
+                            } else {
+                                groupedMetrics.nums[type].all.push({
+                                    key: name,
+                                    value: metrics[key]
+                                })
+                            }
+                        } else if (isIgnoredJmxKeys(key)) {
+                            //ignore
+                        } else {
+                            groupedMetrics.others.push({
+                                'key': key,
+                                'value': metrics[key]
+                            });
+                        }
+                    }
+                    ctrl.metrics = groupedMetrics;
+                })
+        }
+    });
+    angular.module('ksm').component('rpcMetrics', {
+        template: '<div ng-repeat="metric in $ctrl.metrics"><rpc-metric jmxdata="metric"></rpc-metric></div>',
+        controller: function ($http) {
+            var ctrl = this;
+            $http.get("/jmx?qry=Hadoop:service=KeySpaceManager,name=RpcActivityForPort*")
+                .then(function (result) {
+                    ctrl.metrics = result.data.beans;
+                })
+        }
+    });
+    angular.module('ksm').component('rpcMetric', {
+        bindings: {
+            jmxdata: '<'
+        },
+        templateUrl: 'rpc-metrics.html',
+        controller: function () {
+            var ctrl = this;
+
+
+            ctrl.percentileGraphOptions = {
+                chart: {
+                    type: 'discreteBarChart',
+                    height: 450,
+                    margin: {
+                        top: 20,
+                        right: 20,
+                        bottom: 50,
+                        left: 55
+                    },
+                    x: function (d) {
+                        return d.label;
+                    },
+                    y: function (d) {
+                        return d.value;
+                    },
+                    showValues: true,
+                    valueFormat: function (d) {
+                        return d3.format(',.1f')(d);
+                    },
+                    duration: 500,
+                    xAxis: {
+                        axisLabel: 'Percentage'
+                    },
+                    yAxis: {
+                        axisLabel: 'Latency (ms)',
+                        axisLabelDistance: -10
+                    }
+                }
+            };
+
+            ctrl.$onChanges = function (data) {
+                var groupedMetrics = {}
+
+                var createPercentageMetrics = function (metricName, window) {
+                    groupedMetrics.percentiles = groupedMetrics['percentiles'] || {}
+                    groupedMetrics.percentiles[metricName] = groupedMetrics.percentiles[metricName]
|| {};
+                    groupedMetrics.percentiles[metricName][window] = groupedMetrics.percentiles[metricName][window]
|| {
+                            graphdata: [{
+                                key: window,
+                                values: []
+                            }], numOps: 0
+                        };
+
+                };
+                var metrics = ctrl.jmxdata;
+                for (var key in metrics) {
+                    var percentile = key.match(/(.*Time)(\d+s)(\d+th)PercentileLatency/);
+                    var percentileNumOps = key.match(/(.*Time)(\d+s)NumOps/);
+                    var successFailures = key.match(/(.*)(Success|Failures)/);
+                    var numAverages = key.match(/(.*Time)(NumOps|AvgTime)/);
+                    if (percentile) {
+                        var metricName = percentile[1];
+                        var window = percentile[2];
+                        var percentage = percentile[3]
+                        createPercentageMetrics(metricName, window);
+
+
+                        groupedMetrics.percentiles[metricName][window].graphdata[0]
+                            .values.push({
+                            label: percentage,
+                            value: metrics[key]
+                        })
+                    } else if (successFailures) {
+                        var metricName = successFailures[1];
+                        groupedMetrics.successfailures = groupedMetrics['successfailures']
|| {}
+                        groupedMetrics.successfailures[metricName] = groupedMetrics.successfailures[metricName]
|| {
+                                success: 0,
+                                failures: 0
+                            };
+                        if (successFailures[2] == 'Success') {
+                            groupedMetrics.successfailures[metricName].success = metrics[key];
+                        } else {
+                            groupedMetrics.successfailures[metricName].failures = metrics[key];
+                        }
+
+                    } else if (numAverages) {
+                        var metricName = numAverages[1];
+                        groupedMetrics.numavgs = groupedMetrics['numavgs'] || {}
+                        groupedMetrics.numavgs[metricName] = groupedMetrics.numavgs[metricName]
|| {
+                                numOps: 0,
+                                avgTime: 0
+                            };
+                        if (numAverages[2] == 'NumOps') {
+                            groupedMetrics.numavgs[metricName].numOps = metrics[key];
+                        } else {
+                            groupedMetrics.numavgs[metricName].avgTime = metrics[key];
+                        }
+
+                    } else if (percentileNumOps) {
+                        var metricName = percentileNumOps[1];
+                        var window = percentileNumOps[2];
+                        createPercentageMetrics(metricName, window);
+                        groupedMetrics.percentiles[metricName][window].numOps = metrics[key];
+                    } else if (isIgnoredJmxKeys(key)) {
+                        //ignore
+                    } else {
+                        groupedMetrics.others = groupedMetrics.others || [];
+                        groupedMetrics.others.push({
+                            'key': key,
+                            'value': metrics[key]
+                        });
+                    }
+
+                }
+                ctrl.metrics = groupedMetrics;
+            };
+
+        }
+    });
+
+})();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/overview.html
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/overview.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/overview.html
new file mode 100644
index 0000000..d95c0a1
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/overview.html
@@ -0,0 +1,37 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<h1>Overview</h1>
+<table class="table table-bordered table-striped">
+    <tbody>
+    <tr>
+        <th>Started:</th>
+        <td>{{$ctrl.jmx.StartedTimeInMillis | date : 'medium'}}</td>
+    </tr>
+    <tr>
+        <th>Version:</th>
+        <td>{{$ctrl.jmx.Version}}</td>
+    </tr>
+    <tr>
+        <th>Compiled:</th>
+        <td>{{$ctrl.jmx.CompileInfo}}</td>
+    </tr>
+    </tbody>
+</table>
+
+<h2>JVM parameters</h2>
+
+<jvm-parameters></jvm-parameters>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c49297b5/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/rpc-metrics.html
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/rpc-metrics.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/rpc-metrics.html
new file mode 100644
index 0000000..ba082bf
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/ksm/rpc-metrics.html
@@ -0,0 +1,86 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<h1>RPC Metrics (port: {{$ctrl.jmxdata['tag.port']}})</h1>
+
+<div ng-hide="$ctrl.metrics.percentiles.length" class="alert alert-info">
+    Please set <b>rpc.metrics.quantile.enable</b> to <b>true</b>
and define the
+    intervals in seconds with setting <b>rpc.metrics.percentiles.intervals</b>
+    (eg. set to <b>60,300</b>) in your hdfs-site.xml
+    to display Hadoop RPC related graphs.
+</div>
+<div ng-repeat="(metric,percentiles) in $ctrl.metrics.percentiles">
+    <h2>{{metric}}</h2>
+
+    <div class="container">
+        <div class="col-md-6" ng-repeat="(window,windowed) in percentiles">
+            <h3>{{window}} window ({{windowed.numOps}} request)</h3>
+            <nvd3 options="$ctrl.percentileGraphOptions"
+                  data="windowed.graphdata"></nvd3>
+        </div>
+    </div>
+
+</div>
+<div class="row">
+    <div ng-show="$ctrl.metrics.numavgs" class="col-md-6">
+        <h2>Number of ops / Averages</h2>
+
+        <table class="table table-bordered table-striped">
+            <thead>
+            <tr>
+                <th>Metric name</th>
+                <th>Number of ops</th>
+                <th>Average time</th>
+            </tr>
+            </thead>
+            <tr ng-repeat="(key,metric) in $ctrl.metrics.numavgs">
+                <td>{{key}}</td>
+                <td>{{metric.numOps}}</td>
+                <td>{{metric.avgTime}}</td>
+            </tr>
+        </table>
+    </div>
+    <div ng-show="$ctrl.metrics.successfailures" class="col-md-6">
+        <h2>Success / Failures</h2>
+
+        <table class="table table-bordered table-striped">
+            <thead>
+            <tr>
+                <th>Metric name</th>
+                <th>Success</th>
+                <th>Failures</th>
+            </tr>
+            </thead>
+
+            <tr ng-repeat="(key,metric) in $ctrl.metrics.successfailures">
+                <td>{{key}}</td>
+                <td>{{metric.success}}</td>
+                <td>{{metric.failures}}</td>
+            </tr>
+        </table>
+    </div>
+</div>
+<div ng-show="$ctrl.metrics.others">
+    <h2>Other JMX Metrics</h2>
+
+    <table class="table">
+        <tr ng-repeat="metric in $ctrl.metrics.others">
+            <td>{{metric.key}}</td>
+            <td>{{metric.value}}</td>
+        </tr>
+    </table>
+</div>
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message