This is an automated email from the ASF dual-hosted git repository. keepromise pushed a commit to branch HDFS-17531 in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/HDFS-17531 by this push: new be06adcde0a HADOOP-19361. RPC DeferredMetrics bugfix. (#7220). Contributed by hfutatzhanghb. be06adcde0a is described below commit be06adcde0a596dde756c69c3dfcf3617050df65 Author: hfutatzhanghb <hfutzhan...@163.com> AuthorDate: Tue Dec 10 17:46:18 2024 +0800 HADOOP-19361. RPC DeferredMetrics bugfix. (#7220). Contributed by hfutatzhanghb. Reviewed-by: Jian Zhang <keeprom...@apache.org> --- .../src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java | 10 +++++----- .../main/java/org/apache/hadoop/ipc/ProtobufRpcEngine2.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java index df0f734d080..1e513271a84 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java @@ -214,7 +214,7 @@ public class ProtobufRpcEngine implements RpcEngine { throws ServiceException { long startTime = 0; if (LOG.isDebugEnabled()) { - startTime = Time.now(); + startTime = Time.monotonicNow(); } if (args.length != 2) { // RpcController + Message @@ -267,7 +267,7 @@ public class ProtobufRpcEngine implements RpcEngine { } if (LOG.isDebugEnabled()) { - long callTime = Time.now() - startTime; + long callTime = Time.monotonicNow() - startTime; LOG.debug("Call: " + method.getName() + " took " + callTime + "ms"); } @@ -399,19 +399,19 @@ public class ProtobufRpcEngine implements RpcEngine { this.server = CURRENT_CALL_INFO.get().getServer(); this.call = Server.getCurCall().get(); this.methodName = CURRENT_CALL_INFO.get().getMethodName(); - this.setupTime = Time.now(); + this.setupTime = Time.monotonicNow(); } @Override public void setResponse(Message message) { - long processingTime = Time.now() - setupTime; + long processingTime = Time.monotonicNow() - setupTime; call.setDeferredResponse(RpcWritable.wrap(message)); server.updateDeferredMetrics(methodName, processingTime); } @Override public void error(Throwable t) { - long processingTime = Time.now() - setupTime; + long processingTime = Time.monotonicNow() - setupTime; String detailedMetricsName = t.getClass().getSimpleName(); server.updateDeferredMetrics(detailedMetricsName, processingTime); call.setDeferredError(t); diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine2.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine2.java index bedecc8851d..2d0f34c2462 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine2.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine2.java @@ -222,7 +222,7 @@ public class ProtobufRpcEngine2 implements RpcEngine { throws ServiceException { long startTime = 0; if (LOG.isDebugEnabled()) { - startTime = Time.now(); + startTime = Time.monotonicNow(); } if (args.length != 2) { // RpcController + Message @@ -277,7 +277,7 @@ public class ProtobufRpcEngine2 implements RpcEngine { } if (LOG.isDebugEnabled()) { - long callTime = Time.now() - startTime; + long callTime = Time.monotonicNow() - startTime; LOG.debug("Call: " + method.getName() + " took " + callTime + "ms"); } @@ -431,19 +431,19 @@ public class ProtobufRpcEngine2 implements RpcEngine { this.server = CURRENT_CALL_INFO.get().getServer(); this.call = Server.getCurCall().get(); this.methodName = CURRENT_CALL_INFO.get().getMethodName(); - this.setupTime = Time.now(); + this.setupTime = Time.monotonicNow(); } @Override public void setResponse(Message message) { - long processingTime = Time.now() - setupTime; + long processingTime = Time.monotonicNow() - setupTime; call.setDeferredResponse(RpcWritable.wrap(message)); server.updateDeferredMetrics(methodName, processingTime); } @Override public void error(Throwable t) { - long processingTime = Time.now() - setupTime; + long processingTime = Time.monotonicNow() - setupTime; String detailedMetricsName = t.getClass().getSimpleName(); server.updateDeferredMetrics(detailedMetricsName, processingTime); call.setDeferredError(t); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org