StorageService: getLoadMap should format the load

Similiar to origin, the load map should return a formated load value.

After this patch the nodetool status command:
$nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens  Owns    Host ID
Rack
UN  127.0.0.1  394.97 MB  256     ?
292a6c7f-2063-484c-b54d-9015216f1750  rack1
UN  127.0.0.2  151.07 MB  256     ?
102b6ecd-2081-4073-8172-bf818c35e27b  rack1

Under scylla-jmx
Fixes #18

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This commit is contained in:
Amnon Heiman 2015-12-13 13:08:38 +02:00 committed by Pekka Enberg
parent bb7409fbc7
commit fb9f3c8961

View File

@ -329,7 +329,13 @@ public class StorageService extends NotificationBroadcasterSupport
/** Human-readable load value. Keys are IP addresses. */
public Map<String, String> getLoadMap() {
log(" getLoadMap()");
return c.getMapStrValue("/storage_service/load_map");
Map<String, String> load = c.getMapStrValue("/storage_service/load_map");
Map<String, String> map = new HashMap<>();
for (Map.Entry<String, String> entry : load.entrySet())
{
map.put(entry.getKey(), FileUtils.stringifyFileSize(Double.parseDouble(entry.getValue())));
}
return map;
}
/**