Apache Solr open-source search software
SOLR-18091: Separate out core specific info into it's own CoreInfoHandler (#4084)
Eric Pugh64e029e465ca
diff --git a/changelog/unreleased/SOLR-18091.yml b/changelog/unreleased/SOLR-18091.ymlnew file mode 100644index 00000000000..2f8a72c21fd--- /dev/null+++ b/changelog/unreleased/SOLR-18091.yml@@ -0,0 +1,8 @@+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc+title: Provide seperate request handler SystemInfoHandler for /solr/admin/info/system from CoreInfoHandler for /solr/<collection-name>/admin/info+type: other # added, changed, fixed, deprecated, removed, dependency_update, security, other+authors:+ - name: Eric Pugh+links:+ - name: SOLR-18091+ url: https://issues.apache.org/jira/browse/SOLR-18091diff --git a/solr/api/src/java/org/apache/solr/client/api/model/NodeSystemResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/NodeSystemResponse.javaindex 09bc35f0867..efd73c269dc 100644--- a/solr/api/src/java/org/apache/solr/client/api/model/NodeSystemResponse.java+++ b/solr/api/src/java/org/apache/solr/client/api/model/NodeSystemResponse.java@@ -25,6 +25,7 @@ import java.util.Map;public class NodeSystemResponse extends SolrJerseyResponse {@JsonProperty public String mode;+ @JsonProperty public String host;@JsonProperty public String zkHost;@JsonProperty("solr_home")diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreInfoHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreInfoHandler.javanew file mode 100644index 00000000000..4433713209d--- /dev/null+++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreInfoHandler.java@@ -0,0 +1,91 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.solr.handler.admin;++import java.io.IOException;+import java.lang.invoke.MethodHandles;+import java.nio.file.Path;+import java.util.Date;+import org.apache.solr.common.util.SimpleOrderedMap;+import org.apache.solr.core.SolrCore;+import org.apache.solr.handler.RequestHandlerBase;+import org.apache.solr.request.SolrQueryRequest;+import org.apache.solr.response.SolrQueryResponse;+import org.apache.solr.schema.IndexSchema;+import org.apache.solr.security.AuthorizationContext;+import org.slf4j.Logger;+import org.slf4j.LoggerFactory;++/**+ * This handler returns core level info. See {@link org.apache.solr.handler.admin.SystemInfoHandler}+ */+public class CoreInfoHandler extends RequestHandlerBase {+ private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());++ @Override+ public String getDescription() {+ return "Get Core Info";+ }++ @Override+ public Category getCategory() {+ return Category.ADMIN;+ }++ @Override+ public Name getPermissionName(AuthorizationContext request) {+ return Name.CONFIG_READ_PERM;+ }++ @Override+ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {+ rsp.setHttpCaching(false);+ SolrCore core = req.getCore();++ rsp.add("core", getCoreInfo(core, req.getSchema()));+ }++ private SimpleOrderedMap<Object> getCoreInfo(SolrCore core, IndexSchema schema) {+ SimpleOrderedMap<Object> info = new SimpleOrderedMap<>();++ info.add("schema", schema != null ? schema.getSchemaName() : "no schema!");++ // Now+ info.add("now", new Date());++ // Start Time+ info.add("start", core.getStartTimeStamp());++ // Solr Home+ SimpleOrderedMap<Object> dirs = new SimpleOrderedMap<>();+ dirs.add("cwd", Path.of(System.getProperty("user.dir")).toAbsolutePath().toString());+ dirs.add("instance", core.getInstancePath().toString());+ try {+ dirs.add("data", core.getDirectoryFactory().normalize(core.getDataDir()));+ } catch (IOException e) {+ log.warn("Problem getting the normalized data directory path", e);+ }+ dirs.add("dirimpl", core.getDirectoryFactory().getClass().getName());+ try {+ dirs.add("index", core.getDirectoryFactory().normalize(core.getIndexDir()));+ } catch (IOException e) {+ log.warn("Problem getting the normalized index directory path", e);+ }+ info.add("directory", dirs);+ return info;+ }+}diff --git a/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.javaindex 18447eafac9..eb0079b5080 100644--- a/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java@@ -22,7 +22,6 @@ import java.beans.BeanInfo;import java.beans.IntrospectionException;import java.beans.Introspector;import java.beans.PropertyDescriptor;-import java.io.IOException;import java.lang.invoke.MethodHandles;import java.lang.management.ManagementFactory;import java.lang.management.OperatingSystemMXBean;@@ -30,7 +29,6 @@ import java.lang.management.PlatformManagedObject;import java.lang.management.RuntimeMXBean;import java.lang.reflect.Method;import java.net.InetAddress;-import java.nio.file.Path;import java.text.DecimalFormat;import java.text.DecimalFormatSymbols;import java.util.ArrayList;@@ -58,7 +56,6 @@ import org.apache.solr.handler.admin.api.NodeSystemInfoAPI;import org.apache.solr.metrics.GpuMetricsProvider;import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.response.SolrQueryResponse;-import org.apache.solr.schema.IndexSchema;import org.apache.solr.security.AuthorizationContext;import org.apache.solr.security.AuthorizationPlugin;import org.apache.solr.security.PKIAuthenticationPlugin;@@ -69,9 +66,8 @@ import org.slf4j.Logger;import org.slf4j.LoggerFactory;/**- * This handler returns system info- *- * @since solr 1.2+ * This handler returns node/container level info. See {@link+ * org.apache.solr.handler.admin.CoreInfoHandler}*/public class SystemInfoHandler extends RequestHandlerBase {private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());@@ -103,10 +99,6 @@ public class SystemInfoHandler extends RequestHandlerBase {private CoreContainer cc;- public SystemInfoHandler() {- this(null);- }-public SystemInfoHandler(CoreContainer cc) {super();this.cc = cc;@@ -218,13 +210,14 @@ public class SystemInfoHandler extends RequestHandlerBase {@Overridepublic void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {rsp.setHttpCaching(false);- SolrCore core = req.getCore();if (AdminHandlersProxy.maybeProxyToNodes(req, rsp, getCoreContainer(req))) {return; // Request was proxied to other node}- if (core != null) rsp.add("core", getCoreInfo(core, req.getSchema()));boolean solrCloudMode = getCoreContainer(req).isZooKeeperAware();rsp.add("mode", solrCloudMode ? "solrcloud" : "std");++ rsp.add("host", hostname);+if (solrCloudMode) {rsp.add("zkHost", getCoreContainer(req).getZkController().getZkServerAddress());}@@ -262,42 +255,6 @@ public class SystemInfoHandler extends RequestHandlerBase {return coreContainer == null ? cc : coreContainer;}- /** Get system info */- private SimpleOrderedMap<Object> getCoreInfo(SolrCore core, IndexSchema schema) {- SimpleOrderedMap<Object> info = new SimpleOrderedMap<>();-- info.add("schema", schema != null ? schema.getSchemaName() : "no schema!");-- // Host- info.add("host", hostname);-- // Now- info.add("now", new Date());-- // Start Time- info.add("start", core.getStartTimeStamp());-- // Solr Home- SimpleOrderedMap<Object> dirs = new SimpleOrderedMap<>();- dirs.add("cwd", Path.of(System.getProperty("user.dir")).toAbsolutePath().toString());- dirs.add("instance", core.getInstancePath().toString());- try {- dirs.add("data", core.getDirectoryFactory().normalize(core.getDataDir()));- } catch (IOException e) {- log.warn("Problem getting the normalized data directory path", e);- dirs.add("data", "N/A");- }- dirs.add("dirimpl", core.getDirectoryFactory().getClass().getName());- try {- dirs.add("index", core.getDirectoryFactory().normalize(core.getIndexDir()));- } catch (IOException e) {- log.warn("Problem getting the normalized index directory path", e);- dirs.add("index", "N/A");- }- info.add("directory", dirs);- return info;- }-/** Get system info */public static SimpleOrderedMap<Object> getSystemInfo() {SimpleOrderedMap<Object> info = new SimpleOrderedMap<>();@@ -480,13 +437,13 @@ public class SystemInfoHandler extends RequestHandlerBase {String newSizeAndUnits;if (bytes / ONE_GB > 0) {- newSizeAndUnits = String.valueOf(df.format((float) bytes / ONE_GB)) + " GB";+ newSizeAndUnits = df.format((float) bytes / ONE_GB) + " GB";} else if (bytes / ONE_MB > 0) {- newSizeAndUnits = String.valueOf(df.format((float) bytes / ONE_MB)) + " MB";+ newSizeAndUnits = df.format((float) bytes / ONE_MB) + " MB";} else if (bytes / ONE_KB > 0) {- newSizeAndUnits = String.valueOf(df.format((float) bytes / ONE_KB)) + " KB";+ newSizeAndUnits = df.format((float) bytes / ONE_KB) + " KB";} else {- newSizeAndUnits = String.valueOf(bytes) + " bytes";+ newSizeAndUnits = bytes + " bytes";}return newSizeAndUnits;diff --git a/solr/core/src/resources/ImplicitPlugins.json b/solr/core/src/resources/ImplicitPlugins.jsonindex eba9bd05ba0..83393194908 100644--- a/solr/core/src/resources/ImplicitPlugins.json+++ b/solr/core/src/resources/ImplicitPlugins.json@@ -73,9 +73,9 @@"class": "solr.LukeRequestHandler","useParams":"_ADMIN_LUKE"},- "/admin/system": {- "class": "solr.SystemInfoHandler",- "useParams":"_ADMIN_SYSTEM"+ "/admin/info": {+ "class": "solr.CoreInfoHandler",+ "useParams":"_ADMIN_CORE"},"/admin/file": {"class": "solr.ShowFileRequestHandler",diff --git a/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java b/solr/core/src/test/org/apache/solr/core/SolrCoreTest.javaindex 3e2d3589958..9fa63f89801 100644--- a/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java+++ b/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java@@ -101,7 +101,7 @@ public class SolrCoreTest extends SolrTestCaseJ4 {++ihCount;assertEquals(pathToClassMap.get("/admin/segments"), "solr.SegmentsInfoRequestHandler");++ihCount;- assertEquals(pathToClassMap.get("/admin/system"), "solr.SystemInfoHandler");+ assertEquals(pathToClassMap.get("/admin/info"), "solr.CoreInfoHandler");++ihCount;assertEquals(pathToClassMap.get("/config"), "solr.SolrConfigHandler");++ihCount;@@ -196,7 +196,7 @@ public class SolrCoreTest extends SolrTestCaseJ4 {c1.close();cores.shutdown();assertEquals("Refcount != 0", 0, core.getOpenCount());- assertTrue("Handler not closed", core.isClosed() && handler1.closed == true);+ assertTrue("Handler not closed", core.isClosed() && handler1.closed);}@Test@@ -263,7 +263,7 @@ public class SolrCoreTest extends SolrTestCaseJ4 {cores.shutdown();assertEquals("Refcount != 0", 0, core.getOpenCount());- assertTrue("Handler not closed", core.isClosed() && handler1.closed == true);+ assertTrue("Handler not closed", core.isClosed() && handler1.closed);service.shutdown();assertTrue("Running for too long...", service.awaitTermination(60, TimeUnit.SECONDS));diff --git a/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java b/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.javaindex c0efb0c3274..22eebed2e4b 100644--- a/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java+++ b/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java@@ -19,7 +19,6 @@ package org.apache.solr.core;import static java.util.Arrays.asList;import static org.apache.solr.common.util.Utils.getObjectByPath;-import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.StringReader;@@ -34,8 +33,6 @@ import java.util.Objects;import java.util.SortedMap;import java.util.TreeMap;import java.util.concurrent.TimeUnit;-import java.util.zip.ZipEntry;-import java.util.zip.ZipOutputStream;import org.apache.commons.io.file.PathUtils;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.client.solrj.impl.CloudSolrClient;@@ -66,9 +63,6 @@ public class TestSolrConfigHandler extends RestTestBase {private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());- private static final String collection = "collection1";- private static final String confDir = collection + "/conf";-public static ByteBuffer getFileContent(String f) throws IOException {return getFileContent(f, true);}@@ -89,31 +83,6 @@ public class TestSolrConfigHandler extends RestTestBase {return jar;}- public static ByteBuffer persistZip(String loc, Class<?>... classes) throws IOException {- ByteBuffer jar = generateZip(classes);- try (FileOutputStream fos = new FileOutputStream(loc)) {- fos.write(jar.array(), jar.arrayOffset(), jar.limit());- fos.flush();- }- return jar;- }-- public static ByteBuffer generateZip(Class<?>... classes) throws IOException {- Utils.BAOS bos = new Utils.BAOS();- try (ZipOutputStream zipOut = new ZipOutputStream(bos)) {- zipOut.setLevel(ZipOutputStream.DEFLATED);- for (Class<?> c : classes) {- String path = c.getName().replace('.', '/').concat(".class");- ZipEntry entry = new ZipEntry(path);- ByteBuffer b = Utils.toByteArray(c.getClassLoader().getResourceAsStream(path));- zipOut.putNextEntry(entry);- zipOut.write(b.array(), b.arrayOffset(), b.limit());- zipOut.closeEntry();- }- }- return bos.getByteBuffer();- }-@Beforepublic void before() throws Exception {Path tmpSolrHome = createTempDir();@@ -152,7 +121,7 @@ public class TestSolrConfigHandler extends RestTestBase {RestTestHarness harness = restTestHarness;MapWriter confMap = getRespMap("/config", harness);assertNotNull(confMap._get(asList("config", "requestHandler", "/admin/luke"), null));- assertNotNull(confMap._get(asList("config", "requestHandler", "/admin/system"), null));+ assertNotNull(confMap._get(asList("config", "requestHandler", "/admin/info"), null));assertNotNull(confMap._get(asList("config", "requestHandler", "/admin/file"), null));assertNotNull(confMap._get(asList("config", "requestHandler", "/admin/ping"), null));@@ -1009,7 +978,7 @@ public class TestSolrConfigHandler extends RestTestBase {public void testCacheDisableSolrConfig() throws Exception {RESTfulServerProvider oldProvider = restTestHarness.getServerProvider();- restTestHarness.setServerProvider(() -> getBaseUrl());+ restTestHarness.setServerProvider(RestTestBase::getBaseUrl);String prometheusMetrics = restTestHarness.query("/admin/metrics?wt=prometheus");assertTrue("fieldValueCache metrics should be present",@@ -1030,7 +999,7 @@ public class TestSolrConfigHandler extends RestTestBase {MapWriter overlay = getRespMap("/config/overlay", restTestHarness);assertEquals("399", overlay._getStr("overlay/props/query/documentCache/size"));// Setting size only will not enable the cache- restTestHarness.setServerProvider(() -> getBaseUrl());+ restTestHarness.setServerProvider(RestTestBase::getBaseUrl);String prometheusMetrics = restTestHarness.query("/admin/metrics?wt=prometheus");assertFalse(prometheusMetrics.contains("cache_name=\"documentCache\""));@@ -1043,7 +1012,7 @@ public class TestSolrConfigHandler extends RestTestBase {// Enabling CacheString payload = "{'set-property' : { 'query.documentCache.enabled': true} }";runConfigCommand(restTestHarness, "/config", payload);- restTestHarness.setServerProvider(() -> getBaseUrl());+ restTestHarness.setServerProvider(RestTestBase::getBaseUrl);String prometheusMetrics = restTestHarness.query("/admin/metrics?wt=prometheus");assertTrue(prometheusMetrics.contains("name=\"documentCache\""));@@ -1053,7 +1022,7 @@ public class TestSolrConfigHandler extends RestTestBase {restTestHarness.setServerProvider(oldProvider);runConfigCommand(restTestHarness, "/config", payload);- restTestHarness.setServerProvider(() -> getBaseUrl());+ restTestHarness.setServerProvider(RestTestBase::getBaseUrl);prometheusMetrics = restTestHarness.query("/admin/metrics?wt=prometheus");assertFalse(prometheusMetrics.contains("name=\"documentCache\""));diff --git a/solr/core/src/test/org/apache/solr/handler/admin/CoreInfoHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/admin/CoreInfoHandlerTest.javanew file mode 100644index 00000000000..39c8e964224--- /dev/null+++ b/solr/core/src/test/org/apache/solr/handler/admin/CoreInfoHandlerTest.java@@ -0,0 +1,120 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.solr.handler.admin;++import java.util.Date;+import org.apache.solr.SolrTestCaseJ4;+import org.apache.solr.common.util.NamedList;+import org.apache.solr.common.util.SimpleOrderedMap;+import org.apache.solr.core.SolrCore;+import org.apache.solr.request.SolrQueryRequest;+import org.apache.solr.response.SolrQueryResponse;+import org.junit.BeforeClass;+import org.junit.Test;++/** Test for {@link CoreInfoHandler} */+public class CoreInfoHandlerTest extends SolrTestCaseJ4 {++ @BeforeClass+ public static void beforeClass() throws Exception {+ initCore("solrconfig.xml", "schema.xml");+ }++ @Test+ public void testCoreInfoHandlerResponse() throws Exception {+ CoreInfoHandler handler = new CoreInfoHandler();+ SolrQueryRequest req = req();+ SolrQueryResponse rsp = new SolrQueryResponse();++ handler.handleRequestBody(req, rsp);++ NamedList<Object> values = rsp.getValues();+ assertNotNull("Response should not be null", values);++ @SuppressWarnings("unchecked")+ SimpleOrderedMap<Object> core = (SimpleOrderedMap<Object>) values.get("core");+ assertNotNull("Core info should not be null", core);++ // Verify schema name is present+ String schema = (String) core.get("schema");+ assertNotNull("Schema should not be null", schema);+ assertEquals("test", schema);++ // Verify 'now' date is present and reasonable+ Date now = (Date) core.get("now");+ assertNotNull("Now date should not be null", now);+ Date currentTime = new Date();+ long responseTime = now.getTime();+ assertTrue(+ "Response time should be close to current time",+ Math.abs(currentTime.getTime() - responseTime) < 5000); // within 5 seconds++ // Verify start time is present+ Date start = (Date) core.get("start");+ assertNotNull("Start time should not be null", start);+ assertTrue("Start time should be before or equal to now", start.getTime() <= now.getTime());++ // Verify directory info+ @SuppressWarnings("unchecked")+ SimpleOrderedMap<Object> directory = (SimpleOrderedMap<Object>) core.get("directory");+ assertNotNull("Directory info should not be null", directory);++ // Check all expected directory fields are present+ assertNotNull("cwd should not be null", directory.get("cwd"));+ assertNotNull("instance should not be null", directory.get("instance"));+ assertNotNull("data should not be null", directory.get("data"));+ assertNotNull("dirimpl should not be null", directory.get("dirimpl"));+ assertNotNull("index should not be null", directory.get("index"));++ assertFalse("HTTP caching should be disabled", rsp.isHttpCaching());++ req.close();+ }++ @Test+ public void testCoreInfoMatchesActualCore() throws Exception {+ CoreInfoHandler handler = new CoreInfoHandler();++ try (SolrQueryRequest req = req()) {+ SolrCore core = req.getCore();+ assertNotNull("Core should not be null", core);++ SolrQueryResponse rsp = new SolrQueryResponse();+ handler.handleRequestBody(req, rsp);++ @SuppressWarnings("unchecked")+ SimpleOrderedMap<Object> coreInfo = (SimpleOrderedMap<Object>) rsp.getValues().get("core");++ // Verify the schema name matches what we expect+ String schemaName = (String) coreInfo.get("schema");+ assertEquals("Schema name should match", core.getLatestSchema().getSchemaName(), schemaName);++ // Verify start time matches core's start time+ Date startTime = (Date) coreInfo.get("start");+ assertEquals(+ "Start time should match core start time",+ core.getStartTimeStamp().getTime(),+ startTime.getTime());++ // Verify instance path is correctly reported+ @SuppressWarnings("unchecked")+ SimpleOrderedMap<Object> directory = (SimpleOrderedMap<Object>) coreInfo.get("directory");+ String instancePath = (String) directory.get("instance");+ assertEquals("Instance path should match", core.getInstancePath().toString(), instancePath);+ }+ }+}diff --git a/solr/solr-ref-guide/modules/configuration-guide/config-nav.adoc b/solr/solr-ref-guide/modules/configuration-guide/config-nav.adocindex 3c939435b6a..efafa996ad2 100644--- a/solr/solr-ref-guide/modules/configuration-guide/config-nav.adoc+++ b/solr/solr-ref-guide/modules/configuration-guide/config-nav.adoc@@ -21,6 +21,7 @@* xref:property-substitution.adoc[]* xref:core-discovery.adoc[]* xref:configuring-solr-xml.adoc[]+* xref:system-info-handler.adoc[]* xref:solr-properties.adoc[]* xref:configuring-solrconfig-xml.adoc[]@@ -31,6 +32,7 @@** xref:caches-warming.adoc[]** xref:requesthandlers-searchcomponents.adoc[]** xref:implicit-requesthandlers.adoc[]+** xref:core-info-handler.adoc[]** xref:realtime-get.adoc[]** xref:initparams.adoc[]** xref:requestdispatcher.adoc[]diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/core-info-handler.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/core-info-handler.adocnew file mode 100644index 00000000000..a2bef630212--- /dev/null+++ b/solr/solr-ref-guide/modules/configuration-guide/pages/core-info-handler.adoc@@ -0,0 +1,182 @@+= Core Info Handler+// Licensed to the Apache Software Foundation (ASF) under one+// or more contributor license agreements. See the NOTICE file+// distributed with this work for additional information+// regarding copyright ownership. The ASF licenses this file+// to you under the Apache License, Version 2.0 (the+// "License"); you may not use this file except in compliance+// with the License. You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing,+// software distributed under the License is distributed on an+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+// KIND, either express or implied. See the License for the+// specific language governing permissions and limitations+// under the License.++This API provides the same information displayed on the Dashboard.++Core information is available via:++[source,bash]+----+http://localhost:8983/solr/<collection-name>/admin/info+----++The `core` key in the response is an object with these keys:++`schema`::+Schema name.++`host`::+Hostname. `null` if not available.++`start`::+Core start time.++`now`::+Current time on the core's host.++`directory`::+Object with directories relevant to the core.++== Core Information API Examples++Retrieve core information from a node in cloud mode.++[source.bash]+----+curl http://localhost:8983/solr/techproducts/admin/info+----++[source.json]+----+{+ "responseHeader":{+ "status":0,+ "QTime":9+ },+ "core":{+ "schema":"techprodducts",+ "now":"2026-01-31T17:47:54.199Z",+ "start":"2026-01-31T17:41:52.034Z",+ "directory":{+ "cwd":"/var/solr/server",+ "instance":"/var/solr/server/solr/techproducts_shard1_replica_n1",+ "data":"/var/solr/server/solr/techproducts_shard1_replica_n1/data",+ "dirimpl":"org.apache.solr.core.NRTCachingDirectoryFactory",+ "index":"/var/solr/server/solr/techproducts_shard1_replica_n1/data/index"+ }+ }+}+----++Retrieve system information from a core, without cloud mode.++[source.bash]+----+curl http://localhost:8983/solr/gettingstarted/admin/system+----++[source.json]+----+{+ "responseHeader":{+ "status":0,+ "QTime":23},+ "core":{+ "schema":"default-config",+ "host":"fd7fbdff8b3e",+ "now":"2019-07-18T11:56:51.472Z",+ "start":"2019-07-18T11:54:52.509Z",+ "directory":{+ "cwd":"/opt/solr-8.1.1/server",+ "instance":"/var/solr/data/gettingstarted",+ "data":"/var/solr/data/gettingstarted/data",+ "dirimpl":"org.apache.solr.core.NRTCachingDirectoryFactory",+ "index":"/var/solr/data/gettingstarted/data/index"}},+ "mode":"std",+ "lucene":{+ "solr-spec-version":"8.1.1",+ "solr-impl-version":"8.1.1 fcbe46c28cef11bc058779afba09521de1b19bef - ab - 2019-05-22 15:20:01",+ "lucene-spec-version":"8.1.1",+ "lucene-impl-version":"8.1.1 fcbe46c28cef11bc058779afba09521de1b19bef - ab - 2019-05-22 15:15:24"},+ "jvm":{+ "version":"11.0.3 11.0.3+7",+ "name":"Oracle Corporation OpenJDK 64-Bit Server VM",+ "spec":{+ "vendor":"Oracle Corporation",+ "name":"Java Platform API Specification",+ "version":"11"},+ "jre":{+ "vendor":"Oracle Corporation",+ "version":"11.0.3"},+ "vm":{+ "vendor":"Oracle Corporation",+ "name":"OpenJDK 64-Bit Server VM",+ "version":"11.0.3+7"},+ "processors":4,+ "memory":{+ "free":"394.9 MB",+ "total":"512 MB",+ "max":"512 MB",+ "used":"117.1 MB (%22.9)",+ "raw":{+ "free":414074904,+ "total":536870912,+ "max":536870912,+ "used":122796008,+ "used%":22.87253886461258}},+ "jmx":{+ "classpath":"start.jar",+ "commandLineArgs":["-Xms512m",+ "-Xmx512m",+ "-XX:+UseG1GC",+ "-XX:+PerfDisableSharedMem",+ "-XX:+ParallelRefProcEnabled",+ "-XX:MaxGCPauseMillis=250",+ "-XX:+UseLargePages",+ "-XX:+AlwaysPreTouch",+ "-Xlog:gc*:file=/var/solr/logs/solr_gc.log:time,uptime:filecount=9,filesize=20M",+ "-Dcom.sun.management.jmxremote",+ "-Dcom.sun.management.jmxremote.local.only=false",+ "-Dcom.sun.management.jmxremote.ssl=false",+ "-Dcom.sun.management.jmxremote.authenticate=false",+ "-Dcom.sun.management.jmxremote.port=18983",+ "-Dcom.sun.management.jmxremote.rmi.port=18983",+ "-Dsolr.logs.dir=/var/solr/logs",+ "-Dsolr.port.listen=8983",+ "-DSTOP.PORT=7983",+ "-DSTOP.KEY=solrrocks",+ "-Duser.timezone=UTC",+ "-Djetty.home=/opt/solr/server",+ "-Dsolr.solr.home=/var/solr/data",+ "-Dsolr.data.home=",+ "-Dsolr.install.dir=/opt/solr",+ "-Dsolr.configset.default.confdir=/opt/solr/server/solr/configsets/_default/conf",+ "-Dlog4j.configurationFile=file:/var/solr/log4j2.xml",+ "-Xss256k",+ "-Dsolr.jetty.https.port=8983"],+ "startTime":"2019-07-16T05:52:16.213Z",+ "upTimeMS":194675370}},+ "system":{+ "name":"Linux",+ "arch":"amd64",+ "availableProcessors":4,+ "systemLoadAverage":0.88,+ "version":"4.9.0-9-amd64",+ "committedVirtualMemorySize":4306059264,+ "freePhysicalMemorySize":144179200,+ "freeSwapSpaceSize":11626409984,+ "processCpuLoad":0.0,+ "processCpuTime":557920000000,+ "systemCpuLoad":0.0,+ "totalPhysicalMemorySize":4005376000,+ "totalSwapSpaceSize":12884897792,+ "maxFileDescriptorCount":1048576,+ "openFileDescriptorCount":223,+ "uname":"Linux fd7fbdff8b3e 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2019-06-16) x86_64 GNU/Linux\n",+ "uptime":" 11:56:51 up 28 days, 23:00, 0 users, load average: 0.88, 0.65, 0.62\n"}}+----diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/implicit-requesthandlers.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/implicit-requesthandlers.adocindex 85f25610a0a..05784283e4d 100644--- a/solr/solr-ref-guide/modules/configuration-guide/pages/implicit-requesthandlers.adoc+++ b/solr/solr-ref-guide/modules/configuration-guide/pages/implicit-requesthandlers.adoc@@ -103,19 +103,15 @@ Segments:: Return info on last commit generation Lucene index segments.|`solr/<collection>/admin/segments` |{solr-javadocs}/core/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.html[SegmentsInfoRequestHandler] |`_ADMIN_SEGMENTS`|===-System Info:: Return server statistics and settings.+Core Info:: Return core information.+-*Documentation*: xref:system-info-handler.adoc[]+*Documentation*: xref:core-info-handler.adoc[]+[cols="3*.",frame=none,grid=cols,options="header"]|===|API Endpoints |Class & Javadocs |Paramset-|v1: `solr/admin/info/system`--v2: `api/node/system` |{solr-javadocs}/core/org/apache/solr/handler/admin/SystemInfoHandler.html[SystemInfoHandler] |`_ADMIN_SYSTEM`+|v1: `solr/<collection>/admin/info`|{solr-javadocs}/core/org/apache/solr/handler/admin/CoreInfoHandler.html[CoreInfoHandler] ||===-+-This endpoint can also take the collection or core name in the path (`solr/<collection>/admin/system` or `solr/<core>/admin/system`) which will include all of the system-level information and additional information about the specific core that served the request.Threads:: Return info on all JVM threads.+diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/system-info-handler.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/system-info-handler.adocindex 98c9acff0ae..6d55650a948 100644--- a/solr/solr-ref-guide/modules/configuration-guide/pages/system-info-handler.adoc+++ b/solr/solr-ref-guide/modules/configuration-guide/pages/system-info-handler.adoc@@ -18,22 +18,13 @@This API provides the same information displayed on the Dashboard.-System information is available via two different URLs:+System information is available via:[source,bash]----http://localhost:8983/solr/admin/info/system-----and--[source,bash]------http://localhost:8983/solr/<collection-name>/admin/system-------the only difference being populating the `core` key in the result.-The keys in the result are:`mode`::@@ -57,10 +48,6 @@ Zookeeper host, when running in cloud mode.`node`::Node name, when running cloud mode.-`core`::-An object containing basic information on the core, only present if-the core/collection name is provided-== Lucene and Solr Information ObjectThe `solr` key in the response is an object with these keys:@@ -103,23 +90,6 @@ The result of running `uname -a`. Not available on Windows.`uptime`::The result of running `uptime`. Not available on Windows.-== Core Information Object--`schema`::-Schema name.--`host`::-Hostname. `null` if not available.--`start`::-Core start time.--`now`::-Current time on the core's host.--`directory`::-Object with directories relevant to the core.-== System Information API ExamplesRetrieve system information from a node in cloud mode.@@ -136,6 +106,7 @@ curl http://localhost:8983/solr/admin/info/system"status":0,"QTime":13},"mode":"solrcloud",+ "host":"localhost","zkHost":"192.168.32.3:2181","solr_home":"/var/solr/data","lucene":{diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SystemInfoResponse.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SystemInfoResponse.javaindex a34981dc16b..71274bfbf90 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SystemInfoResponse.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SystemInfoResponse.java@@ -96,6 +96,28 @@ public class SystemInfoResponse extends SolrResponseBase {return nodesInfo.get(node).mode;}+ /** Get the hostname from a single node system info */+ public String getHost() {+ if (nodesInfo.size() == 1) {+ return nodesInfo.values().stream().findFirst().orElseThrow().host;+ } else {+ throw new UnsupportedOperationException(+ "Multiple nodes system info available, use method 'getAllHosts', or 'getHostForNode(String)'.");+ }+ }++ /** Get all hostnames, per node */+ public Map<String, String> getAllHosts() {+ Map<String, String> allHosts = new HashMap<>();+ nodesInfo.forEach((key, value) -> allHosts.put(key, value.host));+ return allHosts;+ }++ /** Get the hostname for the given node name */+ public String getHostForNode(String node) {+ return nodesInfo.get(node).host;+ }+/** Get the ZK host from a single node system info */public String getZkHost() {if (nodesInfo.size() == 1) {diff --git a/solr/webapp/web/js/angular/controllers/core-overview.js b/solr/webapp/web/js/angular/controllers/core-overview.jsindex 8605411c371..4c97e6d12b0 100644--- a/solr/webapp/web/js/angular/controllers/core-overview.js+++ b/solr/webapp/web/js/angular/controllers/core-overview.js@@ -16,7 +16,7 @@*/solrAdminApp.controller('CoreOverviewController',-function($scope, $rootScope, $routeParams, Luke, CoreSystem, Update, Replication, Ping, Constants) {+function($scope, $rootScope, $routeParams, Luke, CoreInfo, Update, Replication, Ping, Constants) {$scope.resetMenu("overview", Constants.IS_CORE_PAGE);$scope.refreshIndex = function() {Luke.index({core: $routeParams.core},@@ -42,8 +42,8 @@ function($scope, $rootScope, $routeParams, Luke, CoreSystem, Update, Replication});};- $scope.refreshSystem = function() {- CoreSystem.get({core: $routeParams.core},+ $scope.refreshInfo = function() {+ CoreInfo.get({core: $routeParams.core},function(data) {$scope.core = data.core;delete $scope.systemMessage;@@ -86,10 +86,9 @@ function($scope, $rootScope, $routeParams, Luke, CoreSystem, Update, Replication$scope.refresh = function() {$scope.refreshIndex();$scope.refreshReplication();- $scope.refreshSystem();+ $scope.refreshInfo();$scope.refreshPing();};$scope.refresh();});-diff --git a/solr/webapp/web/js/angular/services.js b/solr/webapp/web/js/angular/services.jsindex 67eaa42e21f..6af7cc8e309 100644--- a/solr/webapp/web/js/angular/services.js+++ b/solr/webapp/web/js/angular/services.js@@ -137,9 +137,9 @@ solrAdminServices.factory('System',"command": {params: {}}});}])-.factory('CoreSystem',+.factory('CoreInfo',['$resource', function($resource) {- return $resource(':core/admin/system', {wt:'json', core: "@core", _:Date.now()});+ return $resource(':core/admin/info', {wt:'json', core: "@core", _:Date.now()});}]).factory('Update',['$resource', function($resource) {