HBASE-18789 Displays the reporting interval of each RS on the Master page

Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
Guangxu Cheng 2017-09-11 23:36:32 +08:00 committed by tedyu
parent d576e5a32d
commit 5370aed410
2 changed files with 11 additions and 1 deletions

View File

@ -54,10 +54,12 @@ public class ServerLoad {
private int totalStaticBloomSizeKB = 0;
private long totalCompactingKVs = 0;
private long currentCompactedKVs = 0;
private long reportTime = 0;
@InterfaceAudience.Private
public ServerLoad(ClusterStatusProtos.ServerLoad serverLoad) {
this.serverLoad = serverLoad;
this.reportTime = System.currentTimeMillis();
for (ClusterStatusProtos.RegionLoad rl: serverLoad.getRegionLoadsList()) {
stores += rl.getStores();
storefiles += rl.getStorefiles();
@ -74,7 +76,6 @@ public class ServerLoad {
totalCompactingKVs += rl.getTotalCompactingKVs();
currentCompactedKVs += rl.getCurrentCompactedKVs();
}
}
// NOTE: Function name cannot start with "get" because then an OpenDataException is thrown because
@ -359,4 +360,8 @@ public class ServerLoad {
public static final ServerLoad EMPTY_SERVERLOAD =
new ServerLoad(ClusterStatusProtos.ServerLoad.newBuilder().build());
public long getReportTime() {
return reportTime;
}
}

View File

@ -77,6 +77,7 @@ Arrays.sort(serverNames);
<tr>
<th>ServerName</th>
<th>Start time</th>
<th>Last contact</th>
<th>Version</th>
<th>Requests Per Second</th>
<th>Num. Regions</th>
@ -96,6 +97,7 @@ Arrays.sort(serverNames);
double requestsPerSecond = 0.0;
int numRegionsOnline = 0;
long lastContact = 0;
if (sl != null) {
requestsPerSecond = sl.getRequestsPerSecond();
@ -103,12 +105,14 @@ Arrays.sort(serverNames);
totalRegions += sl.getNumberOfRegions();
// Is this correct? Adding a rate to a measure.
totalRequests += sl.getNumberOfRequests();
lastContact = (System.currentTimeMillis() - sl.getReportTime())/1000;
}
long startcode = serverName.getStartcode();
</%java>
<tr>
<td><& serverNameLink; serverName=serverName; serverLoad = sl; &></td>
<td><% new Date(startcode) %></td>
<td><% TraditionalBinaryPrefix.long2String(lastContact, "s", 1) %></td>
<td><% version %></td>
<td><% String.format("%.0f", requestsPerSecond) %></td>
<td><% numRegionsOnline %></td>
@ -118,6 +122,7 @@ Arrays.sort(serverNames);
</%java>
<tr><td>Total:<% servers.size() %></td>
<td></td>
<td></td>
<%if inconsistentNodeNum > 0%>
<td style="color:red;"><% inconsistentNodeNum %> nodes with inconsistent version</td>
<%else>