Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1D521200BB5 for ; Sun, 6 Nov 2016 09:32:21 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1BE24160AFC; Sun, 6 Nov 2016 08:32:21 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 63B99160AD0 for ; Sun, 6 Nov 2016 09:32:20 +0100 (CET) Received: (qmail 57468 invoked by uid 500); 6 Nov 2016 08:32:19 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 57455 invoked by uid 99); 6 Nov 2016 08:32:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Nov 2016 08:32:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 603ABE09D3; Sun, 6 Nov 2016 08:32:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: liyu@apache.org To: commits@hbase.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-16033 Add more details in logging of responseTooSlow/TooLarge Date: Sun, 6 Nov 2016 08:32:19 +0000 (UTC) archived-at: Sun, 06 Nov 2016 08:32:21 -0000 Repository: hbase Updated Branches: refs/heads/branch-1.1 d9185de46 -> 14f5f1c19 HBASE-16033 Add more details in logging of responseTooSlow/TooLarge Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/14f5f1c1 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/14f5f1c1 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/14f5f1c1 Branch: refs/heads/branch-1.1 Commit: 14f5f1c1912e200926d61e9a9c9db246a1380fb7 Parents: d9185de Author: Yu Li Authored: Thu Jun 16 16:40:38 2016 +0800 Committer: Yu Li Committed: Sun Nov 6 16:30:45 2016 +0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/ipc/RpcServer.java | 35 ++++---------------- 1 file changed, 6 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/14f5f1c1/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java index c830b73..4e02122 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java @@ -2149,7 +2149,7 @@ public class RpcServer implements RpcServerInterface { if (tooSlow || tooLarge) { // when tagging, we let TooLarge trump TooSmall to keep output simple // note that large responses will often also be slow. - logResponse(new Object[]{param}, + logResponse(param, md.getName(), md.getName() + "(" + param.getClass().getName() + ")", (tooLarge ? "TooLarge" : "TooSlow"), status.getClient(), startTime, processingTime, qTime, @@ -2181,7 +2181,7 @@ public class RpcServer implements RpcServerInterface { /** * Logs an RPC response to the LOG file, producing valid JSON objects for * client Operations. - * @param params The parameters received in the call. + * @param param The parameters received in the call. * @param methodName The name of the method invoked * @param call The string representation of the call * @param tag The tag that will be used to indicate this event in the log. @@ -2192,7 +2192,7 @@ public class RpcServer implements RpcServerInterface { * prior to being initiated, in ms. * @param responseSize The size in bytes of the response buffer. */ - void logResponse(Object[] params, String methodName, String call, String tag, + void logResponse(Message param, String methodName, String call, String tag, String clientAddress, long startTime, int processingTime, int qTime, long responseSize) throws IOException { @@ -2205,32 +2205,9 @@ public class RpcServer implements RpcServerInterface { responseInfo.put("client", clientAddress); responseInfo.put("class", server == null? "": server.getClass().getSimpleName()); responseInfo.put("method", methodName); - if (params.length == 2 && server instanceof HRegionServer && - params[0] instanceof byte[] && - params[1] instanceof Operation) { - // if the slow process is a query, we want to log its table as well - // as its own fingerprint - TableName tableName = TableName.valueOf( - HRegionInfo.parseRegionName((byte[]) params[0])[0]); - responseInfo.put("table", tableName.getNameAsString()); - // annotate the response map with operation details - responseInfo.putAll(((Operation) params[1]).toMap()); - // report to the log file - LOG.warn("(operation" + tag + "): " + - MAPPER.writeValueAsString(responseInfo)); - } else if (params.length == 1 && server instanceof HRegionServer && - params[0] instanceof Operation) { - // annotate the response map with operation details - responseInfo.putAll(((Operation) params[0]).toMap()); - // report to the log file - LOG.warn("(operation" + tag + "): " + - MAPPER.writeValueAsString(responseInfo)); - } else { - // can't get JSON details, so just report call.toString() along with - // a more generic tag. - responseInfo.put("call", call); - LOG.warn("(response" + tag + "): " + MAPPER.writeValueAsString(responseInfo)); - } + responseInfo.put("call", call); + responseInfo.put("param", ProtobufUtil.getShortTextFormat(param)); + LOG.warn("(response" + tag + "): " + MAPPER.writeValueAsString(responseInfo)); } /** Stops the service. No new calls will be handled after this is called. */