This is an automated email from the ASF dual-hosted git repository. dongjoon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new 296d3c50d2b [SPARK-45804][UI] Add spark.ui.threadDump.flamegraphEnabled config to switch flame graph on/off 296d3c50d2b is described below commit 296d3c50d2b6212040836b5fe0f86d9890564dc6 Author: Kent Yao <y...@apache.org> AuthorDate: Mon Nov 6 20:06:01 2023 -0800 [SPARK-45804][UI] Add spark.ui.threadDump.flamegraphEnabled config to switch flame graph on/off ### What changes were proposed in this pull request? Add spark.ui.threadDump.flamegraphEnabled config to switch flame graph on/off ### Why are the changes needed? UI stability ### Does this PR introduce _any_ user-facing change? yes, new spark.ui.threadDump.flamegraphEnabled config ### How was this patch tested? locally tested bin/spark-shell -c spark.ui.threadDump.flamegraphEnabled=true ![image](https://github.com/apache/spark/assets/8326978/538e1991-da15-4323-a28e-63565e042804) bin/spark-shell -c spark.ui.threadDump.flamegraphEnabled=false ![image](https://github.com/apache/spark/assets/8326978/4562e359-cec3-41e5-a47e-636d5edf9ec4) ### Was this patch authored or co-authored using generative AI tooling? no Closes #43674 from yaooqinn/SPARK-45804. Authored-by: Kent Yao <y...@apache.org> Signed-off-by: Dongjoon Hyun <dh...@apple.com> --- core/src/main/scala/org/apache/spark/internal/config/UI.scala | 6 ++++++ .../org/apache/spark/ui/exec/ExecutorThreadDumpPage.scala | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/org/apache/spark/internal/config/UI.scala b/core/src/main/scala/org/apache/spark/internal/config/UI.scala index 841d2b494c0..f983308667e 100644 --- a/core/src/main/scala/org/apache/spark/internal/config/UI.scala +++ b/core/src/main/scala/org/apache/spark/internal/config/UI.scala @@ -97,6 +97,12 @@ private[spark] object UI { .booleanConf .createWithDefault(true) + val UI_FLAMEGRAPH_ENABLED = ConfigBuilder("spark.ui.threadDump.flamegraphEnabled") + .doc("Whether to render the Flamegraph for executor thread dumps") + .version("4.0.0") + .booleanConf + .createWithDefault(true) + val UI_HEAP_HISTOGRAM_ENABLED = ConfigBuilder("spark.ui.heapHistogramEnabled") .version("3.5.0") .booleanConf diff --git a/core/src/main/scala/org/apache/spark/ui/exec/ExecutorThreadDumpPage.scala b/core/src/main/scala/org/apache/spark/ui/exec/ExecutorThreadDumpPage.scala index 4a00777c509..328abdb5c5f 100644 --- a/core/src/main/scala/org/apache/spark/ui/exec/ExecutorThreadDumpPage.scala +++ b/core/src/main/scala/org/apache/spark/ui/exec/ExecutorThreadDumpPage.scala @@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletRequest import scala.xml.{Node, Text} import org.apache.spark.SparkContext +import org.apache.spark.internal.config.UI.UI_FLAMEGRAPH_ENABLED import org.apache.spark.status.api.v1.ThreadStackTrace import org.apache.spark.ui.{SparkUITab, UIUtils, WebUIPage} import org.apache.spark.ui.UIUtils.prependBaseUri @@ -31,6 +32,8 @@ private[ui] class ExecutorThreadDumpPage( parent: SparkUITab, sc: Option[SparkContext]) extends WebUIPage("threadDump") { + private val flamegraphEnabled = sc.isDefined && sc.get.conf.get(UI_FLAMEGRAPH_ENABLED) + def render(request: HttpServletRequest): Seq[Node] = { val executorId = Option(request.getParameter("executorId")).map { executorId => UIUtils.decodeURLParameter(executorId) @@ -70,7 +73,12 @@ private[ui] class ExecutorThreadDumpPage( <div class="row"> <div class="col-12"> <p>Updated at {UIUtils.formatDate(time)}</p> - {drawExecutorFlamegraph(request, threadDump)} + { if (flamegraphEnabled) { + drawExecutorFlamegraph(request, threadDump) } + else { + Seq.empty + } + } { // scalastyle:off <p></p> --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org