Skip to content

Commit

Permalink
[KYUUBI-2484] Add conf to SessionEvent and display it in EngineSessio…
Browse files Browse the repository at this point in the history
…nPage
  • Loading branch information
wForget committed Apr 26, 2022
1 parent 6187321 commit 5c3bb30
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ case class SessionEvent(
username: String,
ip: String,
serverIp: String,
conf: Map[String, String],
startTime: Long,
var endTime: Long = -1L,
var totalOperations: Int = 0) extends KyuubiEvent with SparkListenerEvent {
Expand Down Expand Up @@ -70,6 +71,7 @@ object SessionEvent {
session.user,
session.ipAddress,
session.serverIpAddress,
session.conf,
session.createTime)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletRequest
import scala.xml.Node

import org.apache.spark.internal.Logging
import org.apache.spark.internal.config.SECRET_REDACTION_PATTERN
import org.apache.spark.ui.UIUtils._
import org.apache.spark.util.Utils

Expand All @@ -31,6 +32,10 @@ case class EngineSessionPage(parent: EngineTab)
extends WebUIPage("session") with Logging {
val store = parent.store

private def propertyHeader = Seq("Name", "Value")
private def headerClasses = Seq("sorttable_alpha", "sorttable_alpha")
private def propertyRow(kv: (String, String)) = <tr><td>{kv._1}</td><td>{kv._2}</td></tr>

/** Render the page */
def render(request: HttpServletRequest): Seq[Node] = {
val parameterId = request.getParameter("id")
Expand All @@ -40,6 +45,34 @@ case class EngineSessionPage(parent: EngineTab)
val sessionStat = store.getSession(parameterId).getOrElse(null)
require(sessionStat != null, "Invalid sessionID[" + parameterId + "]")

val redactionPattern = parent.sparkUI match {
case Some(ui) => Some(ui.conf.get(SECRET_REDACTION_PATTERN))
case None => SECRET_REDACTION_PATTERN.defaultValue
}

val sessionPropertiesTable =
if (sessionStat.conf != null && !sessionStat.conf.isEmpty) {
val table = UIUtils.listingTable(
propertyHeader,
propertyRow,
Utils.redact(redactionPattern, sessionStat.conf.toArray),
fixedWidth = true,
headerClasses = headerClasses)
<span class="collapse-aggregated-kyuubiSessioinProperties collapse-table"
onClick="collapseTable('collapse-aggregated-kyuubiSessioinProperties',
'aggregated-kyuubiSessioinProperties')">
<h4>
<span class="collapse-table-arrow arrow-open"></span>
<a>Session Properties</a>
</h4>
</span>
<div class="aggregated-kyuubiSessioinProperties collapsible-table">
{table}
</div>
} else {
Seq()
}

generateBasicStats() ++
<br/> ++
<h4>
Expand All @@ -49,6 +82,7 @@ case class EngineSessionPage(parent: EngineTab)
Session created at {formatDate(sessionStat.startTime)},
Total run {sessionStat.totalOperations} SQL
</h4> ++
sessionPropertiesTable ++
generateSQLStatsTable(request, sessionStat.sessionId)
}
UIUtils.headerSparkPage(request, parent.name + " Session", content, parent)
Expand Down

0 comments on commit 5c3bb30

Please sign in to comment.