From 527e4a67d8f0465abbb7b1c6ca5480427f43f9c5 Mon Sep 17 00:00:00 2001 From: Mingliang Liu Date: Wed, 22 Jul 2020 13:57:51 +0530 Subject: [PATCH] HBASE-24696 Include JVM information on Web UI under "Software Attributes" Closes #2117 Signed-off-by: Viraj Jasani Signed-off-by: Nick Dimiduk --- .../main/resources/hbase-webapps/rest/rest.jsp | 6 ++++++ .../hbase/tmpl/master/MasterStatusTmpl.jamon | 5 +++++ .../hbase/tmpl/regionserver/RSStatusTmpl.jamon | 6 ++++++ .../org/apache/hadoop/hbase/util/JvmVersion.java | 15 +++++++++++---- .../resources/hbase-webapps/thrift/thrift.jsp | 6 ++++++ 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp b/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp index f0b56849378..1085d4b61d6 100644 --- a/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp +++ b/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp @@ -20,6 +20,7 @@ <%@ page contentType="text/html;charset=UTF-8" import="org.apache.hadoop.conf.Configuration" import="org.apache.hadoop.hbase.HBaseConfiguration" + import="org.apache.hadoop.hbase.rest.model.VersionModel" import="org.apache.hadoop.hbase.util.VersionInfo" import="java.util.Date"%> <% @@ -85,6 +86,11 @@ String listenPort = conf.get("hbase.rest.port", "8080"); Value Description + + JVM Version + <%= new VersionModel(getServletContext()).getJVMVersion() %> + JVM vendor and version + HBase Version <%= VersionInfo.getVersion() %>, revision=<%= VersionInfo.getRevision() %> diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon index 1dab104fed5..0d02f997ecd 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon @@ -263,6 +263,11 @@ AssignmentManager assignmentManager = master.getAssignmentManager(); Value Description + + JVM Version + <% JvmVersion.getVersion() %> + JVM vendor and version + HBase Version <% org.apache.hadoop.hbase.util.VersionInfo.getVersion() %>, revision=<% org.apache.hadoop.hbase.util.VersionInfo.getRevision() %>HBase version and revision diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon index 3afa7318f02..0f0fce4f711 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon @@ -31,6 +31,7 @@ org.apache.hadoop.hbase.ServerName; org.apache.hadoop.hbase.HBaseConfiguration; org.apache.hadoop.hbase.protobuf.ProtobufUtil; org.apache.hadoop.hbase.protobuf.generated.AdminProtos.ServerInfo; +org.apache.hadoop.hbase.util.JvmVersion; org.apache.hadoop.hbase.zookeeper.MasterAddressTracker; <%doc>If json AND bcn is NOT an empty string presume it a block cache view request. @@ -136,6 +137,11 @@ org.apache.hadoop.hbase.zookeeper.MasterAddressTracker; Value Description + + JVM Version + <% JvmVersion.getVersion() %> + JVM vendor and version + HBase Version <% org.apache.hadoop.hbase.util.VersionInfo.getVersion() %>, revision=<% org.apache.hadoop.hbase.util.VersionInfo.getRevision() %> diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JvmVersion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JvmVersion.java index b0bca000732..e62c78661bd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JvmVersion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JvmVersion.java @@ -25,9 +25,7 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceStability; /** - * Certain JVM versions are known to be unstable with HBase. This - * class has a utility function to determine whether the current JVM - * is known to be unstable. + * Utility class to get and check the current JVM version. */ @InterfaceAudience.Private @InterfaceStability.Stable @@ -38,10 +36,19 @@ public abstract class JvmVersion { } /** - * Return true if the current JVM is known to be unstable. + * Return true if the current JVM version is known to be unstable with HBase. */ public static boolean isBadJvmVersion() { String version = System.getProperty("java.version"); return version != null && BAD_JVM_VERSIONS.contains(version); } + + /** + * Return the current JVM version information. + */ + public static String getVersion() { + return System.getProperty("java.vm.vendor", "UNKNOWN_VM_VENDOR") + ' ' + + System.getProperty("java.version", "UNKNOWN_JAVA_VERSION") + '-' + + System.getProperty("java.vm.version", "UNKNOWN_VM_VERSION"); + } } diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp index 35cab0451b3..7026b83f1f6 100644 --- a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp +++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp @@ -20,6 +20,7 @@ <%@ 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.JvmVersion" import="org.apache.hadoop.hbase.util.VersionInfo" import="java.util.Date" %> @@ -92,6 +93,11 @@ String framed = conf.get("hbase.regionserver.thrift.framed", "false"); Value Description + + JVM Version + <%= JvmVersion.getVersion() %> + JVM vendor and version information + HBase Version <%= VersionInfo.getVersion() %>, r<%= VersionInfo.getRevision() %>