abhishekagarwal87 commented on code in PR #12867:
URL: https://github.com/apache/druid/pull/12867#discussion_r938566560


##########
services/src/test/java/org/apache/druid/server/AsyncQueryForwardingServletTest.java:
##########
@@ -568,6 +595,18 @@ protected void doService(
 
     servlet.service(requestMock, null);
 
+    // NPE is expected since the listener's onComplete calls the parent class' 
onComplete which fails due to

Review Comment:
   this part is not clear. can you elaborate on
   - why servlet is in partial state? 
   - NPE itself is an error. what other possible errors are anticipated? 
   - where exactly does this NPE occur? 



##########
services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java:
##########
@@ -751,14 +791,32 @@ public void onFailure(Response response, Throwable 
failure)
       super.onFailure(response, failure);
     }
 
-    private void emitQueryTime(long requestTimeNs, boolean success)
+    private void emitQueryTime(long requestTimeNs, boolean success, @Nullable 
String sqlQueryId)
     {
-      QueryMetrics queryMetrics = DruidMetrics.makeRequestMetrics(
-          queryMetricsFactory,
-          warehouse.getToolChest(query),
-          query,
-          req.getRemoteAddr()
-      );
+      QueryMetrics queryMetrics;
+      if (sqlQueryId != null) {
+        queryMetrics = queryMetricsFactory.makeMetrics();
+        if (queryMetrics == null) {
+          return;
+        }
+        queryMetrics.remoteAddress(req.getRemoteAddr());
+        // Setting sqlQueryId dimension to the metric. Using a dummy query 
since SQL is translated to a native query
+        // only at a broker.
+        queryMetrics.sqlQueryId(

Review Comment:
   the implementations only need the sqlQueryId and not the actual query 
itself. can we not modify the interface itself and add `sqlQueryId(String id)`? 
The default impl of this method will be empty. That way, backward compatibility 
is maintained. 
   
   



-- 
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]

Reply via email to