dsmiley commented on a change in pull request #115:
URL: https://github.com/apache/solr/pull/115#discussion_r633562617



##########
File path: solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java
##########
@@ -549,7 +546,9 @@ public InputStream getStream() throws IOException {
     public SolrParams parseParamsAndFillStreams( 
         final HttpServletRequest req, ArrayList<ContentStream> streams ) 
throws Exception
     {
-      streams.add( new HttpRequestContentStream( req ) );
+      if (!req.getMethod().equals("GET")) { // or other conditions? Check 
headers?
+        streams.add(new HttpRequestContentStream(req));
+      }

Review comment:
       I should enhance this condition to look for `Content-Length` or 
`Transfer-Encoding` headers, which the HTTP RFC says is how you know if there 
is a message body.

##########
File path: solr/core/src/java/org/apache/solr/api/V2HttpCall.java
##########
@@ -360,6 +366,85 @@ protected void execute(SolrQueryResponse rsp) {
     SolrCore.postDecorateResponse(handler, solrReq, rsp);
   }
 
+  @Override
+  protected void populateTracingSpan(Span span) {
+    // Set db.instance
+    String coreOrColName = this.origCorename;
+    if (coreOrColName == null) {
+      Map<String, String> pathTemplateValues = getUrlParts(); // == 
solrReq.getPathTemplateValues()
+      coreOrColName = pathTemplateValues.get("collection");
+      if (coreOrColName == null) {
+        coreOrColName = pathTemplateValues.get("core");
+      }
+    }
+    if (coreOrColName != null) {
+      span.setTag(Tags.DB_INSTANCE, coreOrColName);
+    }
+
+    // Get the templatize-ed path
+    String path;
+    if (api instanceof AnnotatedApi) {
+      // ideal scenario; eventually everything might be AnnotatedApi?
+      var aapi = (AnnotatedApi) api;
+      path = aapi.getEndPoint().path()[0]; // consider first to be primary
+    } else {
+      path = computeEndpointPath();
+      // TODO consider getValidators, looking for command & path?
+    }
+
+    String verb = req.getMethod().toLowerCase(Locale.ROOT);
+    // if this api has commands ...
+    final Map<String, JsonSchemaValidator> validators = getValidators(); // 
should be cached
+    if (validators != null && validators.isEmpty() == false && solrReq != 
null) {
+      // does this request have one command?
+      List<CommandOperation> cmds = solrReq.getCommands(false);
+      if (cmds.size() == 1) {
+        verb = cmds.get(0).name;
+      }
+    }
+
+    span.setOperationName(verb + ":" + path);
+
+    if (req.getQueryString() != null) {
+      span.setTag("params", req.getQueryString());

Review comment:
       I don't think there is value in a constant for this use-case (basically 
a form of logging).  If hypothetically this was parsed within the codebase then 
it would make sense to me as it would also link the dependency between 
read/write.
   
   Also, I think this should be namespaced... like "http.params".  The names 
seem somewhat loose; "http." is not reserved, so I think it's okay to add it 
there.




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to