goiri commented on code in PR #5730:
URL: https://github.com/apache/hadoop/pull/5730#discussion_r1228393934
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java:
##########
@@ -600,17 +600,18 @@ void logSlowRpcCalls(String methodName, Call call,
}
}
- void updateMetrics(Call call, long startTime, boolean connDropped) {
+ void updateMetrics(Call call, long processingStartTime, boolean connDropped)
{
Review Comment:
Add units to the name.
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java:
##########
@@ -600,17 +600,18 @@ void logSlowRpcCalls(String methodName, Call call,
}
}
- void updateMetrics(Call call, long startTime, boolean connDropped) {
+ void updateMetrics(Call call, long processingStartTime, boolean connDropped)
{
totalRequests.increment();
// delta = handler + processing + response
- long deltaNanos = Time.monotonicNowNanos() - startTime;
- long timestampNanos = call.timestampNanos;
+ long completionTime = Time.monotonicNowNanos();
Review Comment:
Add units.
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java:
##########
@@ -636,10 +637,17 @@ void updateMetrics(Call call, long startTime, boolean
connDropped) {
processingTime -= waitTime;
String name = call.getDetailedMetricsName();
rpcDetailedMetrics.addProcessingTime(name, processingTime);
+ // Overall processing time is from arrival to completion.
+ rpcDetailedMetrics.addOverallProcessingTime(name,
+ rpcMetrics.getMetricsTimeUnit().convert(completionTime - arrivalTime,
Review Comment:
Let's extract this a little.
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java:
##########
@@ -600,17 +600,18 @@ void logSlowRpcCalls(String methodName, Call call,
}
}
- void updateMetrics(Call call, long startTime, boolean connDropped) {
+ void updateMetrics(Call call, long processingStartTime, boolean connDropped)
{
totalRequests.increment();
// delta = handler + processing + response
- long deltaNanos = Time.monotonicNowNanos() - startTime;
- long timestampNanos = call.timestampNanos;
+ long completionTime = Time.monotonicNowNanos();
+ long deltaNanos = completionTime - processingStartTime;
+ long arrivalTime = call.timestampNanos;
ProcessingDetails details = call.getProcessingDetails();
// queue time is the delta between when the call first arrived and when it
// began being serviced, minus the time it took to be put into the queue
details.set(Timing.QUEUE,
Review Comment:
This now fits in one line.
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/MetricsAsserts.java:
##########
@@ -358,6 +358,18 @@ public static void assertGaugeGt(String name, double
greater,
getDoubleGauge(name, rb) > greater);
}
+ /**
+ * Assert that a double gauge metric is greater than or equal to a value.
+ * @param name of the metric
+ * @param greater value of the metric should be greater than or equal to this
+ * @param rb the record builder mock used to getMetrics
+ */
+ public static void assertGaugeGte(String name, double greater,
+ MetricsRecordBuilder rb) {
+ Assert.assertTrue("Bad value for metric " + name,
Review Comment:
This assert message could report the greatervalue and the current value.
We should extract:
```
double curValue = getDoubleGauge(name, rb);
```
--
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]