From 1422e79e517ca14a6b0e178f015362d2e0d413c6 Mon Sep 17 00:00:00 2001 From: zsxwing <zsxwing@gmail.com> Date: Tue, 12 May 2015 14:41:21 -0700 Subject: [PATCH] [SPARK-7406] [STREAMING] [WEBUI] Add tooltips for "Scheduling Delay", "Processing Time" and "Total Delay" Screenshots:   tdas as we discussed offline Author: zsxwing <zsxwing@gmail.com> Closes #5952 from zsxwing/SPARK-7406 and squashes the following commits: 2b004ea [zsxwing] Merge branch 'master' into SPARK-7406 e9eb506 [zsxwing] Update tooltip contents 2215b2a [zsxwing] Add tooltips for "Scheduling Delay", "Processing Time" and "Total Delay" --- .../src/main/scala/org/apache/spark/ui/UIUtils.scala | 12 +++++++----- .../apache/spark/streaming/ui/AllBatchesTable.scala | 11 ++++++++--- .../apache/spark/streaming/ui/StreamingPage.scala | 6 +++--- .../org/apache/spark/streaming/UISeleniumSuite.scala | 6 +++--- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala index 441c97d6d3..ad16becde8 100644 --- a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala +++ b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala @@ -194,11 +194,7 @@ private[spark] object UIUtils extends Logging { <a href={prependBaseUri(activeTab.basePath, "/" + tab.prefix + "/")}>{tab.name}</a> </li> } - val helpButton: Seq[Node] = helpText.map { helpText => - <sup> - (<a data-toggle="tooltip" data-placement="bottom" title={helpText}>?</a>) - </sup> - }.getOrElse(Seq.empty) + val helpButton: Seq[Node] = helpText.map(tooltip(_, "bottom")).getOrElse(Seq.empty) <html> <head> @@ -375,6 +371,12 @@ private[spark] object UIUtils extends Logging { </div> } + def tooltip(text: String, position: String): Seq[Node] = { + <sup> + (<a data-toggle="tooltip" data-placement={position} title={text}>?</a>) + </sup> + } + /** Return a script element that automatically expands the DAG visualization on page load. */ def expandDagVizOnLoad(forJob: Boolean): Seq[Node] = { <script type="text/javascript"> diff --git a/streaming/src/main/scala/org/apache/spark/streaming/ui/AllBatchesTable.scala b/streaming/src/main/scala/org/apache/spark/streaming/ui/AllBatchesTable.scala index 2960b528d4..3619e129ad 100644 --- a/streaming/src/main/scala/org/apache/spark/streaming/ui/AllBatchesTable.scala +++ b/streaming/src/main/scala/org/apache/spark/streaming/ui/AllBatchesTable.scala @@ -26,8 +26,11 @@ private[ui] abstract class BatchTableBase(tableId: String) { protected def columns: Seq[Node] = { <th>Batch Time</th> <th>Input Size</th> - <th>Scheduling Delay</th> - <th>Processing Time</th> + <th>Scheduling Delay + {SparkUIUtils.tooltip("Time taken by Streaming scheduler to submit jobs of a batch", "top")} + </th> + <th>Processing Time + {SparkUIUtils.tooltip("Time taken to process all jobs of a batch", "top")}</th> } protected def baseRow(batch: BatchUIData): Seq[Node] = { @@ -99,7 +102,9 @@ private[ui] class ActiveBatchTable( private[ui] class CompletedBatchTable(batches: Seq[BatchUIData]) extends BatchTableBase("completed-batches-table") { - override protected def columns: Seq[Node] = super.columns ++ <th>Total Delay</th> + override protected def columns: Seq[Node] = super.columns ++ + <th>Total Delay + {SparkUIUtils.tooltip("Total time taken to handle a batch", "top")}</th> override protected def renderRows: Seq[Node] = { batches.flatMap(batch => <tr>{completedBatchRow(batch)}</tr>) diff --git a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala index ecbebe5c6c..ff0f2b18dc 100644 --- a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala +++ b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala @@ -347,7 +347,7 @@ private[ui] class StreamingPage(parent: StreamingTab) <tr> <td style="vertical-align: middle;"> <div style="width: 160px;"> - <div><strong>Scheduling Delay</strong></div> + <div><strong>Scheduling Delay {SparkUIUtils.tooltip("Time taken by Streaming scheduler to submit jobs of a batch", "right")}</strong></div> <div>Avg: {schedulingDelay.formattedAvg}</div> </div> </td> @@ -357,7 +357,7 @@ private[ui] class StreamingPage(parent: StreamingTab) <tr> <td style="vertical-align: middle;"> <div style="width: 160px;"> - <div><strong>Processing Time</strong></div> + <div><strong>Processing Time {SparkUIUtils.tooltip("Time taken to process all jobs of a batch", "right")}</strong></div> <div>Avg: {processingTime.formattedAvg}</div> </div> </td> @@ -367,7 +367,7 @@ private[ui] class StreamingPage(parent: StreamingTab) <tr> <td style="vertical-align: middle;"> <div style="width: 160px;"> - <div><strong>Total Delay</strong></div> + <div><strong>Total Delay {SparkUIUtils.tooltip("Total time taken to handle a batch", "right")}</strong></div> <div>Avg: {totalDelay.formattedAvg}</div> </div> </td> diff --git a/streaming/src/test/scala/org/apache/spark/streaming/UISeleniumSuite.scala b/streaming/src/test/scala/org/apache/spark/streaming/UISeleniumSuite.scala index 2211f62383..441bbf95d0 100644 --- a/streaming/src/test/scala/org/apache/spark/streaming/UISeleniumSuite.scala +++ b/streaming/src/test/scala/org/apache/spark/streaming/UISeleniumSuite.scala @@ -116,12 +116,12 @@ class UISeleniumSuite h4Text.exists(_.matches("Completed Batches \\(last \\d+ out of \\d+\\)")) should be (true) findAll(cssSelector("""#active-batches-table th""")).map(_.text).toSeq should be { - List("Batch Time", "Input Size", "Scheduling Delay", "Processing Time", + List("Batch Time", "Input Size", "Scheduling Delay (?)", "Processing Time (?)", "Status") } findAll(cssSelector("""#completed-batches-table th""")).map(_.text).toSeq should be { - List("Batch Time", "Input Size", "Scheduling Delay", "Processing Time", - "Total Delay") + List("Batch Time", "Input Size", "Scheduling Delay (?)", "Processing Time (?)", + "Total Delay (?)") } val batchLinks = -- GitLab