solrsolrj

How can I retrieve the metrics from my Solr server using SolrJ?


We are running Solr 8.4 and SolrJ 8.4. I can successfully retrieve about 18K lines of metrics using curl: curl 'http://localhost:1080/MySolr/admin/metrics'. How can I retrieve the same metrics using SolrJ?

I was unable to find any information in either the Solr or SolrJ documentation about this.

Any help is appreciated.


Solution

  • You make explicit use of the CommonParams.QT parameter to change the query path into any value.

    query.setParam(CommonParams.QT, "/admin/metrics"); 
    

    This lets you make a custom query to a path under a specific core name.