Skip to content

Commit 3139db5

Browse files
daisukebebrfrn169
authored andcommitted
HBASE-22160 Add sorting functionality in regionserver web UI for user
Signed-off-by: Toshihiro Suzuki <brfrn169@gmail.com> Signed-off-by: Wellington Chevreuil <wellington.chevreuil@gmail.com>
1 parent 35d3612 commit 3139db5

File tree

2 files changed

+62
-7
lines changed

2 files changed

+62
-7
lines changed

hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,42 @@ org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;
240240
</div>
241241
</div>
242242
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
243+
<script src="/static/js/jquery.tablesorter.min.js" type="text/javascript"></script>
243244
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
244245
<script src="/static/js/tab.js" type="text/javascript"></script>
246+
<script>
247+
$(document).ready(function()
248+
{
249+
$.tablesorter.addParser({
250+
id: 'filesize',
251+
is: function(s) {
252+
return s.match(new RegExp( /([\.0-9]+)\ (B|KB|MB|GB|TB)/ ));
253+
},
254+
format: function(s) {
255+
var suf = s.match(new RegExp( /(KB|B|GB|MB|TB)$/ ))[1];
256+
var num = parseFloat(s.match( new RegExp( /([\.0-9]+)\ (B|KB|MB|GB|TB)/ ))[0]);
257+
switch(suf) {
258+
case 'B':
259+
return num;
260+
case 'KB':
261+
return num * 1024;
262+
case 'MB':
263+
return num * 1024 * 1024;
264+
case 'GB':
265+
return num * 1024 * 1024 * 1024;
266+
case 'TB':
267+
return num * 1024 * 1024 * 1024 * 1024;
268+
}
269+
},
270+
type: 'numeric'
271+
});
272+
$("#baseStatsTable").tablesorter();
273+
$("#requestStatsTable").tablesorter();
274+
$("#storeStatsTable").tablesorter();
275+
$("#compactionStatsTable").tablesorter();
276+
$("#memstoreStatsTable").tablesorter();
277+
}
278+
);
279+
</script>
245280
</body>
246281
</html>

hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,17 @@
8888
<%args>
8989
List<RegionInfo> onlineRegions;
9090
</%args>
91-
<table class="table table-striped">
91+
<table id="baseStatsTable" class="tablesorter table table-striped">
92+
<thead>
9293
<tr>
9394
<th>Region Name</th>
9495
<th>Start Key</th>
9596
<th>End Key</th>
9697
<th>ReplicaID</th>
9798
</tr>
99+
</thead>
98100

101+
<tbody>
99102
<%for RegionInfo r: onlineRegions %>
100103
<tr>
101104
<%java>
@@ -110,21 +113,25 @@
110113
<td><% r.getReplicaId() %></td>
111114
</tr>
112115
</%for>
116+
</tbody>
113117
</table>
114118
</%def>
115119

116120
<%def requestStats>
117121
<%args>
118122
List<RegionInfo> onlineRegions;
119123
</%args>
120-
<table class="table table-striped">
124+
<table id="requestStatsTable" class="tablesorter table table-striped">
125+
<thead>
121126
<tr>
122127
<th>Region Name</th>
123128
<th>Read Request Count</th>
124129
<th>Filtered Read Request Count</th>
125130
<th>Write Request Count</th>
126131
</tr>
132+
</thead>
127133

134+
<tbody>
128135
<%for RegionInfo r: onlineRegions %>
129136

130137
<tr>
@@ -141,6 +148,7 @@
141148
</%if>
142149
</tr>
143150
</%for>
151+
</tbody>
144152
</table>
145153
</%def>
146154

@@ -149,7 +157,8 @@
149157
<%args>
150158
List<RegionInfo> onlineRegions;
151159
</%args>
152-
<table class="table table-striped">
160+
<table id="storeStatsTable" class="tablesorter table table-striped">
161+
<thead>
153162
<tr>
154163
<th>Region Name</th>
155164
<th>Num. Stores</th>
@@ -160,7 +169,9 @@
160169
<th>Bloom Size</th>
161170
<th>Data Locality</th>
162171
</tr>
172+
</thead>
163173

174+
<tbody>
164175
<%for RegionInfo r: onlineRegions %>
165176

166177
<tr>
@@ -185,6 +196,7 @@
185196
</%if>
186197
</tr>
187198
</%for>
199+
</tbody>
188200
</table>
189201
</%def>
190202

@@ -193,15 +205,18 @@
193205
<%args>
194206
List<RegionInfo> onlineRegions;
195207
</%args>
196-
<table class="table table-striped">
208+
<table id="compactionStatsTable" class="tablesorter table table-striped">
209+
<thead>
197210
<tr>
198211
<th>Region Name</th>
199212
<th>Num. Compacting Cells</th>
200213
<th>Num. Compacted Cells</th>
201214
<th>Compaction Progress</th>
202-
<th>Last Major Compaction</th>
215+
<th data-date-format="yyyymmdd hhmm zz">Last Major Compaction</th>
203216
</tr>
217+
</thead>
204218

219+
<tbody>
205220
<%for RegionInfo r: onlineRegions %>
206221

207222
<tr>
@@ -215,7 +230,7 @@
215230
((float) load.getCurrentCompactedKVs() / load.getTotalCompactingKVs())) + "%";
216231
}
217232
if (load.getLastMajorCompactionTs() > 0) {
218-
FastDateFormat fdf = FastDateFormat.getInstance("yyyy-MM-dd HH:mm ZZ");
233+
FastDateFormat fdf = FastDateFormat.getInstance("yyyy-MM-dd HH:mm (ZZ)");
219234
compactTime = fdf.format(load.getLastMajorCompactionTs());
220235
}
221236
}
@@ -231,19 +246,23 @@
231246
</%if>
232247
</tr>
233248
</%for>
249+
</tbody>
234250
</table>
235251
</%def>
236252

237253
<%def memstoreStats>
238254
<%args>
239255
List<RegionInfo> onlineRegions;
240256
</%args>
241-
<table class="table table-striped">
257+
<table id="memstoreStatsTable" class="tablesorter table table-striped">
258+
<thead>
242259
<tr>
243260
<th>Region Name</th>
244261
<th>Memstore Size</th>
245262
</tr>
263+
</thead>
246264

265+
<tbody>
247266
<%for RegionInfo r: onlineRegions %>
248267

249268
<tr>
@@ -259,5 +278,6 @@
259278
</%if>
260279
</tr>
261280
</%for>
281+
</tbody>
262282
</table>
263283
</%def>

0 commit comments

Comments
 (0)