Skip to content

Commit 39fff92

Browse files
iRaksonsrowen
authored andcommitted
[SPARK-29452][WEBUI] Improve Storage tab tooltip
### What changes were proposed in this pull request? Added Tootips for each column in storage tab of Web UI. ### Why are the changes needed? Tooltips will help users in understanding columns of storage tabs. ### Does this PR introduce any user-facing change? Yes ### How was this patch tested? Manually Tested. Closes apache#26226 from iRakson/storage_tooltip. Authored-by: root1 <[email protected]> Signed-off-by: Sean Owen <[email protected]>
1 parent f53be0a commit 39fff92

File tree

3 files changed

+71
-2
lines changed

3 files changed

+71
-2
lines changed

core/src/main/scala/org/apache/spark/ui/storage/StoragePage.scala

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import scala.xml.Node
2525
import org.apache.spark.status.{AppStatusStore, StreamBlockData}
2626
import org.apache.spark.status.api.v1
2727
import org.apache.spark.ui._
28+
import org.apache.spark.ui.storage.ToolTips._
2829
import org.apache.spark.util.Utils
2930

3031
/** Page showing list of RDD's currently stored in the cluster */
@@ -56,7 +57,8 @@ private[ui] class StoragePage(parent: SparkUITab, store: AppStatusStore) extends
5657
rddHeader,
5758
rddRow(request, _: v1.RDDStorageInfo),
5859
rdds,
59-
id = Some("storage-by-rdd-table"))}
60+
id = Some("storage-by-rdd-table"),
61+
tooltipHeaders = tooltips)}
6062
</div>
6163
</div>
6264
}
@@ -72,6 +74,16 @@ private[ui] class StoragePage(parent: SparkUITab, store: AppStatusStore) extends
7274
"Size in Memory",
7375
"Size on Disk")
7476

77+
/** Tooltips for header fields of the RDD table */
78+
val tooltips = Seq(
79+
None,
80+
Some(RDD_NAME),
81+
Some(STORAGE_LEVEL),
82+
Some(CACHED_PARTITIONS),
83+
Some(FRACTION_CACHED),
84+
Some(SIZE_IN_MEMORY),
85+
Some(SIZE_ON_DISK))
86+
7587
/** Render an HTML row representing an RDD */
7688
private def rddRow(request: HttpServletRequest, rdd: v1.RDDStorageInfo): Seq[Node] = {
7789
// scalastyle:off
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.spark.ui.storage
19+
20+
private[ui] object ToolTips {
21+
22+
val RDD_NAME =
23+
"Name of the persisted RDD"
24+
25+
val STORAGE_LEVEL =
26+
"StorageLevel displays where the persisted RDD is stored, " +
27+
"format of the persisted RDD (serialized or de-serialized) and" +
28+
"replication factor of the persisted RDD"
29+
30+
val CACHED_PARTITIONS =
31+
"Number of partitions cached"
32+
33+
val FRACTION_CACHED =
34+
"Fraction of total partitions cached"
35+
36+
val SIZE_IN_MEMORY =
37+
"Total size of partitions in memory"
38+
39+
val SIZE_ON_DISK =
40+
"Total size of partitions on the disk"
41+
}
42+

core/src/test/scala/org/apache/spark/ui/storage/StoragePageSuite.scala

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package org.apache.spark.ui.storage
2020
import javax.servlet.http.HttpServletRequest
2121

2222
import org.mockito.Mockito._
23+
import scala.xml.{Node, Text}
2324

2425
import org.apache.spark.SparkFunSuite
2526
import org.apache.spark.status.StreamBlockData
@@ -74,7 +75,21 @@ class StoragePageSuite extends SparkFunSuite {
7475
"Fraction Cached",
7576
"Size in Memory",
7677
"Size on Disk")
77-
assert((xmlNodes \\ "th").map(_.text) === headers)
78+
79+
val headerRow: Seq[Node] = {
80+
headers.view.zipWithIndex.map { x =>
81+
storagePage.tooltips(x._2) match {
82+
case Some(tooltip) =>
83+
<th width={""} class={""}>
84+
<span data-toggle="tooltip" title={tooltip}>
85+
{Text(x._1)}
86+
</span>
87+
</th>
88+
case None => <th width={""} class={""}>{Text(x._1)}</th>
89+
}
90+
}.toList
91+
}
92+
assert((xmlNodes \\ "th").map(_.text) === headerRow.map(_.text))
7893

7994
assert((xmlNodes \\ "tr").size === 3)
8095
assert(((xmlNodes \\ "tr")(0) \\ "td").map(_.text.trim) ===

0 commit comments

Comments
 (0)