mirror of https://github.com/apache/lucene.git
SOLR-10416: The JSON output of /admin/metrics is fixed to write the container as a map (SimpleOrderedMap) instead of an array (NamedList)
This commit is contained in:
parent
4c737b8df9
commit
ee98cdc790
|
@ -198,6 +198,9 @@ Bug Fixes
|
|||
* SOLR-10383: Fix debug related NullPointerException in solr/contrib/ltr OriginalScoreFeature class.
|
||||
(Vitezslav Zak, Christine Poerschke)
|
||||
|
||||
* SOLR-10416: The JSON output of /admin/metrics is fixed to write the container as a
|
||||
map (SimpleOrderedMap) instead of an array (NamedList). (shalin)
|
||||
|
||||
================== 6.5.0 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.codahale.metrics.MetricRegistry;
|
|||
import com.codahale.metrics.Timer;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.common.util.SimpleOrderedMap;
|
||||
import org.apache.solr.common.util.StrUtils;
|
||||
import org.apache.solr.core.CoreContainer;
|
||||
import org.apache.solr.handler.RequestHandlerBase;
|
||||
|
@ -79,7 +80,7 @@ public class MetricsHandler extends RequestHandlerBase implements PermissionName
|
|||
List<MetricFilter> metricFilters = metricTypes.stream().map(MetricType::asMetricFilter).collect(Collectors.toList());
|
||||
Set<String> requestedRegistries = parseRegistries(req);
|
||||
|
||||
NamedList response = new NamedList();
|
||||
NamedList response = new SimpleOrderedMap();
|
||||
for (String registryName : requestedRegistries) {
|
||||
MetricRegistry registry = metricManager.registry(registryName);
|
||||
response.add(registryName, MetricUtils.toNamedList(registry, metricFilters, mustMatchFilter, false,
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Map;
|
|||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.common.util.SimpleOrderedMap;
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -147,9 +148,9 @@ public class MetricsHandlerTest extends SolrTestCaseJ4 {
|
|||
handler.handleRequestBody(req(CommonParams.QT, "/admin/metrics", CommonParams.WT, "json", "group", "node", "type", "timer", "prefix", "CONTAINER.cores"), resp);
|
||||
values = resp.getValues();
|
||||
assertNotNull(values.get("metrics"));
|
||||
values = (NamedList) values.get("metrics");
|
||||
assertEquals(1, values.size());
|
||||
assertEquals(0, ((NamedList)values.get("solr.node")).size());
|
||||
SimpleOrderedMap map = (SimpleOrderedMap) values.get("metrics");
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(0, ((NamedList)map.get("solr.node")).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue