Skip to content

refactor(metrics): migrate from /admin/mbeans to /admin/metrics API#61

Open
adityamparikh wants to merge 4 commits intoapache:mainfrom
adityamparikh:metrics-api-migration
Open

refactor(metrics): migrate from /admin/mbeans to /admin/metrics API#61
adityamparikh wants to merge 4 commits intoapache:mainfrom
adityamparikh:metrics-api-migration

Conversation

@adityamparikh
Copy link
Contributor

Summary

  • Replace deprecated /admin/mbeans endpoint with /admin/metrics API (available since Solr 7.1+) for cache and handler metrics collection
  • Ensures compatibility with both Solr 9 and Solr 10, where /admin/mbeans was removed
  • Handle both NamedList and Map (LinkedHashMap) response types from Metrics API
  • Strengthen integration test assertions to require non-null cache and handler stats

Changes

  • CollectionService: Migrate getCacheMetrics() and getHandlerMetrics() from /admin/mbeans to /admin/metrics with group=core prefix filtering
  • CollectionServiceTest: Rewrite mock data helpers to match Metrics API response format ({metrics: {solr.core.<collection>: {...}}})
  • CollectionServiceIntegrationTest: Replace conditional cache/handler assertions with strong assertNotNull checks
  • CLAUDE.md: Update Solr 10 compatibility section to reflect completed migration
  • Add SLF4J logging to CollectionService

Test plan

  • All unit tests pass with Metrics API mock data format
  • Integration tests pass against real Solr via Testcontainers with strong assertions for cache and handler stats
  • ./gradlew clean build passes with no regressions
  • Verify against Solr 9.x and 10.x Docker images

🤖 Generated with Claude Code

adityamparikh and others added 4 commits March 8, 2026 18:56
Replace deprecated /admin/mbeans endpoint with /admin/metrics API
(available since Solr 7.1+) for cache and handler metrics collection.
This ensures compatibility with both Solr 9 and Solr 10, where
/admin/mbeans was removed.

Key changes:
- Use /admin/metrics?group=core&prefix=CACHE.searcher for cache stats
- Use /admin/metrics?group=core&prefix=QUERY./select,UPDATE./update for handler stats
- Handle both NamedList and Map response types from Metrics API
- Add SLF4J logging to CollectionService
- Strengthen integration test assertions for cache and handler stats
- Update CLAUDE.md Solr 10 compatibility section

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Restore comprehensive Javadoc comments on all methods and constants
in CollectionService, updated to reference the /admin/metrics API
instead of the deprecated /admin/mbeans endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
- S1118: Add private constructor to CollectionUtils utility class
- S7467: Replace unused caught exceptions with unnamed pattern (_)

Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant