KAFKA-15534: Inject request completion time when the request failed (#14532)
Currently, we aren't able to access the request completion time if the request is completed exceptionally, which results in many system calls. This is not ideal because these system calls can add up. Instead, time is already retrieved on the top of the background thread event loop, which is then propagated into the NetworkClientDelegate.poll.
In this PR - I store the completion time in the handler, so that it becomes accessible in the callbacks.
Reviewer: Bruno Cadonna <cadonna@apache.org>
@ -229,7 +229,7 @@ public class CommitRequestManager implements RequestManager {
@@ -229,7 +229,7 @@ public class CommitRequestManager implements RequestManager {
@ -279,7 +279,7 @@ public class CommitRequestManager implements RequestManager {
@@ -279,7 +279,7 @@ public class CommitRequestManager implements RequestManager {
@ -290,7 +290,6 @@ public class CommitRequestManager implements RequestManager {
@@ -290,7 +290,6 @@ public class CommitRequestManager implements RequestManager {
@ -115,12 +115,11 @@ public class CoordinatorRequestManager implements RequestManager {
@@ -115,12 +115,11 @@ public class CoordinatorRequestManager implements RequestManager {
@ -165,10 +164,7 @@ public class CoordinatorRequestManager implements RequestManager {
@@ -165,10 +164,7 @@ public class CoordinatorRequestManager implements RequestManager {
@ -186,11 +186,9 @@ public class HeartbeatRequestManager implements RequestManager {
@@ -186,11 +186,9 @@ public class HeartbeatRequestManager implements RequestManager {
@ -91,7 +91,7 @@ public class NetworkClientDelegate implements AutoCloseable {
@@ -91,7 +91,7 @@ public class NetworkClientDelegate implements AutoCloseable {
@ -106,7 +106,7 @@ public class NetworkClientDelegate implements AutoCloseable {
@@ -106,7 +106,7 @@ public class NetworkClientDelegate implements AutoCloseable {
"Failed to send request after "+unsent.timer.timeoutMs()+" ms."));
continue;
}
@ -137,7 +137,7 @@ public class NetworkClientDelegate implements AutoCloseable {
@@ -137,7 +137,7 @@ public class NetworkClientDelegate implements AutoCloseable {
@ -145,7 +145,7 @@ public class NetworkClientDelegate implements AutoCloseable {
@@ -145,7 +145,7 @@ public class NetworkClientDelegate implements AutoCloseable {
@ -224,7 +224,7 @@ public class NetworkClientDelegate implements AutoCloseable {
@@ -224,7 +224,7 @@ public class NetworkClientDelegate implements AutoCloseable {
@ -235,7 +235,7 @@ public class NetworkClientDelegate implements AutoCloseable {
@@ -235,7 +235,7 @@ public class NetworkClientDelegate implements AutoCloseable {
returnhandler.future;
}
RequestCompletionHandlercallback(){
FutureCompletionHandlerhandler(){
returnhandler;
}
@ -256,27 +256,39 @@ public class NetworkClientDelegate implements AutoCloseable {
@@ -256,27 +256,39 @@ public class NetworkClientDelegate implements AutoCloseable {
@ -148,30 +148,32 @@ public class TopicMetadataRequestManager implements RequestManager {
@@ -148,30 +148,32 @@ public class TopicMetadataRequestManager implements RequestManager {