Skip to content

Commit 25930ed

Browse files
committed
Backport "HBASE-20693 Refactor thrift jsp's and extract header and footer (apache#5732)" and Backport "HBASE-18382 add transport type info into Thrift UI (apache#880)" to branch-2
1 parent b07326b commit 25930ed

3 files changed

Lines changed: 175 additions & 108 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<%--
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+
*/
19+
--%>
20+
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
21+
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
22+
<script src="/static/js/tab.js" type="text/javascript"></script>
23+
<script type="text/javascript">
24+
$(document).ready(function() {
25+
$('li.active').removeClass('active');
26+
$('a[href="' + location.pathname + '"]').closest('li').addClass('active');
27+
});
28+
</script>
29+
</body>
30+
</html>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<%--
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+
*/
19+
--%>
20+
<%@ page contentType="text/html;charset=UTF-8"
21+
import="org.apache.hadoop.hbase.HBaseConfiguration"%>
22+
23+
<!DOCTYPE html>
24+
<?xml version="1.0" encoding="UTF-8" ?>
25+
<html lang="en">
26+
<head>
27+
<meta charset="utf-8">
28+
<title><%= request.getParameter("pageTitle")%></title>
29+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
30+
<meta name="description" content="">
31+
32+
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
33+
<link href="/static/css/bootstrap-theme.min.css" rel="stylesheet">
34+
<link href="/static/css/hbase.css" rel="stylesheet">
35+
</head>
36+
37+
<body>
38+
<div class="navbar navbar-fixed-top navbar-default">
39+
<div class="container-fluid">
40+
<div class="navbar-header">
41+
<button type="button"
42+
class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
43+
<span class="icon-bar"></span>
44+
<span class="icon-bar"></span>
45+
<span class="icon-bar"></span>
46+
</button>
47+
<a class="navbar-brand" href="/thrift.jsp">
48+
<img src="/static/hbase_logo_small.png" alt="HBase Logo"/>
49+
</a>
50+
</div>
51+
<div class="collapse navbar-collapse">
52+
<ul class="nav navbar-nav">
53+
<li class="active"><a href="/thrift.jsp">Home</a></li>
54+
<li><a href="/logs/">Local logs</a></li>
55+
<li><a href="/logLevel">Log Level</a></li>
56+
<li class="nav-item dropdown">
57+
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
58+
Metrics <span class="caret"></span>
59+
</a>
60+
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
61+
<li><a target="_blank" href="/jmx">JMX</a></li>
62+
<li><a target="_blank" href="/jmx?description=true">JMX with description</a></li>
63+
<li><a target="_blank" href="/prometheus">Prometheus</a></li>
64+
<li><a target="_blank" href="/prometheus?description=true">Prometheus with description</a></li>
65+
</ul>
66+
</li>
67+
<li><a href="/prof">Profiler</a></li>
68+
<% if (HBaseConfiguration.isShowConfInServlet()) { %>
69+
<li><a href="/conf">HBase Configuration</a></li>
70+
<% } %>
71+
</ul>
72+
</div><!--/.nav-collapse -->
73+
</div>
74+
</div>

hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp

Lines changed: 71 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -18,141 +18,104 @@
1818
*/
1919
--%>
2020
<%@ page contentType="text/html;charset=UTF-8"
21-
import="org.apache.hadoop.conf.Configuration"
22-
import="org.apache.hadoop.hbase.HBaseConfiguration"
23-
import="org.apache.hadoop.hbase.util.VersionInfo"
24-
import="java.util.Date"
21+
import="org.apache.hadoop.conf.Configuration"
22+
import="org.apache.hadoop.hbase.util.VersionInfo"
23+
import="java.util.Date"
2524
%>
2625
<%@ page import="org.apache.hadoop.hbase.thrift.ImplType" %>
2726
<%@ page import="org.apache.hadoop.hbase.util.JvmVersion" %>
2827

2928
<%
30-
Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf");
31-
String serverType = (String)getServletContext().getAttribute("hbase.thrift.server.type");
32-
long startcode = conf.getLong("startcode", System.currentTimeMillis());
33-
String listenPort = conf.get("hbase.regionserver.thrift.port", "9090");
34-
ImplType implType = ImplType.getServerImpl(conf);
35-
String framed = implType.isAlwaysFramed()
36-
? "true" : conf.get("hbase.regionserver.thrift.framed", "false");
37-
String compact = conf.get("hbase.regionserver.thrift.compact", "false");
38-
%>
39-
<!DOCTYPE html>
40-
<?xml version="1.0" encoding="UTF-8" ?>
41-
<html lang="en">
42-
<head>
43-
<meta charset="utf-8">
44-
<title>HBase Thrift Server: <%= listenPort %></title>
45-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
46-
<meta name="description" content="">
29+
Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf");
30+
String serverType = (String)getServletContext().getAttribute("hbase.thrift.server.type");
31+
long startcode = conf.getLong("startcode", System.currentTimeMillis());
32+
String listenPort = conf.get("hbase.regionserver.thrift.port", "9090");
33+
ImplType implType = ImplType.getServerImpl(conf);
4734
48-
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
49-
<link href="/static/css/bootstrap-theme.min.css" rel="stylesheet">
50-
<link href="/static/css/hbase.css" rel="stylesheet">
51-
</head>
35+
String transport =
36+
(implType.isAlwaysFramed() ||
37+
conf.getBoolean("hbase.regionserver.thrift.framed", false)) ? "Framed" : "Standard";
38+
String protocol =
39+
conf.getBoolean("hbase.regionserver.thrift.compact", false) ? "Compact" : "Binary";
40+
String qop = conf.get("hbase.thrift.security.qop", "None");
5241
53-
<body>
54-
<div class="navbar navbar-fixed-top navbar-default">
55-
<div class="container-fluid">
56-
<div class="navbar-header">
57-
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
58-
<span class="icon-bar"></span>
59-
<span class="icon-bar"></span>
60-
<span class="icon-bar"></span>
61-
</button>
62-
<a class="navbar-brand" href="/thrift.jsp"><img src="/static/hbase_logo_small.png" alt="HBase Logo"/></a>
63-
</div>
64-
<div class="collapse navbar-collapse">
65-
<ul class="nav navbar-nav">
66-
<li class="active"><a href="/">Home</a></li>
67-
<li><a href="/logs/">Local logs</a></li>
68-
<li><a href="/logLevel">Log Level</a></li>
69-
<li class="nav-item dropdown">
70-
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
71-
Metrics <span class="caret"></span>
72-
</a>
73-
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
74-
<li><a target="_blank" href="/jmx">JMX</a></li>
75-
<li><a target="_blank" href="/jmx?description=true">JMX with description</a></li>
76-
<li><a target="_blank" href="/prometheus">Prometheus</a></li>
77-
<li><a target="_blank" href="/prometheus?description=true">Prometheus with description</a></li>
78-
</ul>
79-
</li>
80-
<li><a href="/prof">Profiler</a></li>
81-
<% if (HBaseConfiguration.isShowConfInServlet()) { %>
82-
<li><a href="/conf">HBase Configuration</a></li>
83-
<% } %>
84-
</ul>
85-
</div><!--/.nav-collapse -->
86-
</div>
87-
</div>
42+
pageContext.setAttribute("pageTitle", "HBase Thrift Server: " + listenPort);
43+
%>
44+
45+
<jsp:include page="header.jsp">
46+
<jsp:param name="pageTitle" value="${pageTitle}"/>
47+
</jsp:include>
8848

8949
<div class="container-fluid content">
90-
<div class="row inner_header">
91-
<div class="page-header">
92-
<h1>ThriftServer <small><%= listenPort %></small></h1>
93-
</div>
50+
<div class="row inner_header">
51+
<div class="page-header">
52+
<h1>ThriftServer <small><%= listenPort %></small></h1>
9453
</div>
95-
<div class="row">
54+
</div>
55+
<div class="row">
9656

9757
<section>
98-
<h2>Software Attributes</h2>
99-
<table id="attributes_table" class="table table-striped">
58+
<h2>Software Attributes</h2>
59+
<table id="attributes_table" class="table table-striped">
60+
<tr>
61+
<th>Attribute Name</th>
62+
<th>Value</th>
63+
<th>Description</th>
64+
</tr>
65+
<tr>
66+
<td>JVM Version</td>
67+
<td><%= JvmVersion.getVersion() %></td>
68+
<td>JVM vendor and version information</td>
69+
</tr>
10070
<tr>
101-
<th>Attribute Name</th>
102-
<th>Value</th>
103-
<th>Description</th>
71+
<td>HBase Version</td>
72+
<td><%= VersionInfo.getVersion() %>, r<%= VersionInfo.getRevision() %></td>
73+
<td>HBase version and revision</td>
10474
</tr>
105-
<tr>
106-
<td>JVM Version</td>
107-
<td><%= JvmVersion.getVersion() %></td>
108-
<td>JVM vendor and version information</td>
109-
</tr>
11075
<tr>
111-
<td>HBase Version</td>
112-
<td><%= VersionInfo.getVersion() %>, r<%= VersionInfo.getRevision() %></td>
113-
<td>HBase version and revision</td>
76+
<td>HBase Compiled</td>
77+
<td><%= VersionInfo.getDate() %>, <%= VersionInfo.getUser() %></td>
78+
<td>When HBase version was compiled and by whom</td>
11479
</tr>
11580
<tr>
116-
<td>HBase Compiled</td>
117-
<td><%= VersionInfo.getDate() %>, <%= VersionInfo.getUser() %></td>
118-
<td>When HBase version was compiled and by whom</td>
81+
<td>Thrift Server Start Time</td>
82+
<td><%= new Date(startcode) %></td>
83+
<td>Date stamp of when this Thrift server was started</td>
11984
</tr>
12085
<tr>
121-
<td>Thrift Server Start Time</td>
122-
<td><%= new Date(startcode) %></td>
123-
<td>Date stamp of when this Thrift server was started</td>
86+
<td>Thrift Impl Type</td>
87+
<td><%= implType.getOption() %></td>
88+
<td>Thrift RPC engine implementation type chosen by this Thrift server</td>
12489
</tr>
12590
<tr>
126-
<td>Thrift Impl Type</td>
127-
<td><%= implType.getOption() %></td>
128-
<td>Thrift RPC engine implementation type chosen by this Thrift server</td>
91+
<td>Protocol</td>
92+
<td><%= protocol %></td>
93+
<td>Thrift RPC engine protocol type</td>
12994
</tr>
13095
<tr>
131-
<td>Compact Protocol</td>
132-
<td><%= compact %></td>
133-
<td>Thrift RPC engine uses compact protocol</td>
96+
<td>Transport</td>
97+
<td><%= transport %></td>
98+
<td>Thrift RPC engine transport type</td>
13499
</tr>
135100
<tr>
136-
<td>Framed Transport</td>
137-
<td><%= framed %></td>
138-
<td>Thrift RPC engine uses framed transport</td>
101+
<td>Thrift Server Type</td>
102+
<td><%= serverType %></td>
103+
<td>The type of this Thrift server</td>
139104
</tr>
140105
<tr>
141-
<td>Thrift Server Type</td>
142-
<td><%= serverType %></td>
143-
<td>The type of this Thrift server</td>
106+
<td>Quality of Protection</td>
107+
<td><%= qop %></td>
108+
<td>QOP Settings for SASL</td>
144109
</tr>
145-
</table>
110+
</table>
146111
</section>
147-
</div>
148-
<div class="row">
149-
<section>
150-
<a href="http://hbase.apache.org/book.html#_thrift">Apache HBase Reference Guide chapter on Thrift</a>
151-
</section>
152-
</div>
112+
</div>
113+
<div class="row">
114+
<section>
115+
<a href="http://hbase.apache.org/book.html#_thrift">
116+
Apache HBase Reference Guide chapter on Thrift</a>
117+
</section>
118+
</div>
153119
</div>
154-
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
155-
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
156-
<script src="/static/js/tab.js" type="text/javascript"></script>
157-
</body>
158-
</html>
120+
121+
<jsp:include page="footer.jsp" />

0 commit comments

Comments
 (0)