hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject [3/3] hadoop git commit: HDFS-10534. NameNode WebUI should display DataNode usage histogram. Contributed by Kai Sasaki.
Date Thu, 26 Jan 2017 18:34:14 GMT
HDFS-10534. NameNode WebUI should display DataNode usage histogram. Contributed by Kai Sasaki.


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

Branch: refs/heads/branch-2.7
Commit: 03a67e1e62b7def2bfc3d680db0c1a87882c2411
Parents: ab62484
Author: Zhe Zhang <zhz@apache.org>
Authored: Thu Jan 26 10:34:00 2017 -0800
Committer: Zhe Zhang <zhz@apache.org>
Committed: Thu Jan 26 10:34:00 2017 -0800

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt     |  3 +
 hadoop-hdfs-project/hadoop-hdfs/pom.xml         |  1 +
 .../src/main/webapps/hdfs/dfshealth.html        |  3 +
 .../src/main/webapps/hdfs/dfshealth.js          | 59 ++++++++++++++++++++
 .../src/main/webapps/static/d3-v4.1.1.min.js    |  8 +++
 .../src/main/webapps/static/hadoop.css          |  9 +++
 .../mapreduce/MiniHadoopClusterManager.java     |  2 +-
 7 files changed, 84 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/03a67e1e/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 9455f7b..de05e63 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -67,6 +67,9 @@ Release 2.7.4 - UNRELEASED
     HDFS-10966. Enhance Dispatcher logic on deciding when to give up a source
     DataNode (Mark Wagner and zhz via kihwal)
 
+    HDFS-10534. NameNode WebUI should display DataNode usage histogram.
+    (Kai Sasaki via zhz)
+
   OPTIMIZATIONS
 
     HDFS-10896. Move lock logging logic from FSNamesystem into FSNamesystemLock.

http://git-wip-us.apache.org/repos/asf/hadoop/blob/03a67e1e/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 4df5d80..0d5e1df 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/pom.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs/pom.xml
@@ -393,6 +393,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
             <exclude>src/main/webapps/static/dust-full-2.0.0.min.js</exclude>
             <exclude>src/main/webapps/static/dust-helpers-1.1.1.min.js</exclude>
             <exclude>src/main/webapps/static/jquery-1.10.2.min.js</exclude>
+            <exclude>src/main/webapps/static/d3-v4.1.1.min.js</exclude>
           </excludes>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/03a67e1e/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html
index 30fe1c7..20251fc 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html
@@ -255,6 +255,8 @@
 
 <script type="text/x-dust-template" id="tmpl-datanode">
 <div class="page-header"><h1>Datanode Information</h1></div>
+<div class="page-header"><h1><small>Datanode usage histogram</small></h1></div>
+<small><div id="datanode-usage-histogram"></div></small>
 <div class="page-header"><h1><small>In operation</small></h1></div>
 <small>
 <table class="table">
@@ -396,6 +398,7 @@ There are no reported volume failures.
 </script><script type="text/javascript" src="/static/dust-full-2.0.0.min.js">
 </script><script type="text/javascript" src="/static/dust-helpers-1.1.1.min.js">
 </script><script type="text/javascript" src="/static/dfs-dust.js">
+</script><script type="text/javascript" src="/static/d3-v4.1.1.min.js">
 </script><script type="text/javascript" src="dfshealth.js">
 </script>
 </body>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/03a67e1e/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js
index a045e42..ce51618 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js
@@ -191,9 +191,68 @@
           $('#tab-datanode').html(out);
           $('#ui-tabs a[href="#tab-datanode"]').tab('show');
         });
+        renderHistogram(data);
       })).error(ajax_error_handler);
   }
 
+  function renderHistogram(dnData) {
+       var data = dnData.LiveNodes.map(function(dn) {
+           return (dn.usedSpace / dn.capacity) * 100.0;
+       });
+       var formatCount = d3.format(",.0f");
+       var widthCap = $("div.container").width();
+
+       var heightCap = 150;
+       var margin = {top: 10, right: 60, bottom: 30, left: 30},
+           width = widthCap * 0.9,
+           height = heightCap - margin.top - margin.bottom;
+
+       var x = d3.scaleLinear()
+           .domain([0.0, 100.0])
+           .range([0, width]);
+
+       var bins = d3.histogram()
+           .domain(x.domain())
+           .thresholds(x.ticks(20))
+           (data);
+
+       var y = d3.scaleLinear()
+           .domain([0, d3.max(bins, function(d) { return d.length; })])
+           .range([height, 0]);
+
+       var svg = d3.select("#datanode-usage-histogram").append("svg")
+           .attr("width", width + 50.0)
+           .attr("height", height + margin.top + margin.bottom)
+           .append("g")
+           .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+       svg.append("text")
+           .attr("x", (width / 2))
+           .attr("y", heightCap - 6 - (margin.top / 2))
+           .attr("text-anchor", "middle")
+           .style("font-size", "15px")
+           .text("Disk usage of each DataNode (%)");
+
+       var bar = svg.selectAll(".bar")
+           .data(bins)
+           .enter().append("g")
+           .attr("class", "bar")
+           .attr("transform", function(d) { return "translate(" + x(d.x0) + "," + y(d.length)
+ ")"; });
+       bar.append("rect")
+           .attr("x", 1)
+           .attr("width", x(bins[0].x1) - x(bins[0].x0) - 1)
+           .attr("height", function(d) { return height - y(d.length); });
+       bar.append("text")
+           .attr("dy", ".75em")
+           .attr("y", 6)
+           .attr("x", (x(bins[0].x1) - x(bins[0].x0)) / 2)
+           .attr("text-anchor", "middle")
+           .text(function(d) { return formatCount(d.length); });
+       svg.append("g")
+           .attr("class", "axis axis--x")
+           .attr("transform", "translate(0," + height + ")")
+           .call(d3.axisBottom(x));
+   }
+
   function load_datanode_volume_failures() {
 
     var HELPERS = {


---------------------------------------------------------------------
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