adityamparikh opened a new pull request, #296:
URL: https://github.com/apache/solr-mcp/pull/296

   ## Summary
   
   `get-collection-stats` no longer sends a query of its own, and says which 
core its cache and handler numbers come from.
   
   ```diff
    getCollectionStats(collection)
      Luke show=index                 → indexStats (numDocs, segmentCount)
   -  query *:* rows=0                → queryStats (queryTime, totalResults, 
start, maxScore)
      /admin/metrics, one call        → cacheStats, handlerStats
   +                                    metricsCore: the core those were read 
from
   ```
   
   The probe query measured nothing useful: `queryTime` was the time of that 
one `*:*` query, `start` was always 0 and `maxScore` never set (no rows). And 
because the handler and cache counters are cumulative, it showed up as a 
`/select` request and a query-result-cache lookup in that call's and every 
later call's numbers, so the tool inflated what it reported. Two requests 
instead of three.
   
   The cache and handler statistics come from the first core whose registry 
name matches the collection, so on a collection with more than one core they 
describe that core only. The response now names it:
   
   ```json
   "metricsCore": "solr.core.films.shard1.replica_n1"
   ```
   
   The tool description says what needs reading with care, instead of the 
server changing Solr's numbers:
   
   - before Solr 9.11 and 10.1, `numDocs` and `segmentCount` of a multi-shard 
collection are one shard's (Luke is not distributed there; SOLR-8127)
   - `cacheStats` and `handlerStats` are the core named in `metricsCore`
   - a cache's `hitratio` is 1.0 when it has had no lookups
   - `handlerStats` times are in nanoseconds (an `/update` request averaged 
596,109,600 in local testing, which is 0.6 s in nanoseconds and would be 165 
hours in milliseconds)
   
   ## Evidence
   
   - **Before:** three `get-collection-stats` calls in a row on an idle 
collection reported `/select` requests 5, 6, 7 and query-result-cache lookups 
5, 6, 7: each call counted the previous call's probe.
     **After:** 
`CollectionServiceIntegrationTest.getCollectionStats_doesNotCountItselfInTheHandlerStats`
 asserts the count is the same across two calls.
   - 
`CollectionServiceTest.getCollectionStats_MakesExactlyOneMetricsRequestAndNoQuery`:
 one Luke request, one metrics request, no `query`, and `metricsCore` starts 
with `solr.core.test_collection.`.
   - `CollectionServiceIntegrationTest`: `metricsCore` names a core of the test 
collection on real Solr.
   - `./gradlew build`: 456 tests, 0 failures, 0 skipped.
   - `./gradlew nativeTest -Pnative`: 302 successful, 0 failed; the stats 
integration tests, the self-count regression test and the MCP 
`get-collection-stats` tests (HTTP and STDIO) pass in the native image. The 152 
skipped are the `@DisabledInNativeImage` Mockito tests.
   
   ## Merge Danger
   
   **Door:** two-way
   
   **Blast Radius:** stats-consumers
   
   `queryStats` is gone from the response; a client that read `totalResults` 
should read `indexStats.numDocs`. On a multi-shard collection before Solr 9.11 
/ 10.1 that is one shard's count, where `totalResults` was the collection's; 
the description says so.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [PR] fix(collection): stop get... adityamparikh (via GitHub) via issues

Reply via email to