-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-25865][CORE] Add GC information to ExecutorMetrics #22874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
6ad48d6
b8c3382
098a246
1dbc68a
94fd962
e4d9acd
aa3cf3c
544749d
fe5a04c
12fc5cc
6d5643c
4d1021c
ba500fe
958a728
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,6 +103,8 @@ case object ProcessTreeMetrics extends ExecutorMetricType { | |
| } | ||
|
|
||
| case object GarbageCollectionMetrics extends ExecutorMetricType with Logging { | ||
| private var nonBuiltInCollectors: Seq[String] = Nil | ||
|
|
||
| override val names = Seq( | ||
| "MinorGCCount", | ||
| "MinorGCTime", | ||
|
|
@@ -135,17 +137,21 @@ 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 => | ||
| ManagementFactory.getGarbageCollectorMXBeans.asScala.foreach { mxBean => | ||
| if (youngGenerationGarbageCollector.contains(mxBean.getName)) { | ||
| gcMetrics(0) = mxBean.getCollectionCount | ||
| gcMetrics(1) = mxBean.getCollectionTime | ||
| } else if (oldGenerationGarbageCollector.contains(mxBean.getName)) { | ||
| gcMetrics(2) = mxBean.getCollectionCount | ||
| gcMetrics(3) = mxBean.getCollectionTime | ||
| } else { | ||
| logDebug(s"${mxBean.getName} is an unsupported garbage collector." + | ||
| s"Add it to ${config.EVENT_LOG_GC_METRICS_YOUNG_GENERATION_GARBAGE_COLLECTORS.key} " + | ||
| } else if (!nonBuiltInCollectors.contains(mxBean.getName)) { | ||
| nonBuiltInCollectors = mxBean.getName +: nonBuiltInCollectors | ||
| // log it when first seen | ||
| logWarning(s"Add the non-built-in garbage collector(s) $nonBuiltInCollectors " + | ||
|
||
| s"to ${config.EVENT_LOG_GC_METRICS_YOUNG_GENERATION_GARBAGE_COLLECTORS.key} " + | ||
| s"or ${config.EVENT_LOG_GC_METRICS_OLD_GENERATION_GARBAGE_COLLECTORS.key} to enable.") | ||
| } else { | ||
| // do nothing | ||
| } | ||
| } | ||
| gcMetrics | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it ever possible that multiple collectors are considered young generation (or old generation)? If so, you'd want to use
+=here.I'm not sure if there is a configuration where that might happen, but I'm also not super familiar with all variants here. @kiszk maybe you know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, one collector per generation is supported only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being late. I agree with one collector per generation.