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

2018-09-04 Thread GitBox
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_r215004905
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -49,6 +51,15 @@ public CpuGaugeSet() {
 metric.put("drillbit.uptime", new DrillbitUptime(rtMXBean));
 return metric;
   }
+
+  private static OperatingSystemMXBean getOSMXBeanForCpuMetrics() {
+try {
+  return (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
+} catch (Exception ex) {
 
 Review comment:
   Not sure how it can throw other exception instead of class cast. I liked 
version with more narrow exception better.


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-29 Thread GitBox
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_r213619357
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -63,7 +72,7 @@ public OperatingSystemLoad(OperatingSystemMXBean osBean) {
 
   @Override
   public Double getValue() {
-return osMXBean.getSystemLoadAverage();
+return (osMXBean != null) ? osMXBean.getSystemLoadAverage(): null;
 
 Review comment:
   What you would need braces here?


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-28 Thread GitBox
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_r213256408
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -32,13 +32,22 @@
  */
 @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 final OperatingSystemMXBean osMXBean;
+  private final RuntimeMXBean rtMXBean;
 
   public CpuGaugeSet() {
-this.osMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
 this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+//DRILL-6702: Instead of worrying about compiling with IBM JDK, for now, 
we shall provide no CPU metrics for non-HotSpot JVMs
+OperatingSystemMXBean tempOSMXBean;
+try {
+  tempOSMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
+} catch (ClassCastException cce) {
+  logger.warn("{}. Detected non-Supported JVM [{}]. CPU Metrics in the 
WebUI will not be available!", cce.getMessage(), 
System.getProperty("java.vm.name"));
 
 Review comment:
   @kkhatua 
   1. Could you please give example of warn message? I am not sure that 
`e.getMessage` will give enough information.
   2. Vlad's suggestion to use ternary operator should be also implemented.
   3. Please the squash the commits.


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-27 Thread GitBox
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_r212888738
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -32,13 +32,23 @@
  */
 @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 final OperatingSystemMXBean osMXBean;
+  private final RuntimeMXBean rtMXBean;
 
   public CpuGaugeSet() {
-this.osMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
 this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+//DRILL-6702: Instead of worrying about compiling with IBM JDK, for now, 
we shall provide no CPU metrics for non-HotSpot JVMs
+OperatingSystemMXBean tempOSMXBean = null;
+try {
+  tempOSMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
+} catch (ClassCastException cce) {
+  logger.warn("Detected non-HotSpot JVM [{}]. CPU Metrics in the WebUI 
will not be available!", System.getProperty("java.vm.name"));
+  tempOSMXBean = null;
+}
+this.osMXBean = tempOSMXBean;
+System.out.println("osMXBean::" + osMXBean);
 
 Review comment:
   In this case I suggest not to push intermediate results, since it's quite 
confusing for the reviewer.


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-26 Thread GitBox
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_r212824287
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -32,13 +32,23 @@
  */
 @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 final OperatingSystemMXBean osMXBean;
+  private final RuntimeMXBean rtMXBean;
 
   public CpuGaugeSet() {
-this.osMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
 this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+//DRILL-6702: Instead of worrying about compiling with IBM JDK, for now, 
we shall provide no CPU metrics for non-HotSpot JVMs
+OperatingSystemMXBean tempOSMXBean = null;
+try {
+  tempOSMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
+} catch (ClassCastException cce) {
+  logger.warn("Detected non-HotSpot JVM [{}]. CPU Metrics in the WebUI 
will not be available!", System.getProperty("java.vm.name"));
+  tempOSMXBean = null;
+}
+this.osMXBean = tempOSMXBean;
+System.out.println("osMXBean::" + osMXBean);
 
 Review comment:
   Please remove.


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-26 Thread GitBox
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_r212824283
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -32,13 +32,23 @@
  */
 @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 final OperatingSystemMXBean osMXBean;
+  private final RuntimeMXBean rtMXBean;
 
   public CpuGaugeSet() {
-this.osMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
 this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+//DRILL-6702: Instead of worrying about compiling with IBM JDK, for now, 
we shall provide no CPU metrics for non-HotSpot JVMs
+OperatingSystemMXBean tempOSMXBean = null;
+try {
+  tempOSMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
+} catch (ClassCastException cce) {
+  logger.warn("Detected non-HotSpot JVM [{}]. CPU Metrics in the WebUI 
will not be available!", System.getProperty("java.vm.name"));
 
 Review comment:
   Please include error as well.


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-26 Thread GitBox
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_r212824260
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -32,13 +32,23 @@
  */
 @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 final OperatingSystemMXBean osMXBean;
+  private final RuntimeMXBean rtMXBean;
 
   public CpuGaugeSet() {
-this.osMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
 this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+//DRILL-6702: Instead of worrying about compiling with IBM JDK, for now, 
we shall provide no CPU metrics for non-HotSpot JVMs
+OperatingSystemMXBean tempOSMXBean = null;
 
 Review comment:
   Unneeded assignment.


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-24 Thread GitBox
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_r212609360
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -32,13 +32,20 @@
  */
 @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 final OperatingSystemMXBean osMXBean;
+  private final RuntimeMXBean rtMXBean;
 
   public CpuGaugeSet() {
-this.osMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
 this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+//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")) {
 
 Review comment:
   Sounds reasonable, let then proceed with try / catch approach.


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-23 Thread GitBox
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_r212376680
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -32,13 +32,20 @@
  */
 @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 final OperatingSystemMXBean osMXBean;
+  private final RuntimeMXBean rtMXBean;
 
   public CpuGaugeSet() {
-this.osMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
 this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+//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")) {
 
 Review comment:
   Any particular reason why?


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-23 Thread GitBox
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_r212373702
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -32,13 +32,20 @@
  */
 @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 final OperatingSystemMXBean osMXBean;
+  private final RuntimeMXBean rtMXBean;
 
   public CpuGaugeSet() {
-this.osMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
 this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+//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")) {
 
 Review comment:
   Agree, with these thoughts in mind, in my code example (which is in outdated 
comments) `instanceOf` check was suggested.


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-23 Thread GitBox
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_r212274599
 
 

 ##
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##
 @@ -32,13 +32,20 @@
  */
 @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 final OperatingSystemMXBean osMXBean;
+  private final RuntimeMXBean rtMXBean;
 
   public CpuGaugeSet() {
-this.osMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
 this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+//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")) {
 
 Review comment:
   1.  We can extract `System.getProperty("java.vm.name")` into variable and 
not call it twice.
   2. Can `System.getProperty("java.vm.name")` not be set and return null? In 
this case we'll get NPE.


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2018-08-22 Thread GitBox
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:
us...@infra.apache.org


With regards,
Apache Git Services