alnzng commented on code in PR #1636:
URL: https://github.com/apache/samza/pull/1636#discussion_r1014525279


##########
samza-core/src/main/java/org/apache/samza/container/host/StatisticsMonitorImpl.java:
##########
@@ -117,23 +118,23 @@ public void run() {
   }
 
   private void sampleStatistics() {
-    SystemMemoryStatistics statistics = null;
+    SystemMemoryStatistics memoryStatistics = null;
+    ProcessCPUStatistics cpuStatistics = null;
     try {
-      statistics = statisticsGetter.getSystemMemoryStatistics();
+      memoryStatistics = statisticsGetter.getSystemMemoryStatistics();
+      cpuStatistics = statisticsGetter.getProcessCPUStatistics();
     } catch (Throwable e) {
       LOG.error("Error during obtaining statistics: ", e);
     }
-
+    SystemStatistics systemStatistics = new SystemStatistics(cpuStatistics, 
memoryStatistics);
     for (Listener listener : listenerSet.keySet()) {
-      if (statistics != null) {

Review Comment:
   I moved the null check in the listener: 
https://github.com/apache/samza/pull/1636/files#diff-f79781ad4c55ae7860829b06fd9dfd15e8069c37e64f8854d8f27ca2cd1f3ee5R653
 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@samza.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to