squito commented on a change in pull request #24132: [SPARK-27189][CORE] Add 
Executor metrics and memory usage instrumentation to the metrics system
URL: https://github.com/apache/spark/pull/24132#discussion_r353990768
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/executor/Executor.scala
 ##########
 @@ -115,18 +115,19 @@ private[spark] class Executor(
 
   val executorMetricsSource =
     if (conf.get(METRICS_EXECUTORMETRICS_SOURCE_ENABLED)) {
-      new ExecutorMetricsSource
+      Some(new ExecutorMetricsSource)
     } else {
-      null
+      None
     }
 
   if (!isLocal) {
     env.blockManager.initialize(conf.getAppId)
     env.metricsSystem.registerSource(executorSource)
     env.metricsSystem.registerSource(new JVMCPUSource())
-    if (conf.get(METRICS_EXECUTORMETRICS_SOURCE_ENABLED)) {
-      executorMetricsSource.register
-      env.metricsSystem.registerSource(executorMetricsSource)
+    executorMetricsSource match {
+      case Some(executorMetricsSource: ExecutorMetricsSource) =>
+        executorMetricsSource.register(env.metricsSystem)
+      case None => None
 
 Review comment:
   same here

----------------------------------------------------------------
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.
 
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