divijvaidya commented on code in PR #12590:
URL: https://github.com/apache/kafka/pull/12590#discussion_r968386276


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java:
##########
@@ -446,6 +429,31 @@ private RequestFuture<ClientResponse> 
sendMetadataRequest(MetadataRequest.Builde
             return client.send(node, request);
     }
 
+    /**
+     * Send Fetch Request to Kafka cluster asynchronously.
+     *
+     * This method is visible for testing.
+     *
+     * @return A future that indicates result of sent Fetch request
+     */
+    RequestFuture<ClientResponse> sendFetchRequestToNode(final 
FetchSessionHandler.FetchRequestData requestData,
+                                                                 final Node 
fetchTarget) {
+        final short maxVersion = requestData.canUseTopicIds() ? 
ApiKeys.FETCH.latestVersion() : (short) 12;
+
+        final FetchRequest.Builder request = FetchRequest.Builder
+                .forConsumer(maxVersion, this.maxWaitMs, this.minBytes, 
requestData.toSend())
+                .isolationLevel(isolationLevel)
+                .setMaxBytes(this.maxBytes)
+                .metadata(requestData.metadata())
+                .removed(requestData.toForget())
+                .replaced(requestData.toReplace())
+                .rackId(clientRackId);
+
+        log.debug("Sending {} {} to broker {}", isolationLevel, requestData, 
fetchTarget);

Review Comment:
   Note that we use [slf4j 
logger](https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L61).
   
   Slf4j is quite intelligent and doesn't execute the the log statement if the 
correct level is not set when we use the parameterized (i.e. using {}) variant. 
You can find more information about it here: 
https://www.slf4j.org/faq.html#logging_performance 
   
   In fact, we should probably add this to our "coding standards guide" for 
Apache Kafka (if any such thing exists).



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to