Search in sources :

Example 1 with SolrShardReporter

use of org.apache.solr.metrics.reporters.solr.SolrShardReporter in project lucene-solr by apache.

the class SolrMetricManager method loadShardReporters.

public void loadShardReporters(PluginInfo[] pluginInfos, SolrCore core) {
    // don't load for non-cloud cores
    if (core.getCoreDescriptor().getCloudDescriptor() == null) {
        return;
    }
    // prepare default plugin if none present in the config
    Map<String, String> attrs = new HashMap<>();
    attrs.put("name", "shardDefault");
    attrs.put("group", SolrInfoBean.Group.shard.toString());
    Map<String, Object> initArgs = new HashMap<>();
    initArgs.put("period", DEFAULT_CLOUD_REPORTER_PERIOD);
    String registryName = core.getCoreMetricManager().getRegistryName();
    // collect infos and normalize
    List<PluginInfo> infos = prepareCloudPlugins(pluginInfos, SolrInfoBean.Group.shard.toString(), SolrShardReporter.class.getName(), attrs, initArgs, null);
    for (PluginInfo info : infos) {
        try {
            SolrMetricReporter reporter = loadReporter(registryName, core.getResourceLoader(), info, String.valueOf(core.hashCode()));
            ((SolrShardReporter) reporter).setCore(core);
        } catch (Exception e) {
            log.warn("Could not load shard reporter, pluginInfo=" + info, e);
        }
    }
}
Also used : HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) SolrShardReporter(org.apache.solr.metrics.reporters.solr.SolrShardReporter) PluginInfo(org.apache.solr.core.PluginInfo) PatternSyntaxException(java.util.regex.PatternSyntaxException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1 PluginInfo (org.apache.solr.core.PluginInfo)1 SolrShardReporter (org.apache.solr.metrics.reporters.solr.SolrShardReporter)1