ankuriitg 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_r242286616
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/executor/ProcfsMetricsSource.scala
 ##########
 @@ -19,14 +19,15 @@ package org.apache.spark.executor
 
 import com.codahale.metrics.{Gauge, MetricRegistry}
 
+import org.apache.spark.SparkEnv
 import org.apache.spark.internal.config
 import org.apache.spark.metrics.source.Source
-import org.apache.spark.SparkEnv
 
 private[executor] class ProcfsMetricsSource extends Source {
   override val sourceName = "procfs"
-  override val metricRegistry = new MetricRegistry()
+  // We use numMetrics for tracking to only call computAllMetrics once per set 
of metrics
 
 Review comment:
   The reason I think this is hacky is that `getProcfsMetrics` relies on an 
internal state (`numMetrics`) to determine whether to call `computeAllMetrics` 
or not. I will prefer that `getProcfsMetrics` is a stateless method though.
   
   I understand the limitations imposed by the MetricsSystem but would still 
like you to evaluate alternate approaches. If you think this is the best way to 
achieve this, then it is fine.

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