Skip to content
Permalink
Browse files
HBASE-25896 Implement a Region Visualization on Master WebUI (#4228)
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

Signed-off-by: Andrew Purtell <apurtell@apache.org>
  • Loading branch information
ndimiduk committed Mar 15, 2022
1 parent 2507dc1 commit c4ec5230f25f1cf7c3dfcfb6244fa2285ad268d6
Show file tree
Hide file tree
Showing 16 changed files with 592 additions and 3 deletions.
@@ -639,3 +639,37 @@ under a '2-clause BSD' license.
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

----
This project bundles a copy of the Vega minified javascript library version
5.19.1, the Vega-Lite minified javascript library version 5.0.0, and the
Vega-Embed minified javascript library version 6.15.1. All three are
available under the following '3-clause BSD' license.

Copyright (c) 2015-2018, University of Washington Interactive Data Lab
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -53,6 +53,7 @@
<debug-print-included-work-info>${license.debug.print.included}</debug-print-included-work-info>
<bundled-dependencies>${license.bundles.dependencies}</bundled-dependencies>
<bundled-jquery>${license.bundles.jquery}</bundled-jquery>
<bundled-vega>${license.bundles.vega}</bundled-vega>
<bundled-logo>${license.bundles.logo}</bundled-logo>
<bundled-bootstrap>${license.bundles.bootstrap}</bundled-bootstrap>
</properties>
@@ -65,6 +65,7 @@
<debug-print-included-work-info>${license.debug.print.included}</debug-print-included-work-info>
<bundled-dependencies>${license.bundles.dependencies}</bundled-dependencies>
<bundled-jquery>${license.bundles.jquery}</bundled-jquery>
<bundled-vega>${license.bundles.vega}</bundled-vega>
<bundled-logo>${license.bundles.logo}</bundled-logo>
<bundled-bootstrap>${license.bundles.bootstrap}</bundled-bootstrap>
</properties>
@@ -222,9 +222,10 @@ under the License.

## Special cases, for e.g. ASL2.0 licensed works that bundle additional third party works
#set($bundled-jquery = ${bundled-jquery.equalsIgnoreCase("true")})
#set($bundled-vega = ${bundled-vega.equalsIgnoreCase("true")})
#set($bundled-logo = ${bundled-logo.equalsIgnoreCase("true")})
#set($bundled-dependencies = ${bundled-dependencies.equalsIgnoreCase("true")})
#if($bundled-jquery || $bundled-logo || $bundled-dependencies)
#if($bundled-jquery || $bundled-vega || $bundled-logo || $bundled-dependencies)
====
${project.name} contained works

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

#end
#macro(vega_license)
This project bundles a copy of the Vega minified javascript library version
5.19.1, the Vega-Lite minified javascript library version 5.0.0, and the
Vega-Embed minified javascript library version 6.15.1. All three are
available under the following '3-clause BSD' license.

Copyright (c) 2015-2018, University of Washington Interactive Data Lab
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#end
#macro(orca_logo_license)
----
@@ -1309,6 +1344,9 @@ You can redistribute it and/or modify it under either the terms of the
#if(${bundled-jquery})
#jquery_license()
#end
#if(${bundled-vega})
#vega_license()
#end
#if(${bundled-logo})
#orca_logo_license()
#end
@@ -34,6 +34,7 @@
<license.bundles.logo>true</license.bundles.logo>
<license.bundles.bootstrap>true</license.bundles.bootstrap>
<license.bundles.jquery>true</license.bundles.jquery>
<license.bundles.vega>true</license.bundles.vega>
</properties>
<build>
<!-- Make sure resources get added before they are processed by placing this first
@@ -100,6 +101,7 @@
<debug-print-included-work-info>${license.debug.print.included}</debug-print-included-work-info>
<bundled-dependencies>${license.bundles.dependencies}</bundled-dependencies>
<bundled-jquery>${license.bundles.jquery}</bundled-jquery>
<bundled-vega>${license.bundles.vega}</bundled-vega>
<bundled-logo>${license.bundles.logo}</bundled-logo>
<bundled-bootstrap>${license.bundles.bootstrap}</bundled-bootstrap>
</properties>
@@ -276,6 +276,10 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
</div>
</div>
</section>
<section>
<h2><a name="region_visualizer"></a>Region Visualizer</h2>
<& RegionVisualizerTmpl &>
</section>
<section>
<h2><a name="peers">Peers</a></h2>
<& peerConfigs &>
@@ -0,0 +1,119 @@
<%doc>

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</%doc>

<script type="text/javascript" src="/static/js/vega@5.19.1.min.js"></script>
<script type="text/javascript" src="/static/js/vega-lite@5.0.0.min.js"></script>
<script type="text/javascript" src="/static/js/vega-embed@6.15.1.min.js"></script>

<div id="vis" style="width:80%;"></div>
<script type="text/javascript">
vega.expressionFunction('values', function(obj) { return Object.values(obj); });
var vlSpec = {
$schema: 'https://vega.github.io/schema/vega-lite/v5.json',
description: 'Total `storefileSize` per Region Server',
data: {
name: 'region_info',
url: 'http://localhost:16010/api/v1/admin/cluster_metrics/live_servers',
format: { type: 'json', property: 'data' }
},
transform: [
{ calculate: "split(datum.server_name.servername, ',', 1)[0]", as: 'server_name' },
{ calculate: 'values(datum.region_status)', as: 'region_status' },
{ flatten: ['region_status'] },
{ calculate: "split(datum.region_status.name, ',', 1)[0]", as: 'table_name' },
{ calculate: "split(datum.region_status.name, ',', 3)[2]", as: 'region_id' },
],
vconcat: [{
title: {
text: 'Total `storefileSize` per Region Server',
align: 'center'
},
height: 250,
width: 'container',
mark: { type: 'bar', tooltip: true },
params: [{
name: 'legend_selection',
select: { type: 'point', fields: ['table_name'] },
bind: 'legend'
}],
encoding: {
x: {
title:'Region Server',
field: 'server_name',
type: 'nominal',
axis: {
labelAngle: 90,
labelOverlap: 'greedy'
},
scale: { domain: { param: 'brush' } },
sort: '-y'
},
y: {
title: 'Total StoreFileSize',
field: 'region_status.store_file_size',
type: 'quantitative',
aggregate: 'sum',
format: '.4s',
axis: { format: '.2s' },
scale: { domainMin: 0 }
},
color: {
field: 'table_name',
type: 'nominal',
title: 'Table'
},
opacity: {
condition: { param: 'legend_selection', value: 0.9 },
value: 0.2
}
}
}, {
mark: 'bar',
height: 50,
width: 'container',
params: [{
name: 'brush',
select: { type: 'interval', encodings: ['x'] }
}],
encoding: {
x: {
field: 'server_name',
type: 'nominal',
axis: null,
sort: '-y'
},
y: {
field: 'region_status.store_file_size',
aggregate: 'sum',
axis: null
},
color: {
field: 'table_name',
title: 'Table'
}
}
}]
};
vegaEmbed('#vis', vlSpec)
.then(function(result) {
//result.view.logger(vega.Debug);
//console.log(result.view.data('region_info'));
})
.catch(console.Error);
</script>

0 comments on commit c4ec523

Please sign in to comment.