Skip to content

Commit 086a4f6

Browse files
committed
[SPARK-24506][UI] Add UI filters also to thriftserver tab
1 parent 00c13cf commit 086a4f6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/src/main/scala/org/apache/spark/ui/WebUI.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ private[spark] abstract class WebUI(
5959
def getTabs: Seq[WebUITab] = tabs
6060
def getHandlers: Seq[ServletContextHandler] = handlers
6161
def getSecurityManager: SecurityManager = securityManager
62+
def handlersForPage(page: WebUIPage): Seq[ServletContextHandler] =
63+
pageToHandlers.getOrElse(page, Seq.empty)
6264

6365
/** Attach a tab to this UI, along with all of its attached pages. */
6466
def attachTab(tab: WebUITab) {

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/ui/ThriftServerTab.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import org.apache.spark.{SparkContext, SparkException}
2121
import org.apache.spark.internal.Logging
2222
import org.apache.spark.sql.hive.thriftserver.HiveThriftServer2
2323
import org.apache.spark.sql.hive.thriftserver.ui.ThriftServerTab._
24-
import org.apache.spark.ui.{SparkUI, SparkUITab}
24+
import org.apache.spark.ui.{JettyUtils, SparkUI, SparkUITab}
2525

2626
/**
2727
* Spark Web UI tab that shows statistics of jobs running in the thrift server.
@@ -39,6 +39,10 @@ private[thriftserver] class ThriftServerTab(sparkContext: SparkContext)
3939
attachPage(new ThriftServerSessionPage(this))
4040
parent.attachTab(this)
4141

42+
// We need to add the filters to the handlers generated here since the SparkUI has been already
43+
// started.
44+
JettyUtils.addFilters(this.pages.flatMap(parent.handlersForPage), parent.conf)
45+
4246
def detach() {
4347
getSparkUI(sparkContext).detachTab(this)
4448
}

0 commit comments

Comments
 (0)