mirror of https://github.com/apache/lucene.git
SOLR-10224: Add disk total and disk free metrics.
This commit is contained in:
parent
09bd8612ce
commit
1192d396dd
|
@ -183,6 +183,8 @@ New Features
|
|||
|
||||
* SOLR-10076: Hide keystore and truststore passwords from /admin/info/* outputs. (Mano Kovacs via Mark Miller)
|
||||
|
||||
* SOLR-10224: Add disk total and disk free metrics. (ab)
|
||||
|
||||
Bug Fixes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -530,7 +530,8 @@ public class CoreContainer {
|
|||
|
||||
containerProperties.putAll(cfg.getSolrProperties());
|
||||
|
||||
// initialize gauges for reporting the number of cores
|
||||
// initialize gauges for reporting the number of cores and disk total/free
|
||||
|
||||
String registryName = SolrMetricManager.getRegistryName(SolrInfoMBean.Group.node);
|
||||
metricManager.registerGauge(registryName, () -> solrCores.getCores().size(),
|
||||
true, "loaded", SolrInfoMBean.Category.CONTAINER.toString(), "cores");
|
||||
|
@ -538,6 +539,10 @@ public class CoreContainer {
|
|||
true, "lazy",SolrInfoMBean.Category.CONTAINER.toString(), "cores");
|
||||
metricManager.registerGauge(registryName, () -> solrCores.getAllCoreNames().size() - solrCores.getCoreNames().size(),
|
||||
true, "unloaded",SolrInfoMBean.Category.CONTAINER.toString(), "cores");
|
||||
metricManager.registerGauge(registryName, () -> cfg.getCoreRootDirectory().toFile().getTotalSpace(),
|
||||
true, "totalSpace", SolrInfoMBean.Category.CONTAINER.toString(), "fs");
|
||||
metricManager.registerGauge(registryName, () -> cfg.getCoreRootDirectory().toFile().getUsableSpace(),
|
||||
true, "usableSpace", SolrInfoMBean.Category.CONTAINER.toString(), "fs");
|
||||
|
||||
if (isZooKeeperAware()) {
|
||||
metricManager.loadClusterReporters(cfg.getMetricReporterPlugins(), this);
|
||||
|
|
|
@ -30,6 +30,8 @@ import java.lang.reflect.Constructor;
|
|||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -1137,6 +1139,11 @@ public final class SolrCore implements SolrInfoMBean, SolrMetricProducer, Closea
|
|||
manager.registerGauge(registry, () -> getIndexSize(), true, "sizeInBytes", Category.INDEX.toString());
|
||||
manager.registerGauge(registry, () -> NumberUtils.readableSize(getIndexSize()), true, "size", Category.INDEX.toString());
|
||||
manager.registerGauge(registry, () -> coreDescriptor.getCoreContainer().getCoreNames(this), true, "aliases", Category.CORE.toString());
|
||||
// initialize disk total / free metrics
|
||||
Path dataDirPath = Paths.get(dataDir);
|
||||
File dataDirFile = dataDirPath.toFile();
|
||||
manager.registerGauge(registry, () -> dataDirFile.getTotalSpace(), true, "totalSpace", Category.CORE.toString(), "fs");
|
||||
manager.registerGauge(registry, () -> dataDirFile.getUsableSpace(), true, "usableSpace", Category.CORE.toString(), "fs");
|
||||
}
|
||||
|
||||
private Map<String,SolrInfoMBean> initInfoRegistry(String name, SolrConfig config) {
|
||||
|
|
|
@ -106,10 +106,12 @@ public class SolrClusterReporter extends SolrMetricReporter {
|
|||
add("os\\.FreeSwapSpaceSize");
|
||||
add("os\\.OpenFileDescriptorCount");
|
||||
add("threads\\.count");
|
||||
}})); // all metrics
|
||||
// XXX anything interesting here?
|
||||
//add(new SolrReporter.Specification(OVERSEER_GROUP, "node", SolrMetricManager.overridableRegistryName(SolrInfoMBean.Group.node.toString()),
|
||||
// Collections.emptySet())); // all metrics
|
||||
}}));
|
||||
add(new SolrReporter.Report(CLUSTER_GROUP, "node", SolrMetricManager.overridableRegistryName(SolrInfoMBean.Group.node.toString()),
|
||||
new HashSet<String>() {{
|
||||
add("CONTAINER\\.cores\\..*");
|
||||
add("CONTAINER\\.fs\\..*");
|
||||
}}));
|
||||
add(new SolrReporter.Report(CLUSTER_GROUP, "leader.$1", "solr\\.collection\\.(.*)\\.leader",
|
||||
new HashSet<String>(){{
|
||||
add("UPDATE\\./update/.*");
|
||||
|
|
|
@ -61,9 +61,10 @@ public class SolrShardReporter extends SolrMetricReporter {
|
|||
|
||||
public static final List<String> DEFAULT_FILTERS = new ArrayList(){{
|
||||
add("TLOG.*");
|
||||
add("CORE\\.fs.*");
|
||||
add("REPLICATION.*");
|
||||
add("INDEX.flush.*");
|
||||
add("INDEX.merge.major.*");
|
||||
add("INDEX\\.flush.*");
|
||||
add("INDEX\\.merge\\.major.*");
|
||||
add("UPDATE\\./update/.*requests");
|
||||
add("QUERY\\./select.*requests");
|
||||
}};
|
||||
|
|
Loading…
Reference in New Issue