use of org.apache.geode.tools.pulse.internal.data.Cluster.RegionOnMember in project geode by apache.
the class ClusterSelectedRegionsMemberService method getSelectedRegionsMembersJson.
/**
* Create JSON for selected cluster region's all members
*/
private ObjectNode getSelectedRegionsMembersJson(Cluster cluster, String selectedRegionFullPath) {
Cluster.Region reg = cluster.getClusterRegion(selectedRegionFullPath);
if (reg != null) {
ObjectNode regionMemberJSON = mapper.createObjectNode();
RegionOnMember[] regionOnMembers = reg.getRegionOnMembers();
// sort on entry count
List<RegionOnMember> romList = Arrays.asList(regionOnMembers);
Collections.sort(romList, romEntryCountComparator);
for (RegionOnMember rom : romList) {
ObjectNode memberJSON = mapper.createObjectNode();
memberJSON.put("memberName", rom.getMemberName());
memberJSON.put("regionFullPath", rom.getRegionFullPath());
memberJSON.put("entryCount", rom.getEntryCount());
memberJSON.put("entrySize", rom.getEntrySize());
memberJSON.put("accessor", ((rom.getLocalMaxMemory() == 0) ? "True" : "False"));
logger.trace("calling getSelectedRegionsMembersJson :: rom.getLocalMaxMemory() = {}", rom.getLocalMaxMemory());
memberJSON.put("memoryReadsTrend", mapper.<JsonNode>valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_GETS_PER_SEC_TREND)));
logger.trace("memoryReadsTrend = {}", rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_GETS_PER_SEC_TREND).length);
memberJSON.put("memoryWritesTrend", mapper.<JsonNode>valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_PUTS_PER_SEC_TREND)));
logger.trace("memoryWritesTrend = {}", rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_PUTS_PER_SEC_TREND).length);
memberJSON.put("diskReadsTrend", mapper.<JsonNode>valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_DISK_READS_PER_SEC_TREND)));
logger.trace("diskReadsTrend = {}", rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_DISK_READS_PER_SEC_TREND).length);
memberJSON.put("diskWritesTrend", mapper.<JsonNode>valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_DISK_WRITES_PER_SEC_TREND)));
logger.trace("diskWritesTrend = {}", rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_DISK_WRITES_PER_SEC_TREND).length);
regionMemberJSON.put(rom.getMemberName(), memberJSON);
}
logger.debug("calling getSelectedRegionsMembersJson :: regionJSON = {}", regionMemberJSON);
return regionMemberJSON;
} else {
ObjectNode responseJSON = mapper.createObjectNode();
responseJSON.put("errorOnRegion", "Region [" + selectedRegionFullPath + "] is not available");
return responseJSON;
}
}
Aggregations