squito commented on a change in pull request #23306: [SPARK-26357][Core] Expose 
executors' procfs metrics to Metrics system
URL: https://github.com/apache/spark/pull/23306#discussion_r242345312
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/executor/ProcfsMetricsGetter.scala
 ##########
 @@ -64,19 +74,11 @@ private[spark] class ProcfsMetricsGetter(procfsDir: String 
= "/proc/") extends L
         SparkEnv.get.conf.get(config.EVENT_LOG_PROCESS_TREE_METRICS)
       val shouldAddProcessTreeMetricsToMetricsSet =
         SparkEnv.get.conf.get(config.METRICS_PROCESS_TREE_METRICS)
-      val pickEitherUIOrMetricsSet = shouldLogStageExecutorProcessTreeMetrics ^
-        shouldAddProcessTreeMetricsToMetricsSet
-      val areBothUIMetricsEnabled = shouldLogStageExecutorProcessTreeMetrics &&
+      val pickAnyOfUIOrMetricsSet = shouldLogStageExecutorProcessTreeMetrics ||
         shouldAddProcessTreeMetricsToMetricsSet
-      if (areBothUIMetricsEnabled) {
-        logWarning("You have enabled " +
-          "both spark.eventLog.logStageExecutorProcessTreeMetrics.enabled" +
-          " and spark.metrics.logStageExecutorProcessTreeMetrics.enabled. This 
isn't " +
-          "allowed. As a result Procfs metrics won't be reported to UI or 
Metricsset")
-      }
-      (procDirExists.get && shouldLogStageExecutorMetrics && 
pickEitherUIOrMetricsSet) ||
-        (procDirExists.get && !shouldLogStageExecutorMetrics &&
-          pickEitherUIOrMetricsSet && shouldAddProcessTreeMetricsToMetricsSet)
+
+      (procDirExists.get && shouldLogStageExecutorMetrics && 
pickAnyOfUIOrMetricsSet) ||
 
 Review comment:
   I think this is really confusing b/c `shouldLogStageExecutorMetrics` and 
`shouldLogStageExecutorProcessTreeMetrics` look so similar.  and I don't think 
`pickAnyOf...` is really helping to simplify.  Maybe
   
   ```scala
   procDirExists.get && (
     (stageMetricLoggingEnabled && logProcfsMetrics) ||
     procFsMetricsSystemEnabled
   )
   ```
   
   
   but actually -- are any of the checks other than `procDirExists` actually 
necessary?  you're now doing those checks outside of here (which makes more 
sense, I think), no sense in repeating them here.  Now this class just needs to 
report metrics when somebody asks for them, whomever that is.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to