Skip to content

Commit

Permalink
Backport "HBASE-20693 Refactor thrift jsp's and extract header and fo…
Browse files Browse the repository at this point in the history
…oter (apache#5732)" and Backport "HBASE-18382 add transport type info into Thrift UI (apache#880)" to branch-2
  • Loading branch information
NihalJain committed Mar 1, 2024
1 parent b07326b commit 25930ed
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 108 deletions.
30 changes: 30 additions & 0 deletions hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<%--
/**
* 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.
*/
--%>
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/static/js/tab.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('li.active').removeClass('active');
$('a[href="' + location.pathname + '"]').closest('li').addClass('active');
});
</script>
</body>
</html>
74 changes: 74 additions & 0 deletions hbase-thrift/src/main/resources/hbase-webapps/thrift/header.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<%--
/**
* 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.
*/
--%>
<%@ page contentType="text/html;charset=UTF-8"
import="org.apache.hadoop.hbase.HBaseConfiguration"%>

<!DOCTYPE html>
<?xml version="1.0" encoding="UTF-8" ?>
<html lang="en">
<head>
<meta charset="utf-8">
<title><%= request.getParameter("pageTitle")%></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">

<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/css/bootstrap-theme.min.css" rel="stylesheet">
<link href="/static/css/hbase.css" rel="stylesheet">
</head>

<body>
<div class="navbar navbar-fixed-top navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button"
class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/thrift.jsp">
<img src="/static/hbase_logo_small.png" alt="HBase Logo"/>
</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="/thrift.jsp">Home</a></li>
<li><a href="/logs/">Local logs</a></li>
<li><a href="/logLevel">Log Level</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Metrics <span class="caret"></span>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a target="_blank" href="/jmx">JMX</a></li>
<li><a target="_blank" href="/jmx?description=true">JMX with description</a></li>
<li><a target="_blank" href="/prometheus">Prometheus</a></li>
<li><a target="_blank" href="/prometheus?description=true">Prometheus with description</a></li>
</ul>
</li>
<li><a href="/prof">Profiler</a></li>
<% if (HBaseConfiguration.isShowConfInServlet()) { %>
<li><a href="/conf">HBase Configuration</a></li>
<% } %>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
179 changes: 71 additions & 108 deletions hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,141 +18,104 @@
*/
--%>
<%@ page contentType="text/html;charset=UTF-8"
import="org.apache.hadoop.conf.Configuration"
import="org.apache.hadoop.hbase.HBaseConfiguration"
import="org.apache.hadoop.hbase.util.VersionInfo"
import="java.util.Date"
import="org.apache.hadoop.conf.Configuration"
import="org.apache.hadoop.hbase.util.VersionInfo"
import="java.util.Date"
%>
<%@ page import="org.apache.hadoop.hbase.thrift.ImplType" %>
<%@ page import="org.apache.hadoop.hbase.util.JvmVersion" %>

<%
Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf");
String serverType = (String)getServletContext().getAttribute("hbase.thrift.server.type");
long startcode = conf.getLong("startcode", System.currentTimeMillis());
String listenPort = conf.get("hbase.regionserver.thrift.port", "9090");
ImplType implType = ImplType.getServerImpl(conf);
String framed = implType.isAlwaysFramed()
? "true" : conf.get("hbase.regionserver.thrift.framed", "false");
String compact = conf.get("hbase.regionserver.thrift.compact", "false");
%>
<!DOCTYPE html>
<?xml version="1.0" encoding="UTF-8" ?>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HBase Thrift Server: <%= listenPort %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf");
String serverType = (String)getServletContext().getAttribute("hbase.thrift.server.type");
long startcode = conf.getLong("startcode", System.currentTimeMillis());
String listenPort = conf.get("hbase.regionserver.thrift.port", "9090");
ImplType implType = ImplType.getServerImpl(conf);
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/css/bootstrap-theme.min.css" rel="stylesheet">
<link href="/static/css/hbase.css" rel="stylesheet">
</head>
String transport =
(implType.isAlwaysFramed() ||
conf.getBoolean("hbase.regionserver.thrift.framed", false)) ? "Framed" : "Standard";
String protocol =
conf.getBoolean("hbase.regionserver.thrift.compact", false) ? "Compact" : "Binary";
String qop = conf.get("hbase.thrift.security.qop", "None");
<body>
<div class="navbar navbar-fixed-top navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/thrift.jsp"><img src="/static/hbase_logo_small.png" alt="HBase Logo"/></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="/">Home</a></li>
<li><a href="/logs/">Local logs</a></li>
<li><a href="/logLevel">Log Level</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Metrics <span class="caret"></span>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a target="_blank" href="/jmx">JMX</a></li>
<li><a target="_blank" href="/jmx?description=true">JMX with description</a></li>
<li><a target="_blank" href="/prometheus">Prometheus</a></li>
<li><a target="_blank" href="/prometheus?description=true">Prometheus with description</a></li>
</ul>
</li>
<li><a href="/prof">Profiler</a></li>
<% if (HBaseConfiguration.isShowConfInServlet()) { %>
<li><a href="/conf">HBase Configuration</a></li>
<% } %>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
pageContext.setAttribute("pageTitle", "HBase Thrift Server: " + listenPort);
%>

<jsp:include page="header.jsp">
<jsp:param name="pageTitle" value="${pageTitle}"/>
</jsp:include>

<div class="container-fluid content">
<div class="row inner_header">
<div class="page-header">
<h1>ThriftServer <small><%= listenPort %></small></h1>
</div>
<div class="row inner_header">
<div class="page-header">
<h1>ThriftServer <small><%= listenPort %></small></h1>
</div>
<div class="row">
</div>
<div class="row">

<section>
<h2>Software Attributes</h2>
<table id="attributes_table" class="table table-striped">
<h2>Software Attributes</h2>
<table id="attributes_table" class="table table-striped">
<tr>
<th>Attribute Name</th>
<th>Value</th>
<th>Description</th>
</tr>
<tr>
<td>JVM Version</td>
<td><%= JvmVersion.getVersion() %></td>
<td>JVM vendor and version information</td>
</tr>
<tr>
<th>Attribute Name</th>
<th>Value</th>
<th>Description</th>
<td>HBase Version</td>
<td><%= VersionInfo.getVersion() %>, r<%= VersionInfo.getRevision() %></td>
<td>HBase version and revision</td>
</tr>
<tr>
<td>JVM Version</td>
<td><%= JvmVersion.getVersion() %></td>
<td>JVM vendor and version information</td>
</tr>
<tr>
<td>HBase Version</td>
<td><%= VersionInfo.getVersion() %>, r<%= VersionInfo.getRevision() %></td>
<td>HBase version and revision</td>
<td>HBase Compiled</td>
<td><%= VersionInfo.getDate() %>, <%= VersionInfo.getUser() %></td>
<td>When HBase version was compiled and by whom</td>
</tr>
<tr>
<td>HBase Compiled</td>
<td><%= VersionInfo.getDate() %>, <%= VersionInfo.getUser() %></td>
<td>When HBase version was compiled and by whom</td>
<td>Thrift Server Start Time</td>
<td><%= new Date(startcode) %></td>
<td>Date stamp of when this Thrift server was started</td>
</tr>
<tr>
<td>Thrift Server Start Time</td>
<td><%= new Date(startcode) %></td>
<td>Date stamp of when this Thrift server was started</td>
<td>Thrift Impl Type</td>
<td><%= implType.getOption() %></td>
<td>Thrift RPC engine implementation type chosen by this Thrift server</td>
</tr>
<tr>
<td>Thrift Impl Type</td>
<td><%= implType.getOption() %></td>
<td>Thrift RPC engine implementation type chosen by this Thrift server</td>
<td>Protocol</td>
<td><%= protocol %></td>
<td>Thrift RPC engine protocol type</td>
</tr>
<tr>
<td>Compact Protocol</td>
<td><%= compact %></td>
<td>Thrift RPC engine uses compact protocol</td>
<td>Transport</td>
<td><%= transport %></td>
<td>Thrift RPC engine transport type</td>
</tr>
<tr>
<td>Framed Transport</td>
<td><%= framed %></td>
<td>Thrift RPC engine uses framed transport</td>
<td>Thrift Server Type</td>
<td><%= serverType %></td>
<td>The type of this Thrift server</td>
</tr>
<tr>
<td>Thrift Server Type</td>
<td><%= serverType %></td>
<td>The type of this Thrift server</td>
<td>Quality of Protection</td>
<td><%= qop %></td>
<td>QOP Settings for SASL</td>
</tr>
</table>
</table>
</section>
</div>
<div class="row">
<section>
<a href="http://hbase.apache.org/book.html#_thrift">Apache HBase Reference Guide chapter on Thrift</a>
</section>
</div>
</div>
<div class="row">
<section>
<a href="http://hbase.apache.org/book.html#_thrift">
Apache HBase Reference Guide chapter on Thrift</a>
</section>
</div>
</div>
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/static/js/tab.js" type="text/javascript"></script>
</body>
</html>

<jsp:include page="footer.jsp" />

0 comments on commit 25930ed

Please sign in to comment.