tasanuma commented on a change in pull request #3635: URL: https://github.com/apache/hadoop/pull/3635#discussion_r751048259
########## File path: hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java ########## @@ -586,25 +587,20 @@ private Object invokeMethod( /** * For tracking which is the actual client address. - * It adds trace info "clientIp:ip" to caller context if it's absent. + * It adds trace info "clientIp:ip" and "clientPort:port" + * to caller context if they are absent. */ - private void appendClientIpToCallerContextIfAbsent() { - String clientIpInfo = CLIENT_IP_STR + ":" + Server.getRemoteAddress(); - final CallerContext ctx = CallerContext.getCurrent(); - if (isClientIpInfoAbsent(clientIpInfo, ctx)) { - String origContext = ctx == null ? null : ctx.getContext(); - byte[] origSignature = ctx == null ? null : ctx.getSignature(); - CallerContext.setCurrent( - new CallerContext.Builder(origContext, contextFieldSeparator) - .append(clientIpInfo) - .setSignature(origSignature) - .build()); - } - } - - private boolean isClientIpInfoAbsent(String clientIpInfo, CallerContext ctx){ - return ctx == null || ctx.getContext() == null - || !ctx.getContext().contains(clientIpInfo); + private void appendClientIpPortToCallerContextIfAbsent() { + CallerContext ctx = CallerContext.getCurrent(); + String origContext = ctx == null ? null : ctx.getContext(); + byte[] origSignature = ctx == null ? null : ctx.getSignature(); + CallerContext.setCurrent( + new CallerContext.Builder(origContext, contextFieldSeparator) + .appendIfAbsent(CLIENT_IP_STR, Server.getRemoteAddress()) + .appendIfAbsent(CLIENT_PORT_STR, Review comment: Just a note, we allow the line length up to 100 after HADOOP-17813. -- 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. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org