You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by no...@apache.org on 2023/09/28 05:46:29 UTC

[solr] 01/01: Wrong collection name in tracing span

This is an automated email from the ASF dual-hosted git repository.

noble pushed a commit to branch jira/wrong_coll_name_in_coordinator
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 62b4e2d7c98f31cac85bf59692cecb0100e65430
Author: noblepaul <no...@gmail.com>
AuthorDate: Thu Sep 28 15:46:18 2023 +1000

    Wrong collection name in tracing span
---
 .../org/apache/solr/servlet/CoordinatorHttpSolrCall.java    |  5 +++++
 .../core/src/java/org/apache/solr/servlet/HttpSolrCall.java | 13 +++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java
index 82664b23623..0c52282f9d5 100644
--- a/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java
@@ -277,6 +277,11 @@ public class CoordinatorHttpSolrCall extends HttpSolrCall {
     }
   }
 
+  @Override
+  protected String getCoreOrColName() {
+    return collectionName;
+  }
+
   public static SolrQueryRequest wrappedReq(
       SolrQueryRequest delegate, String collectionName, HttpSolrCall httpSolrCall) {
     Properties p = new Properties();
diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
index 9137f3ded4e..ce9b1f8e6be 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -637,10 +637,7 @@ public class HttpSolrCall {
   // called after init().
   protected void populateTracingSpan(Span span) {
     // Set db.instance
-    String coreOrColName = HttpSolrCall.this.origCorename;
-    if (coreOrColName == null && getCore() != null) {
-      coreOrColName = getCore().getName();
-    }
+    String coreOrColName = getCoreOrColName();
     TraceUtils.setDbInstance(span, coreOrColName);
 
     // Set operation name.
@@ -658,6 +655,14 @@ public class HttpSolrCall {
     span.updateName(verb + ":" + path);
   }
 
+  protected String getCoreOrColName() {
+    String coreOrColName = HttpSolrCall.this.origCorename;
+    if (coreOrColName == null && getCore() != null) {
+      coreOrColName = getCore().getName();
+    }
+    return coreOrColName;
+  }
+
   public boolean shouldAudit() {
     return shouldAudit(cores);
   }