SOLR-18161: improve node system response#4240
Conversation
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
Clean-up unused imports
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
changelog!
|
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 |
improve changelog title
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
...tidy!...
|
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!) |
| 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" } |
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
[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...
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
[+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); |
There was a problem hiding this comment.
[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 |
There was a problem hiding this comment.
[-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. |
There was a problem hiding this comment.
[+1] Excellent, thanks!
|
|
||
| return result; | ||
| } | ||
|
|
There was a problem hiding this comment.
[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.
Jersey now validates the "sub-resource" requested and returns a 404 if
it's not one of the expected values ('jvm', 'lucene', 'gpu', etc).
|
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! |
https://issues.apache.org/jira/browse/SOLR-18161
Description
The existing v2
/api/node/systemendpoint 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:
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:
mainbranch../gradlew check.