HBASE-15586 Unify human readable numbers in the web UI

This commit is contained in:
Enis Soztutar 2016-04-07 17:07:33 -07:00
parent a146a71a33
commit 2dcd08bc3d
4 changed files with 48 additions and 31 deletions

View File

@ -29,6 +29,7 @@ HMaster master;
org.apache.hadoop.hbase.ServerLoad;
org.apache.hadoop.hbase.ServerName;
org.apache.hadoop.hbase.util.VersionInfo;
org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
</%import>
@ -148,9 +149,12 @@ for (ServerName serverName: serverNames) {
</%java>
<tr>
<td><& serverNameLink; serverName=serverName; serverLoad = sl; &></td>
<td><% sl.getUsedHeapMB() %>m</td>
<td><% sl.getMaxHeapMB() %>m</td>
<td><% sl.getMemstoreSizeInMB() %>m</td>
<td><% TraditionalBinaryPrefix.long2String(sl.getUsedHeapMB()
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(sl.getMaxHeapMB()
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(sl.getMemstoreSizeInMB()
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
</tr>
<%java>
@ -226,10 +230,14 @@ if (sl != null) {
<td><& serverNameLink; serverName=serverName; serverLoad = sl; &></td>
<td><% sl.getStores() %></td>
<td><% sl.getStorefiles() %></td>
<td><% sl.getStoreUncompressedSizeMB() %>m</td>
<td><% sl.getStorefileSizeInMB() %>mb</td>
<td><% sl.getTotalStaticIndexSizeKB() %>k</td>
<td><% sl.getTotalStaticBloomSizeKB() %>k</td>
<td><% TraditionalBinaryPrefix.long2String(
sl.getStoreUncompressedSizeMB() * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(sl.getStorefileSizeInMB()
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(sl.getTotalStaticIndexSizeKB()
* TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(sl.getTotalStaticBloomSizeKB()
* TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
</tr>
<%java>
} else {

View File

@ -45,7 +45,7 @@ org.apache.hadoop.hbase.io.hfile.bucket.BucketCacheStats;
org.apache.hadoop.hbase.io.hfile.bucket.BucketCache;
org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator;
org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.Bucket;
org.apache.hadoop.util.StringUtils;
org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
</%import>
<div class="tabbable">
<ul class="nav nav-pills">
@ -245,12 +245,14 @@ org.apache.hadoop.util.StringUtils;
</tr>
<tr>
<td>Size</td>
<td><% StringUtils.humanReadableInt(cacheConfig.getBlockCache().getCurrentSize()) %></td>
<td><% TraditionalBinaryPrefix.long2String(cacheConfig.getBlockCache().getCurrentSize(),
"B", 1) %></td>
<td>Current size of block cache in use (bytes)</td>
</tr>
<tr>
<td>Free</td>
<td><% StringUtils.humanReadableInt(cacheConfig.getBlockCache().getFreeSize()) %></td>
<td><% TraditionalBinaryPrefix.long2String(cacheConfig.getBlockCache().getFreeSize(),
"B", 1) %></td>
<td>The total free memory currently available to store more cache entries (bytes)</td>
</tr>
<tr>
@ -337,13 +339,13 @@ are combined counts. Request count is sum of hits and misses.</p>
</%if>
<tr>
<td>Size</td>
<td><% StringUtils.humanReadableInt(cbsbf.getSize()) %></td>
<td><% TraditionalBinaryPrefix.long2String(cbsbf.getSize(), "B", 1) %></td>
<td>Size of Blocks</td>
</tr>
<%if !bucketCache %>
<tr>
<td>Size</td>
<td><% StringUtils.humanReadableInt(cbsbf.getDataSize()) %></td>
<td><% TraditionalBinaryPrefix.long2String(cbsbf.getDataSize(), "B", 1) %></td>
<td>Size of DATA Blocks</td>
</tr>
</%if>

View File

@ -33,6 +33,7 @@
org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad;
org.apache.hadoop.hbase.client.RegionReplicaUtil;
org.apache.hadoop.hbase.regionserver.MetricsRegionWrapper;
org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
</%import>
<%if (onlineRegions != null && onlineRegions.size() > 0) %>
@ -170,10 +171,14 @@
<%if load != null %>
<td><% load.getStores() %></td>
<td><% load.getStorefiles() %></td>
<td><% load.getStoreUncompressedSizeMB() %>m</td>
<td><% load.getStorefileSizeMB() %>m</td>
<td><% load.getTotalStaticIndexSizeKB() %>k</td>
<td><% load.getTotalStaticBloomSizeKB() %>k</td>
<td><% TraditionalBinaryPrefix.long2String(load.getStoreUncompressedSizeMB()
* TraditionalBinaryPrefix.MEGA.value, "B", 1)%></td>
<td><% TraditionalBinaryPrefix.long2String(load.getStorefileSizeMB()
* TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(load.getTotalStaticIndexSizeKB()
* TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(load.getTotalStaticBloomSizeKB()
* TraditionalBinaryPrefix.KILO.value, "B", 1) %></td>
<td><% load.getDataLocality() %></td>
</%if>
</tr>
@ -238,7 +243,8 @@
</%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<%if load != null %>
<td><% load.getMemstoreSizeMB() %>m</td>
<td><% TraditionalBinaryPrefix.long2String(
load.getMemstoreSizeMB() * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
</%if>
</tr>
</%for>

View File

@ -33,7 +33,7 @@ org.apache.hadoop.hbase.protobuf.ProtobufUtil;
org.apache.hadoop.hbase.protobuf.generated.AdminProtos.ServerInfo;
org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad;
org.apache.hadoop.hbase.util.DirectMemoryUtils;
org.apache.hadoop.util.StringUtils;
org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
java.lang.management.ManagementFactory;
</%import>
<div class="tabbable">
@ -106,18 +106,20 @@ MetricsRegionServerWrapper mWrap;
</tr>
<tr>
<td>
<% StringUtils.humanReadableInt(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed()) %>
<% TraditionalBinaryPrefix.long2String(
ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed(), "B", 1) %>
</td>
<td>
<% StringUtils.humanReadableInt(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax()) %>
<% TraditionalBinaryPrefix.long2String(
ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax(), "B", 1) %>
</td>
<td>
<% StringUtils.humanReadableInt(DirectMemoryUtils.getDirectMemoryUsage()) %>
<% TraditionalBinaryPrefix.long2String(DirectMemoryUtils.getDirectMemoryUsage(), "B", 1) %>
</td>
<td>
<% StringUtils.humanReadableInt(DirectMemoryUtils.getDirectMemorySize()) %>
<% TraditionalBinaryPrefix.long2String(DirectMemoryUtils.getDirectMemorySize(), "B", 1) %>
</td>
<td><% StringUtils.humanReadableInt(mWrap.getMemstoreSize()) %></td>
<td><% TraditionalBinaryPrefix.long2String(mWrap.getMemstoreSize(), "B", 1) %></td>
</tr>
</table>
</%def>
@ -135,7 +137,7 @@ MetricsRegionServerWrapper mWrap;
</tr>
<tr>
<td><% mWrap.getNumWALFiles() %></td>
<td><% mWrap.getWALFileSize() %></td>
<td><% TraditionalBinaryPrefix.long2String(mWrap.getWALFileSize(), "B", 1) %></td>
</tr>
</table>
</%def>
@ -154,11 +156,11 @@ MetricsRegionServerWrapper mWrap;
<th>Bloom Size (bytes)</th>
</tr>
<tr>
<td><% StringUtils.humanReadableInt(mWrap.getNumStores()) %></td>
<td><% StringUtils.humanReadableInt(mWrap.getNumStoreFiles()) %></td>
<td><% StringUtils.humanReadableInt(mWrap.getStoreFileIndexSize()) %></td>
<td><% StringUtils.humanReadableInt(mWrap.getTotalStaticIndexSize()) %></td>
<td><% StringUtils.humanReadableInt(mWrap.getTotalStaticBloomSize()) %></td>
<td><% mWrap.getNumStores() %></td>
<td><% mWrap.getNumStoreFiles() %></td>
<td><% TraditionalBinaryPrefix.long2String(mWrap.getStoreFileIndexSize(), "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(mWrap.getTotalStaticIndexSize(), "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(mWrap.getTotalStaticBloomSize(), "B", 1) %></td>
</tr>
</table>
</%def>
@ -199,8 +201,7 @@ MetricsHBaseServerWrapper mServerWrap;
<tr>
<td><% mWrap.getCompactionQueueSize() %></td>
<td><% mWrap.getFlushQueueSize() %></td>
<td><% StringUtils.TraditionalBinaryPrefix.long2String(mServerWrap.getTotalQueueSize(),
"", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(mServerWrap.getTotalQueueSize(), "B", 1) %></td>
</tr>
</table>
</%def>