Skip to content

SOLR-18161: improve node system response#4240

Open
igiguere wants to merge 38 commits into
apache:mainfrom
igiguere:SOLR-18161-improve-node-system-response
Open

SOLR-18161: improve node system response#4240
igiguere wants to merge 38 commits into
apache:mainfrom
igiguere:SOLR-18161-improve-node-system-response

Conversation

@igiguere

@igiguere igiguere commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18161

Description

The existing v2 /api/node/system endpoint returns fields (host, node, jvm, lucene, etc.) at the top level of the response alongside the header. This is a bit inconsistent with other APIs and doesn't extrapolate well to multi-node responses.

Solution

Two changes to the v2 endpoint:

  1. Wrap response fields in nodeInfo - All system info fields are moved into a nodeInfo sub-object in the response, separating them from the top-level responseHeader. (v2 API only)
  2. Add a path parameter for more selective data fetching - new GET /api/node/system/{requestedInfo} allows callers to fetch only the data they care about (lucene, jvm, gpu, security) rather than the full payload every time.

(Much of this was previously proposed in #4078 but was extracted here for review purposes.)

Tests

Unit tests added or adapted for the wrapped response and the path parameter.

Functional test on "devSlim", running with the "cloud" example.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change

Isabelle Giguere and others added 30 commits January 15, 2026 10:17
Add NodeSystemIfoApi (notice the lower-case last chars), to (eventually)
replace Endpoint NodeSystemIfoAPI.  Lo warning about deprecation.

Add GetNodeSystemInfo, move the info-gathering logic to a separate class
NodeSystemInfoProvider, adjust SystemInfoHandler.

Known Issue: NodeSystemInfoResponse does not support responses from
multiple nodes.

More testing and clean-up to do.
Fix NodeSystemResponse to contain a map of node name to node info.

Fix responses for Json and XML.

TODO : nodes=all is ignored
forgot those in the previous commit
Fix log calls.  Add unit tests for HTTP call.
Remove the Map from NodeSystemInfoResponse: the AdminHandlersProxy wraps
all nodes responses into a map, it should not belong to the response
class.
Replace the Map wrapper by just a single object wrapper: NodeSystemInfo.
It provides some separation between the response header and the actual
node info.
Ensure back-compatible response from V1 path (and from old V2 path)
Add method getSpecificNodeSystemInfo, with path parameter, to get only
selected info.

Add query param "nodes": not used, because AdminHandlersProxy does not
support V2 yet.
Merge remote-tracking branch 'origin-solr/main' into
NodeSystemInfoApi-JerseyResource
Merge remote-tracking branch 'origin-solr/main' into
NodeSystemInfoApi-JerseyResource
Commented-out for now.

Revert to class name NodeSystemResponse
Split core info response into a different model class.

Place the getCoreInfo method in the utility class, to re-use in
back-compatible /admin/info/system response.

Rename a few classes

Adjust documentation
…guere/solr.git into NodeSystemInfoApi-JerseyResource
using the PR rather that the mixed-up Jira ticket
Wrap node info into "nodeInfo" field, to separate from the response
headers.

Add a method to get specific node info (gpu, lucence, jvm,...)

Other modifications as previously discussed on PR apache#4078

Relevant unit tests pass, functional test and gradlew check to do...
gradlew tidy

gradlew clean check

one unrelated unit test (JWT) failing
@HoustonPutman

Copy link
Copy Markdown
Contributor

This still uses the same security to protect secrets in SysProps right? And envVars are not exposed?

Comment thread changelog/unreleased/SOLR-18161-improve-system-info-response.yml Outdated
@igiguere

Copy link
Copy Markdown
Contributor Author

This still uses the same security to protect secrets in SysProps right? And envVars are not exposed?

There is no change in functionality with regards to system properties and environment variables. This PR adds features that were left out of PR #4078, itself entirely based on pre-exisiting logic.

The method SystemInfoProvider.getInputArgumentsRedacted(NodeConfig, RuntimeMXBean) is exactly the same as in the patch in https://issues.apache.org/jira/browse/SOLR-16809. The method was just moved to a new class (as part of PR #4078).
SystemInfoProvider will output redacted properties according to the hiddenSysProps parameter.

Isabelle Giguere and others added 5 commits March 27, 2026 11:12
Merge remote-tracking branch 'origin-solr/main' into
SOLR-18161-improve-node-system-response

Fixed Conflicts:
solr/api/src/java/org/apache/solr/client/api/model/NodeSystemResponse.java
@github-actions github-actions Bot added dependencies Dependency upgrades tool:build labels May 9, 2026
@gerlowskija

gerlowskija commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Hey @igiguere - going through to review this now; sorry for the delay.

After the long time away I had a bit of trouble remembering the full context here. These time gaps tend to be more common than you'd think (or want), so giving lots of detail in the PR description is a great lifeline for both returning reviewers and folks that are new altogether.

I took the liberty of updating your PR writeup above with some context; might be a nice example to try to shoot for in subsequent PRs. (If I've gotten anything wrong in that revised writeup, lmk!)

Comment thread gradle/libs.versions.toml
androidx-lifecycle-runtimeCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
androidx-lifecycle-viewmodelCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }
androidx-lifecycle-viewModelNav3 = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-navigation3", version.ref = "androidx-lifecycle" }
androidx-lifecycle-viewmodelCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, wonder why this changed 🤔

Oh well 🤷

@@ -0,0 +1,8 @@
# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
title: Improve /node/system response with a wrapper to separate the system info from the response header, and add a method to return only selected info

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: Improve /node/system response with a wrapper to separate the system info from the response header, and add a method to return only selected info
title: Added new `/api/node/system` sub APIs to fetch specific subsets of the normal `/api/node/system` response. e.g. `/api/node/system/jvm`

The new API endpoints are the most relevant bit to a user, so might be better to focus mainly on those in the changelog entry.

- name: Isabelle Giguère
links:
- name: SOLR-18161
url: https://issues.apache.org/jira/browse/SOLR-18161

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url: https://issues.apache.org/jira/browse/SOLR-18161
url: https://issues.apache.org/jira/browse/SOLR-18161
- name: Github PR
url: https://github.com/apache/solr/pull/4240

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I got the indentation on that quite right in Github, but hopefully you get the idea.

})
@Path("/{requestedInfo}")
NodeSystemResponse getSpecificNodeSystemInfo(
@PathParam(value = "requestedInfo") String requestedInfo,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[0] I wonder if we could change this from a "String" to some type of enum so that Jersey would do the value-checking for us...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out we can! This "just kindof worked" when I tried switching it over. I've pushed the changes to your branch - if you don't like the change just lmk and I'm happy to roll it back.

There are a bunch of other places (mostly marked by TODOs in the api/ module) where I've thought about using an enum in these API definitions but didn't quite have time to check if that'd work. Should tackle these in a follow-on PR....


@Test
public void testGetSpecificNodeInfo() throws Exception {
final var req = new SystemApi.GetSpecificNodeSystemInfo("lucene");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[+1] Love to see the generated SolrJ class getting used here - 🎉

assertEquals(0, infoRsp.responseHeader.status);
assertNotNull(infoRsp.nodeInfo.lucene);
assertEquals(Version.LATEST.toString(), infoRsp.nodeInfo.lucene.luceneSpecVersion);
assertNull(infoRsp.nodeInfo.jvm);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[0] From an OAS or API documentation perspective, it might be nice at some point to have separate methods and response classes for (e.g.) /api/node/system/lucene so that the response object doesn't even have fields for things that'll never be set like .nodeInfo.gpu.

But I'm happy to punt that down the road unless you think it's worth tackling here?

== Response


== Node Information Object

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[-0] Documenting this is kindof tricky, since the "nodeInfo" object exists for v2 responses, but not v1 responses. Maybe it's worth putting a sentence right under this header indicating that this sub-object is only present in the v2 API response, with fields being present on the top level response in the v1 case.

----


=== Retrieve specific system information.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[+1] Excellent, thanks!


return result;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q/-0] Hmm, can you explain why this is here? At a glance it doesn't seem related to the rest of the PR but maybe I'm forgetting some context.

@github-actions github-actions Bot removed dependencies Dependency upgrades tool:build labels Jun 11, 2026
Jersey now validates the "sub-resource" requested and returns a 404 if
it's not one of the expected values ('jvm', 'lucene', 'gpu', etc).
@gerlowskija

Copy link
Copy Markdown
Contributor

Hey @igiguere - I've left a few review comments. The only real hold up at this point is a question I left on the JacksonDataBind changes - I don't quite understand their relation to this change and could use a bit more context there.

Once you're able to chime in there I can proceed with getting this merged. Thanks again for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants