virajjasani commented on a change in pull request #754: HBASE-22978 : Online slow response log URL: https://github.com/apache/hbase/pull/754#discussion_r379976726
########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java ########## @@ -496,11 +518,65 @@ void logResponse(Message param, String methodName, String call, String tag, } } } - responseInfo.put("multi.gets", numGets); - responseInfo.put("multi.mutations", numMutations); - responseInfo.put("multi.servicecalls", numServiceCalls); + responseInfo.put(MULTI_GETS, numGets); + responseInfo.put(MULTI_MUTATIONS, numMutations); + responseInfo.put(MULTI_SERVICE_CALLS, numServiceCalls); } + final String tag = (tooLarge && tooSlow) ? "TooLarge & TooSlow" + : (tooSlow ? "TooSlow" : "TooLarge"); LOG.warn("(response" + tag + "): " + GSON.toJson(responseInfo)); + if (tooSlow && this.slowLogRecorder != null) { + logOnlineSlowResponse(param, methodName, call, clientAddress, startTime, + processingTime, qTime, responseSize, userName, className, responseInfo); + } + } + + /** + * Add too slow log to ringbuffer for retrieval of latest n slow logs + * + * @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 clientAddress The address of the client who made this call + * @param startTime The time that the call was initiated, in ms + * @param processingTime The duration that the call took to run, in ms + * @param qTime The duration that the call spent on the queue + * prior to being initiated, in ms + * @param responseSize The size in bytes of the response buffer + * @param userName UserName of the current RPC Call + * @param className ClassName of the SlowLog call + * @param responseInfo Base information map that is reported regardless of type of call + */ + private void logOnlineSlowResponse(Message param, String methodName, String call, Review comment: I believe it should be fine as long as we are not serializing stuff in the same thread. Speaking of which, I feel like we should have `runAsync()` for `logResponse` itself so that `log.warn()` is also done asynchronously. Replied to your other comment. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services