This is an automated email from the ASF dual-hosted git repository.
gerlowskija pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 324a878b0b9 SOLR-16205: Simplify v2 API span-population logic
324a878b0b9 is described below
commit 324a878b0b93d872c02523add2e65d481ccffe14
Author: Jason Gerlowski <[email protected]>
AuthorDate: Mon May 23 14:20:14 2022 -0700
SOLR-16205: Simplify v2 API span-population logic
Prior to this commit, V2HttpCall populated the "operationName" of
tracing spans differently depending on whether the API was implemented
as an AnnotatedApi or not. A special code path for AnnotatedApi's had
the operationName come primarily from the path value specified on the
@Endpoint annotation.
This works well for AnnotatedApis registered at the CoreContainer level,
but actually produces the wrong path for AnnotatedApis registered on
individual cores. This commit removes this optimized code path, so that
per-core AnnotatedApis produce spans consistent with everything else.
---
solr/core/src/java/org/apache/solr/api/V2HttpCall.java | 8 +-------
.../test/org/apache/solr/util/tracing/TestDistributedTracing.java | 7 +------
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/api/V2HttpCall.java
b/solr/core/src/java/org/apache/solr/api/V2HttpCall.java
index a652c1b246c..8d1a2e7a0fd 100644
--- a/solr/core/src/java/org/apache/solr/api/V2HttpCall.java
+++ b/solr/core/src/java/org/apache/solr/api/V2HttpCall.java
@@ -423,13 +423,7 @@ public class V2HttpCall extends HttpSolrCall {
}
// Get the templatize-ed path, ex: "/c/{collection}"
- String path;
- if (api instanceof AnnotatedApi) {
- // ideal scenario; eventually everything might be AnnotatedApi?
- path = ((AnnotatedApi) api).getEndPoint().path()[0]; // consider first
to be primary
- } else {
- path = computeEndpointPath();
- }
+ final String path = computeEndpointPath();
String verb = null;
// if this api has commands ...
diff --git
a/solr/core/src/test/org/apache/solr/util/tracing/TestDistributedTracing.java
b/solr/core/src/test/org/apache/solr/util/tracing/TestDistributedTracing.java
index d4b8c232b46..624c9d162ef 100644
---
a/solr/core/src/test/org/apache/solr/util/tracing/TestDistributedTracing.java
+++
b/solr/core/src/test/org/apache/solr/util/tracing/TestDistributedTracing.java
@@ -152,12 +152,7 @@ public class TestDistributedTracing extends
SolrCloudTestCase {
.build()
.process(cloudClient);
finishedSpans = getAndClearSpans();
- // TODO See SOLR-16205. A quirk in the way that span operationNames are
generated causes
- // core-level v2 endpoints
- // implemented using AnnotatedApi to produce spans lacking the full url
(ie.
- // /c/{collection}/update/json). This test
- // will need updated to assert against the "full url" when SOLR-16205 is
fixed.
- assertEquals("post:/update/json", finishedSpans.get(0).operationName());
+ assertEquals("post:/c/{collection}/update/json",
finishedSpans.get(0).operationName());
assertDbInstanceColl(finishedSpans.get(0));
final V2Response v2Response =