KeeProMise commented on code in PR #7224:
URL: https://github.com/apache/hadoop/pull/7224#discussion_r1882374273
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java:
##########
@@ -668,9 +675,41 @@ void updateMetrics(Call call, long
processingStartTimeNanos, boolean connDropped
}
}
- void updateDeferredMetrics(String name, long processingTime) {
+ /**
+ * Update rpc metrics for defered calls.
+ * @param call The Rpc Call
+ * @param name Rpc method name
+ * @param processingTime processing call in ms unit.
+ */
+ void updateDeferredMetrics(Call call, String name, long processingTime) {
+ long completionTimeNanos = Time.monotonicNowNanos();
+ long arrivalTimeNanos = call.timestampNanos;
+
+ ProcessingDetails details = call.getProcessingDetails();
+ long waitTime =
+ details.get(Timing.LOCKWAIT, rpcMetrics.getMetricsTimeUnit());
+ long responseTime =
+ details.get(Timing.RESPONSE, rpcMetrics.getMetricsTimeUnit());
+ rpcMetrics.addRpcLockWaitTime(waitTime);
+ rpcMetrics.addRpcProcessingTime(processingTime);
+ rpcMetrics.addRpcResponseTime(responseTime);
rpcMetrics.addDeferredRpcProcessingTime(processingTime);
rpcDetailedMetrics.addDeferredProcessingTime(name, processingTime);
+ // don't include lock wait for detailed metrics.
+ processingTime -= waitTime;
+ rpcDetailedMetrics.addProcessingTime(name, processingTime);
+
+ // Overall processing time is from arrival to completion.
+ long overallProcessingTime = rpcMetrics.getMetricsTimeUnit()
+ .convert(completionTimeNanos - arrivalTimeNanos, TimeUnit.NANOSECONDS);
+ rpcDetailedMetrics.addOverallProcessingTime(name, overallProcessingTime);
+ callQueue.addResponseTime(name, call, details);
+ if (isLogSlowRPC()) {
+ logSlowRpcCalls(name, call, details);
+ }
+ if (details.getReturnStatus() == RpcStatusProto.SUCCESS) {
+ rpcMetrics.incrRpcCallSuccesses();
+ }
Review Comment:
There is some duplicate code in this method and updateMetrics; we can
extract the common code.
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine2.java:
##########
@@ -425,28 +426,39 @@ static class ProtobufRpcEngineCallbackImpl
private final RPC.Server server;
private final Call call;
private final String methodName;
- private final long setupTime;
+ private final long callStartNanos;
Review Comment:
Can callStartNanos be made an attribute of the call object, so that thread
variables are not needed?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]