geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject incubator-geode git commit: GEODE-1145 Fix decimal places for LoadAvg on Pulse
Date Thu, 31 Mar 2016 15:27:51 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-1145 [created] a1f11c0d9


GEODE-1145 Fix decimal places for LoadAvg on Pulse

- Update UI test
- Consistently show 2 decimal places

Closes #118


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/a1f11c0d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/a1f11c0d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/a1f11c0d

Branch: refs/heads/feature/GEODE-1145
Commit: a1f11c0d9f4b5b0bafae3216ed7e357ffc017069
Parents: 0dab0b6
Author: Nitin Lamba <nitin@ampool.io>
Authored: Tue Mar 29 15:10:34 2016 -0700
Committer: Jens Deppe <jdeppe@pivotal.io>
Committed: Thu Mar 31 08:26:07 2016 -0700

----------------------------------------------------------------------
 .../tools/pulse/internal/service/ClusterMemberService.java    | 3 ++-
 .../pulse/internal/service/ClusterMembersRGraphService.java   | 2 +-
 .../pulse/internal/service/ClusterSelectedRegionService.java  | 5 +++--
 .../tools/pulse/internal/service/MemberDetailsService.java    | 5 +++--
 .../java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java  | 7 +++++--
 geode-pulse/src/test/resources/test.properties                | 6 +++---
 6 files changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a1f11c0d/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java
b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java
index f3deb19..3b55ed7 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java
@@ -99,12 +99,13 @@ public class ClusterMemberService implements PulseService {
         memberJSON.put(this.HEAP_USAGE, 0);
       }
       double currentCPUUsage = clusterMember.getCpuUsage();
+      double loadAvg = clusterMember.getLoadAverage();
 
       memberJSON.put("cpuUsage", truncate(currentCPUUsage, 2));
       memberJSON.put("currentHeapUsage", clusterMember.getCurrentHeapSize());
       memberJSON.put("isManager", clusterMember.isManager());
       memberJSON.put("uptime", TimeUtils.convertTimeSecondsToHMS(clusterMember.getUptime()));
-      memberJSON.put("loadAvg", clusterMember.getLoadAverage());
+      memberJSON.put("loadAvg", truncate(loadAvg, 2));
       memberJSON.put("sockets", clusterMember.getTotalFileDescriptorOpen());
       memberJSON.put("threads", clusterMember.getNumThreads());
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a1f11c0d/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMembersRGraphService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMembersRGraphService.java
b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMembersRGraphService.java
index 08dda78..cf4d950 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMembersRGraphService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMembersRGraphService.java
@@ -234,7 +234,7 @@ public class ClusterMembersRGraphService implements PulseService {
       }
       ObjectNode data = mapper.createObjectNode();
 
-      data.put(this.LOAD_AVG, hostLoadAvg);
+      data.put(this.LOAD_AVG, Double.valueOf(df2.format(hostLoadAvg)));
       data.put(this.SOCKETS, hostSockets);
       data.put(this.THREADS, hostNumThreads);
       data.put(this.CPU_USAGE, Double.valueOf(df2.format(hostCpuUsage)));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a1f11c0d/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionService.java
b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionService.java
index fb7484c..35e15c6 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionService.java
@@ -160,13 +160,14 @@ public class ClusterSelectedRegionService implements PulseService {
             regionMember.put("heapUsage", 0);
           }
           double currentCPUUsage = member.getCpuUsage();
+          double loadAvg = member.getLoadAverage();
 
           regionMember.put("cpuUsage", Double.valueOf(df2.format(currentCPUUsage)));
           regionMember.put("currentHeapUsage", member.getCurrentHeapSize());
           regionMember.put("isManager", member.isManager());
           regionMember.put("uptime", TimeUtils.convertTimeSecondsToHMS(member.getUptime()));
 
-          regionMember.put("loadAvg", member.getLoadAverage());
+          regionMember.put("loadAvg", Double.valueOf(df2.format(loadAvg)));
           regionMember.put("sockets", member.getTotalFileDescriptorOpen());
           regionMember.put("threads", member.getNumThreads());
 
@@ -239,4 +240,4 @@ public class ClusterSelectedRegionService implements PulseService {
       return responseJSON;
     }
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a1f11c0d/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberDetailsService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberDetailsService.java
b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberDetailsService.java
index 8798552..a25ca18 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberDetailsService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberDetailsService.java
@@ -60,6 +60,7 @@ public class MemberDetailsService implements PulseService {
 
     JsonNode requestDataJSON = mapper.readTree(request.getParameter("pulseData"));
     String memberName = requestDataJSON.get("MemberDetails").get("memberName").textValue();
+    DecimalFormat df2 = new DecimalFormat(PulseConstants.DECIMAL_FORMAT_PATTERN);
 
     Cluster.Member clusterMember = cluster.getMember(StringUtils
         .makeCompliantName(memberName));
@@ -70,7 +71,8 @@ public class MemberDetailsService implements PulseService {
       responseJSON.put("clusterId", cluster.getId());
       responseJSON.put("clusterName", cluster.getServerName());
       responseJSON.put("userName", userName);
-      responseJSON.put("loadAverage", clusterMember.getLoadAverage());
+      double loadAvg = clusterMember.getLoadAverage();
+      responseJSON.put("loadAverage", Double.valueOf(df2.format(loadAvg)));
       responseJSON.put("sockets", clusterMember.getTotalFileDescriptorOpen());
       responseJSON.put("threads", clusterMember.getNumThreads());
       responseJSON.put("offHeapFreeSize", clusterMember.getOffHeapFreeSize());
@@ -85,7 +87,6 @@ public class MemberDetailsService implements PulseService {
         responseJSON.put("numClients", clusterMember.getMemberClientsHMap().size());
       }
 
-      DecimalFormat df2 = new DecimalFormat(PulseConstants.DECIMAL_FORMAT_PATTERN);
       Long diskUsageVal = clusterMember.getTotalDiskUsage();
       Double diskUsage = diskUsageVal.doubleValue() / 1024;
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a1f11c0d/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java
b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java
index c5ece20..08cde44 100644
--- a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java
+++ b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java
@@ -20,6 +20,7 @@ package com.vmware.gemfire.tools.pulse.tests;
 
 import com.gemstone.gemfire.management.internal.JettyHelper;
 import com.gemstone.gemfire.test.junit.categories.UITest;
+import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
 import junit.framework.Assert;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -135,6 +136,8 @@ public class PulseTest {
   private static final String MEMBER_DROPDOWN_ID = "Members";
   private static final String DATA_DROPDOWN_ID = "Data";
 
+  private static final DecimalFormat df2 = new DecimalFormat(PulseConstants.DECIMAL_FORMAT_PATTERN);
+
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
     ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
@@ -474,7 +477,7 @@ public class PulseTest {
         .getText();
     String memberLoadAvg = JMXProperties.getInstance().getProperty(
         "member.M1.loadAverage");
-    Assert.assertEquals(memberLoadAvg, LoadAvg);
+    Assert.assertEquals(df2.format(Double.valueOf(memberLoadAvg)), LoadAvg);
   }
 
   @Ignore("WIP") // May be useful in near future
@@ -904,7 +907,7 @@ public class PulseTest {
 				  .getText();
 		  String loadAvgM1 = JMXProperties.getInstance().getProperty(
 				  "member.M" + (i) + ".loadAverage");
-		  Assert.assertEquals(loadAvgM1, LoadAvgM1);
+		  Assert.assertEquals(df2.format(Double.valueOf(loadAvgM1)), LoadAvgM1);
 		  
 		  
 		  String ThreadsM1 = driver.findElement(By.xpath("//div[@id='_tooltip']/div/div/div[2]/div["
+ (j + 3) + "]/div[2]/div"))

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a1f11c0d/geode-pulse/src/test/resources/test.properties
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/resources/test.properties b/geode-pulse/src/test/resources/test.properties
index 1ef7c3e..b779c16 100644
--- a/geode-pulse/src/test/resources/test.properties
+++ b/geode-pulse/src/test/resources/test.properties
@@ -62,7 +62,7 @@ member.M1.locator=false
 member.M1.totalDiskUsage=199302
 member.M1.server=false
 member.M1.totalFileDescriptorOpen=299
-member.M1.loadAverage=12.221
+member.M1.loadAverage=12.221987654321
 member.M1.diskWritesRate=23.92
 member.M1.JVMPauses=232221
 member.M1.currentHeapSize=2322
@@ -96,7 +96,7 @@ member.M2.locator=true
 member.M2.totalDiskUsage=199302
 member.M2.server=false
 member.M2.totalFileDescriptorOpen=299
-member.M2.loadAverage=12.221
+member.M2.loadAverage=12.221987654321
 member.M2.diskWritesRate=23.92
 member.M2.JVMPauses=232221
 member.M2.currentHeapSize=1322
@@ -130,7 +130,7 @@ member.M3.locator=false
 member.M3.totalDiskUsage=199302
 member.M3.server=false
 member.M3.totalFileDescriptorOpen=299
-member.M3.loadAverage=12.221
+member.M3.loadAverage=12.221987654321
 member.M3.diskWritesRate=23.92
 member.M3.JVMPauses=232221
 member.M3.currentHeapSize=2312


Mime
View raw message