Map<DataStoreInstanceType, DataStoreStats> storeStats = node.getDataStoreStats();
for (Map.Entry<DataStoreInstanceType, DataStoreStats> entry : storeStats.entrySet()) {
DataStoreInstanceType instance = entry.getKey();
DataStoreStats stats = entry.getValue();
StoreAccessStats sessionAccess = stats.getSessionAccessStats();
StoreAccessStats totalAccess;
long totalUptimeSeconds = 0;
try {
totalAccess = stats.getTotalAccessStats();
// FIXME this is not necessarily the same as the datastore's uptime if we've switched.
// Ideally we'd track uptime there too.
totalUptimeSeconds =
node.clientCore.bandwidthStatsPutter.getLatestUptimeData().totalUptime;
} catch (StatsNotAvailableException e) {
totalAccess = null;
}
row = storeSizeTable.addChild("tr");
row.addChild("th", l10n(instance.store.name()) + "\n" + " (" + l10n(instance.key.name()) + ")");
row.addChild("td", thousandPoint.format(stats.keys()));
row.addChild("td", thousandPoint.format(stats.capacity()));
row.addChild("td", SizeUtil.formatSize(stats.dataSize()));
row.addChild("td", fix3p1pct.format(stats.utilization()));
row.addChild("td", thousandPoint.format(sessionAccess.readRequests()) +
(totalAccess == null ? "" : (" ("+thousandPoint.format(totalAccess.readRequests())+")")));
row.addChild("td", thousandPoint.format(sessionAccess.successfulReads()) +
(totalAccess == null ? "" : (" ("+thousandPoint.format(totalAccess.successfulReads())+")")));
try {
String rate = fix1p4.format(sessionAccess.successRate()) + "%";
if(totalAccess != null) {
try {
rate += " (" + fix1p4.format(totalAccess.successRate()) + "%)";
} catch (StatsNotAvailableException e) {
// Ignore
}
}
row.addChild("td", rate);
} catch (StatsNotAvailableException e) {
row.addChild("td", "N/A");
}
row.addChild("td", thousandPoint.format(sessionAccess.writes()) +
(totalAccess == null ? "" : (" ("+thousandPoint.format(totalAccess.writes())+")")));
String access = fix1p2.format(sessionAccess.accessRate(nodeUptimeSeconds)) + " /s";
if(totalAccess != null)
access += " (" + fix1p2.format(totalAccess.accessRate(totalUptimeSeconds)) + " /s)";
row.addChild("td", access);
access = fix1p2.format(sessionAccess.writeRate(nodeUptimeSeconds)) + " /s";
if(totalAccess != null)
access += " (" + fix1p2.format(totalAccess.writeRate(totalUptimeSeconds)) + " /s)";
row.addChild("td", access);
row.addChild("td", thousandPoint.format(sessionAccess.falsePos()) +
(totalAccess == null ? "" : (" ("+thousandPoint.format(totalAccess.falsePos())+")")));
try {
row.addChild("td", fix1p4.format(stats.avgLocation()));
} catch (StatsNotAvailableException e) {
row.addChild("td", "N/A");
}