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



##########
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?

Review comment:
       Thanks!
   I tried this:
   ```
         @SuppressWarnings("unchecked")
         List<String> paths = (List<String>) api.getSpec()._get(List.of("url", 
"paths"), null);
         if (paths != null && !paths.isEmpty()) {
           // TODO use "paths[0]" above but would rather see a faster 
implementation first
           path = paths.get(0);
         }
   ```
   And it worked for some endpoints but not for collection/core handlers which 
falsely returned "/update" instead of "/collections/{collection}/update".  And 
when /json was tack'ed on, it wasn't reflected there either but I suppose that 
could be minor.
   
   So I'll stick with the current code (which you approved today).
   




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