You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2018/08/22 09:50:15 UTC

[GitHub] arina-ielchiieva commented on a change in pull request #1437: DRILL-6702: Disable CPU Reporting for non-HotSpot JDKs

arina-ielchiieva commented on a change in pull request #1437: DRILL-6702: Disable CPU Reporting for non-HotSpot JDKs
URL: https://github.com/apache/drill/pull/1437#discussion_r211894551
 
 

 ##########
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##########
 @@ -32,13 +32,24 @@
  */
 @SuppressWarnings("restriction")
 public class CpuGaugeSet implements MetricSet {
+  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CpuGaugeSet.class);
 
   private OperatingSystemMXBean osMXBean;
   private RuntimeMXBean rtMXBean;
+  private static String nonHotSpotJVMName;
 
   public CpuGaugeSet() {
-    this.osMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
+    //DRILL-6702: Instead of worrying about compiling with IBM JDK, for now, we shall provide no CPU metrics for non-HotSpot JVMs
+    if (System.getProperty("java.vm.name").contains("HotSpot")) {
+      this.osMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
+    } else {
+      this.osMXBean = null;
+      nonHotSpotJVMName = System.getProperty("java.vm.name");
+    }
     this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+    if (nonHotSpotJVMName != null) {
+      logger.warn("Detected non-HotSpot JVM [{}]. CPU Metrics in the WebUI will not be available!", nonHotSpotJVMName);
+    }
 
 Review comment:
   ```
   public class CpuGaugeSet implements MetricSet {
     private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CpuGaugeSet.class);
   
     private final RuntimeMXBean rtMXBean;
     private final OperatingSystemMXBean osMXBean;
   
     public CpuGaugeSet() {
       //DRILL-6702: Instead of worrying about compiling with IBM JDK, for now, we shall provide no CPU metrics for non-HotSpot JVMs
       this.rtMXBean = ManagementFactory.getRuntimeMXBean();
       java.lang.management.OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
       if (operatingSystemMXBean instanceof OperatingSystemMXBean) {
         this.osMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
       } else {
         this.osMXBean = null;
         logger.warn("Detected non-HotSpot JVM [{}]. CPU Metrics in the WebUI will not be available!", System.getProperty("java.vm.name"));
       }
     }
   ...
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services