Skip to content

Commit fb8d724

Browse files
committed
HBASE-25896 Implement a Region Visualization on Master WebUI
This is a demonstration of visualization of regions on the cluster. The visualization is a stacked bar chart showing total storefile size per table per region server, with the x-axis being server names, the y-axis being storfile size, and the bars stacked per table. The visualization is generated entirely on the fly from within the browser, implemented using Vega Lite. So far, Vega appears to handle rendering this visualization for a cluster of over 700 region servers with approximately 300,000 regions. Per [0], include an update to the top-level LICENSE.txt. Also update LICENSE files in all binary distributions (i.e., jars), by way of LICENSE.vm. Vega uses a BSD 3-clause variant without advertising clause, and as such is a "Category A" license, per [1]. No changes are made to the NOTICE files, as per the existing example of bundling the minified JQuery, which is also a Category A license. [0]: https://infra.apache.org/licensing-howto.html [1]: https://www.apache.org/legal/resolved.html#category-a
1 parent be0afbf commit fb8d724

File tree

15 files changed

+591
-2
lines changed

15 files changed

+591
-2
lines changed

LICENSE.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,3 +639,37 @@ under a '2-clause BSD' license.
639639
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
640640
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
641641
SUCH DAMAGE.
642+
643+
----
644+
This project bundles a copy of the Vega minified javascript library version
645+
5.19.1, the Vega-Lite minified javascript library version 5.0.0, and the
646+
Vega-Embed minified javascript library version 6.15.1. All three are
647+
available under the following '3-clause BSD' license.
648+
649+
Copyright (c) 2015-2018, University of Washington Interactive Data Lab
650+
All rights reserved.
651+
652+
Redistribution and use in source and binary forms, with or without
653+
modification, are permitted provided that the following conditions are met:
654+
655+
1. Redistributions of source code must retain the above copyright notice, this
656+
list of conditions and the following disclaimer.
657+
658+
2. Redistributions in binary form must reproduce the above copyright notice,
659+
this list of conditions and the following disclaimer in the documentation
660+
and/or other materials provided with the distribution.
661+
662+
3. Neither the name of the copyright holder nor the names of its contributors
663+
may be used to endorse or promote products derived from this software
664+
without specific prior written permission.
665+
666+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
667+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
668+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
669+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
670+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
671+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
672+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
673+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
674+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
675+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

hbase-assembly/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<debug-print-included-work-info>${license.debug.print.included}</debug-print-included-work-info>
5454
<bundled-dependencies>${license.bundles.dependencies}</bundled-dependencies>
5555
<bundled-jquery>${license.bundles.jquery}</bundled-jquery>
56+
<bundled-vega>${license.bundles.vega}</bundled-vega>
5657
<bundled-logo>${license.bundles.logo}</bundled-logo>
5758
<bundled-bootstrap>${license.bundles.bootstrap}</bundled-bootstrap>
5859
</properties>

hbase-http/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<debug-print-included-work-info>${license.debug.print.included}</debug-print-included-work-info>
6666
<bundled-dependencies>${license.bundles.dependencies}</bundled-dependencies>
6767
<bundled-jquery>${license.bundles.jquery}</bundled-jquery>
68+
<bundled-vega>${license.bundles.vega}</bundled-vega>
6869
<bundled-logo>${license.bundles.logo}</bundled-logo>
6970
<bundled-bootstrap>${license.bundles.bootstrap}</bundled-bootstrap>
7071
</properties>

hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,10 @@ under the License.
222222

223223
## Special cases, for e.g. ASL2.0 licensed works that bundle additional third party works
224224
#set($bundled-jquery = ${bundled-jquery.equalsIgnoreCase("true")})
225+
#set($bundled-vega = ${bundled-vega.equalsIgnoreCase("true")})
225226
#set($bundled-logo = ${bundled-logo.equalsIgnoreCase("true")})
226227
#set($bundled-dependencies = ${bundled-dependencies.equalsIgnoreCase("true")})
227-
#if($bundled-jquery || $bundled-logo || $bundled-dependencies)
228+
#if($bundled-jquery || $bundled-vega || $bundled-logo || $bundled-dependencies)
228229
====
229230
${project.name} contained works
230231

@@ -260,6 +261,40 @@ This project bundles a copy of the JQuery minified javascript library version
260261
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
261262
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
262263

264+
#end
265+
#macro(vega_license)
266+
This project bundles a copy of the Vega minified javascript library version
267+
5.19.1, the Vega-Lite minified javascript library version 5.0.0, and the
268+
Vega-Embed minified javascript library version 6.15.1. All three are
269+
available under the following '3-clause BSD' license.
270+
271+
Copyright (c) 2015-2018, University of Washington Interactive Data Lab
272+
All rights reserved.
273+
274+
Redistribution and use in source and binary forms, with or without
275+
modification, are permitted provided that the following conditions are met:
276+
277+
1. Redistributions of source code must retain the above copyright notice, this
278+
list of conditions and the following disclaimer.
279+
280+
2. Redistributions in binary form must reproduce the above copyright notice,
281+
this list of conditions and the following disclaimer in the documentation
282+
and/or other materials provided with the distribution.
283+
284+
3. Neither the name of the copyright holder nor the names of its contributors
285+
may be used to endorse or promote products derived from this software
286+
without specific prior written permission.
287+
288+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
289+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
290+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
291+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
292+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
293+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
294+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
295+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
296+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
297+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
263298
#end
264299
#macro(orca_logo_license)
265300
----
@@ -1309,6 +1344,9 @@ You can redistribute it and/or modify it under either the terms of the
13091344
#if(${bundled-jquery})
13101345
#jquery_license()
13111346
#end
1347+
#if(${bundled-vega})
1348+
#vega_license()
1349+
#end
13121350
#if(${bundled-logo})
13131351
#orca_logo_license()
13141352
#end

hbase-server/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<license.bundles.logo>true</license.bundles.logo>
3535
<license.bundles.bootstrap>true</license.bundles.bootstrap>
3636
<license.bundles.jquery>true</license.bundles.jquery>
37+
<license.bundles.vega>true</license.bundles.vega>
3738
</properties>
3839
<build>
3940
<!-- Make sure resources get added before they are processed by placing this first
@@ -100,6 +101,7 @@
100101
<debug-print-included-work-info>${license.debug.print.included}</debug-print-included-work-info>
101102
<bundled-dependencies>${license.bundles.dependencies}</bundled-dependencies>
102103
<bundled-jquery>${license.bundles.jquery}</bundled-jquery>
104+
<bundled-vega>${license.bundles.vega}</bundled-vega>
103105
<bundled-logo>${license.bundles.logo}</bundled-logo>
104106
<bundled-bootstrap>${license.bundles.bootstrap}</bundled-bootstrap>
105107
</properties>

hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
276276
</div>
277277
</div>
278278
</section>
279+
<section>
280+
<h2><a name="region_visualizer"></a>Region Visualizer</h2>
281+
<& RegionVisualizerTmpl &>
282+
</section>
279283
<section>
280284
<h2><a name="peers">Peers</a></h2>
281285
<& peerConfigs &>
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<%doc>
2+
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
</%doc>
19+
20+
<script type="text/javascript" src="/static/js/[email protected]"></script>
21+
<script type="text/javascript" src="/static/js/[email protected]"></script>
22+
<script type="text/javascript" src="/static/js/[email protected]"></script>
23+
24+
<div id="vis" style="width:80%;"></div>
25+
<script type="text/javascript">
26+
vega.expressionFunction('values', function(obj) { return Object.values(obj); });
27+
var vlSpec = {
28+
$schema: 'https://vega.github.io/schema/vega-lite/v5.json',
29+
description: 'Total `storefileSize` per Region Server',
30+
data: {
31+
name: 'region_info',
32+
url: 'http://localhost:16010/api/v1/admin/cluster_metrics/live_servers',
33+
format: { type: 'json', property: 'data' }
34+
},
35+
transform: [
36+
{ calculate: "split(datum.server_name.servername, ',', 1)[0]", as: 'server_name' },
37+
{ calculate: 'values(datum.region_status)', as: 'region_status' },
38+
{ flatten: ['region_status'] },
39+
{ calculate: "split(datum.region_status.name, ',', 1)[0]", as: 'table_name' },
40+
{ calculate: "split(datum.region_status.name, ',', 3)[2]", as: 'region_id' },
41+
],
42+
vconcat: [{
43+
title: {
44+
text: 'Total `storefileSize` per Region Server',
45+
align: 'center'
46+
},
47+
height: 250,
48+
width: 'container',
49+
mark: { type: 'bar', tooltip: true },
50+
params: [{
51+
name: 'legend_selection',
52+
select: { type: 'point', fields: ['table_name'] },
53+
bind: 'legend'
54+
}],
55+
encoding: {
56+
x: {
57+
title:'Region Server',
58+
field: 'server_name',
59+
type: 'nominal',
60+
axis: {
61+
labelAngle: 90,
62+
labelOverlap: 'greedy'
63+
},
64+
scale: { domain: { param: 'brush' } },
65+
sort: '-y'
66+
},
67+
y: {
68+
title: 'Total StoreFileSize',
69+
field: 'region_status.store_file_size',
70+
type: 'quantitative',
71+
aggregate: 'sum',
72+
format: '.4s',
73+
axis: { format: '.2s' },
74+
scale: { domainMin: 0 }
75+
},
76+
color: {
77+
field: 'table_name',
78+
type: 'nominal',
79+
title: 'Table'
80+
},
81+
opacity: {
82+
condition: { param: 'legend_selection', value: 0.9 },
83+
value: 0.2
84+
}
85+
}
86+
}, {
87+
mark: 'bar',
88+
height: 50,
89+
width: 'container',
90+
params: [{
91+
name: 'brush',
92+
select: { type: 'interval', encodings: ['x'] }
93+
}],
94+
encoding: {
95+
x: {
96+
field: 'server_name',
97+
type: 'nominal',
98+
axis: null,
99+
sort: '-y'
100+
},
101+
y: {
102+
field: 'region_status.store_file_size',
103+
aggregate: 'sum',
104+
axis: null
105+
},
106+
color: {
107+
field: 'table_name',
108+
title: 'Table'
109+
}
110+
}
111+
}]
112+
};
113+
vegaEmbed('#vis', vlSpec)
114+
.then(function(result) {
115+
//result.view.logger(vega.Debug);
116+
//console.log(result.view.data('region_info'));
117+
})
118+
.catch(console.Error);
119+
</script>

0 commit comments

Comments
 (0)