virajjasani commented on a change in pull request #3319: URL: https://github.com/apache/hbase/pull/3319#discussion_r641399038
########## File path: hbase-server/src/main/resources/hbase-webapps/regionserver/rsNamedQueueLog.jsp ########## @@ -0,0 +1,157 @@ +<%-- +/** + * 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="java.util.Date" + import="java.util.List" + import="java.util.Arrays" + import="java.util.HashSet" + import="org.apache.hadoop.conf.Configuration" + import="org.apache.hadoop.hbase.client.Admin" + import="org.apache.hadoop.hbase.client.SnapshotDescription" + import="org.apache.hadoop.hbase.http.InfoServer" + import="org.apache.hadoop.hbase.master.HMaster" + import="org.apache.hadoop.hbase.snapshot.SnapshotInfo" + import="org.apache.hadoop.util.StringUtils" + import="org.apache.hadoop.hbase.TableName" + import="org.apache.hadoop.hbase.client.ServerType" + import="org.apache.hadoop.hbase.client.LogEntry" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.client.OnlineLogRecord" + import="org.apache.hadoop.hbase.HConstants" + import="org.apache.hadoop.hbase.ServerName" +%> +<% + HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + Configuration conf = rs.getConfiguration(); + List<OnlineLogRecord> slowLogs = null; + List<OnlineLogRecord> largeLogs = null; + + if(rs.isOnline()) { + try (Admin rsAdmin = rs.getConnection().getAdmin()) { + slowLogs = (List<OnlineLogRecord>)(List<?>)rsAdmin.getLogEntries(new HashSet<ServerName>(Arrays.asList(rs.getServerName())), "SLOW_LOG", ServerType.REGION_SERVER, HConstants.DEFAULT_SLOW_LOG_RING_BUFFER_SIZE, null); Review comment: I see your point. We have generic Admin API to retrieve all kind of log records, regardless of whether ring buffers operate on Master or RegionServer. Admin#getLogEntries [here](https://github.com/apache/hbase/blob/master/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java#L2532) ``` /** * Retrieve recent online records from HMaster / RegionServers. * Examples include slow/large RPC logs, balancer decisions by master. * * @param serverNames servers to retrieve records from, useful in case of records maintained * by RegionServer as we can select specific server. In case of servertype=MASTER, logs will * only come from the currently active master. * @param logType string representing type of log records * @param serverType enum for server type: HMaster or RegionServer * @param limit put a limit to list of records that server should send in response * @param filterParams additional filter params * @return Log entries representing online records from servers * @throws IOException if a remote or network exception occurs */ List<LogEntry> getLogEntries(Set<ServerName> serverNames, String logType, ServerType serverType, int limit, Map<String, Object> filterParams) throws IOException; ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
