This is an automated email from the ASF dual-hosted git repository. dsmiley pushed a commit to branch branch_9x in repository https://gitbox.apache.org/repos/asf/solr.git
commit a3663ddacdcfcb2fbecc8ac3e1b2acf5c3107e53 Author: David Smiley <[email protected]> AuthorDate: Mon Sep 7 22:32:07 2026 -0400 Tracing & audit: HttpSolrCall.getQueryParams (#4870) Distributed tracing and audit logging now see request parameters sent in a url-encoded POST body, not only those in the URL query string. (cherry picked from commit b7ccc9a7af78592ada152ecd41778868b17dffd5) (cherry picked from commit dc954d8e9478779f0b6fb32a953828a7eaf868c1) --- changelog/unreleased/PR#4870-httpSolrCallGetQueryParams.yml | 10 ++++++++++ solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java | 6 +++++- .../org/apache/solr/util/tracing/TestDistributedTracing.java | 8 ++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/changelog/unreleased/PR#4870-httpSolrCallGetQueryParams.yml b/changelog/unreleased/PR#4870-httpSolrCallGetQueryParams.yml new file mode 100644 index 00000000000..d4f29e24bf0 --- /dev/null +++ b/changelog/unreleased/PR#4870-httpSolrCallGetQueryParams.yml @@ -0,0 +1,10 @@ +title: > + Distributed tracing and audit logging now see request parameters sent in a url-encoded POST body, + not only those in the URL query string. +type: changed +authors: + - name: David Smiley + - name: Xinyao Zhang +links: + - name: PR#4870 + url: https://github.com/apache/solr/pull/4870 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 c894dc43158..0b7988f485c 100644 --- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java +++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java @@ -204,8 +204,12 @@ public class HttpSolrCall { return core; } + /** + * If the request has been created, return its parameters (merges URL and body if applicable); + * otherwise, return only the URL query parameters. + */ public SolrParams getQueryParams() { - return queryParams; + return solrReq != null ? solrReq.getParams() : queryParams; } /** The collection(s) referenced in this request. Populated in {@link #init()}. Not null. */ 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 a039511af63..43632d233cd 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 @@ -210,7 +210,7 @@ public class TestDistributedTracing extends SolrCloudTestCase { // db.instance=testInternalCollectionApiCommands // - this will be the parent span, all following spans will have the same traceId // - // 3..6 (4 times) operationName:"post:/admin/cores" + // 3..6 (4 times) operationName:"create:/admin/cores" // db.instance=testInternalCollectionApiCommands_shard1_replica_n2 // db.instance=testInternalCollectionApiCommands_shard2_replica_n4 // db.instance=testInternalCollectionApiCommands_shard2_replica_n1 @@ -241,7 +241,7 @@ public class TestDistributedTracing extends SolrCloudTestCase { ops.put(span.operationName(), ops.getOrDefault(span.operationName(), 0) + 1); } var expectedOps = - Map.of("CreateCollectionCmd", 1, "post:/admin/cores", 4, "post:/{core}/get", 2); + Map.of("CreateCollectionCmd", 1, "create:/admin/cores", 4, "post:/{core}/get", 2); assertEquals(expectedOps, ops); } @@ -258,7 +258,7 @@ public class TestDistributedTracing extends SolrCloudTestCase { // db.instance=testInternalCollectionApiCommands // - this will be the parent span, all following spans will have the same traceId // - // 3..6 (4 times) name=post:/admin/cores + // 3..6 (4 times) name=unload:/admin/cores // db.instance=testInternalCollectionApiCommands_shard2_replica_n1 // db.instance=testInternalCollectionApiCommands_shard1_replica_n2 // db.instance=testInternalCollectionApiCommands_shard2_replica_n4 @@ -282,7 +282,7 @@ public class TestDistributedTracing extends SolrCloudTestCase { assertEquals(span.context().traceId(), parentTraceId); ops.put(span.operationName(), ops.getOrDefault(span.operationName(), 0) + 1); } - var expectedOps = Map.of("DeleteCollectionCmd", 1, "post:/admin/cores", 4); + var expectedOps = Map.of("DeleteCollectionCmd", 1, "unload:/admin/cores", 4); assertEquals(expectedOps, ops); }
