mridulm commented on a change in pull request #34749:
URL: https://github.com/apache/spark/pull/34749#discussion_r762722711



##########
File path: core/src/main/scala/org/apache/spark/metrics/ExecutorMetricType.scala
##########
@@ -137,7 +138,9 @@ case object GarbageCollectionMetrics extends 
ExecutorMetricType with Logging {
 
   override private[spark] def getMetricValues(memoryManager: MemoryManager): 
Array[Long] = {
     val gcMetrics = new Array[Long](names.length) // minorCount, minorTime, 
majorCount, majorTime
-    ManagementFactory.getGarbageCollectorMXBeans.asScala.foreach { mxBean =>
+    val mxBeans = ManagementFactory.getGarbageCollectorMXBeans.asScala
+    gcMetrics(4) = mxBeans.map(_.getCollectionTime).sum

Review comment:
       Why not simply rely on MinorGCTime + MajorGCTime instead ?
   Custom collectors are not handled in general currently in spark anyway - is 
there a reason to include them as well ?




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

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to