Merge pull request elastic/elasticsearch#448 from martijnvg/marvel/fix/dynamic_settings_change

Fixed compile errors due to upstream change

Original commit: elastic/x-pack-elasticsearch@58c2f6669f
This commit is contained in:
Martijn van Groningen 2015-08-17 15:18:00 +02:00
commit a8825fc3ed
4 changed files with 24 additions and 26 deletions

View File

@ -7,12 +7,16 @@ package org.elasticsearch.marvel;
import com.google.common.collect.ImmutableList;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterModule;
import org.elasticsearch.cluster.settings.Validator;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.marvel.agent.AgentService;
import org.elasticsearch.marvel.agent.exporter.HttpESExporter;
import org.elasticsearch.marvel.agent.settings.MarvelSettingsService;
import org.elasticsearch.marvel.license.LicenseService;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.tribe.TribeService;
@ -75,4 +79,23 @@ public class MarvelPlugin extends AbstractPlugin {
}
return settings.getAsBoolean(ENABLED, true);
}
public void onModule(ClusterModule module) {
// AgentService
module.registerClusterDynamicSetting(AgentService.SETTINGS_INTERVAL, Validator.EMPTY);
module.registerClusterDynamicSetting(AgentService.SETTINGS_STATS_TIMEOUT, Validator.EMPTY);
// HttpESExporter
module.registerClusterDynamicSetting(HttpESExporter.SETTINGS_HOSTS, Validator.EMPTY);
module.registerClusterDynamicSetting(HttpESExporter.SETTINGS_HOSTS + ".*", Validator.EMPTY);
module.registerClusterDynamicSetting(HttpESExporter.SETTINGS_TIMEOUT, Validator.EMPTY);
module.registerClusterDynamicSetting(HttpESExporter.SETTINGS_READ_TIMEOUT, Validator.EMPTY);
module.registerClusterDynamicSetting(HttpESExporter.SETTINGS_SSL_HOSTNAME_VERIFICATION, Validator.EMPTY);
// MarvelSettingsService
module.registerClusterDynamicSetting(MarvelSettingsService.CLUSTER_STATE_TIMEOUT, Validator.EMPTY);
module.registerClusterDynamicSetting(MarvelSettingsService.CLUSTER_STATS_TIMEOUT, Validator.EMPTY);
module.registerClusterDynamicSetting(MarvelSettingsService.INDEX_RECOVERY_ACTIVE_ONLY, Validator.EMPTY);
module.registerClusterDynamicSetting(MarvelSettingsService.INDEX_RECOVERY_TIMEOUT, Validator.EMPTY);
module.registerClusterDynamicSetting(MarvelSettingsService.INDICES, Validator.EMPTY);
module.registerClusterDynamicSetting(MarvelSettingsService.INDEX_STATS_TIMEOUT, Validator.EMPTY);
}
}

View File

@ -6,8 +6,6 @@
package org.elasticsearch.marvel.agent;
import com.google.common.collect.ImmutableSet;
import org.elasticsearch.cluster.settings.ClusterDynamicSettings;
import org.elasticsearch.cluster.settings.DynamicSettings;
import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -43,7 +41,6 @@ public class AgentService extends AbstractLifecycleComponent<AgentService> imple
@Inject
public AgentService(Settings settings, NodeSettingsService nodeSettingsService,
@ClusterDynamicSettings DynamicSettings dynamicSettings,
LicenseService licenseService,
Set<Collector> collectors, Set<Exporter> exporters) {
super(settings);
@ -61,9 +58,6 @@ public class AgentService extends AbstractLifecycleComponent<AgentService> imple
}
nodeSettingsService.addListener(this);
dynamicSettings.addDynamicSetting(SETTINGS_INTERVAL);
dynamicSettings.addDynamicSetting(SETTINGS_STATS_TIMEOUT);
logger.trace("marvel is running in [{}] mode", licenseService.mode());
}

View File

@ -9,8 +9,6 @@ import com.google.common.io.ByteStreams;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.settings.ClusterDynamicSettings;
import org.elasticsearch.cluster.settings.DynamicSettings;
import org.elasticsearch.common.Base64;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;
@ -102,7 +100,6 @@ public class HttpESExporter extends AbstractExporter<HttpESExporter> implements
@Inject
public HttpESExporter(Settings settings, ClusterService clusterService, ClusterName clusterName,
@ClusterDynamicSettings DynamicSettings dynamicSettings,
NodeSettingsService nodeSettingsService,
NodeService nodeService, Environment environment,
RendererRegistry registry) {
@ -132,12 +129,6 @@ public class HttpESExporter extends AbstractExporter<HttpESExporter> implements
bulkTimeout = settings.getAsTime(SETTINGS_CHECK_TEMPLATE_TIMEOUT, null);
keepAliveWorker = new ConnectionKeepAliveWorker();
dynamicSettings.addDynamicSetting(SETTINGS_HOSTS);
dynamicSettings.addDynamicSetting(SETTINGS_HOSTS + ".*");
dynamicSettings.addDynamicSetting(SETTINGS_TIMEOUT);
dynamicSettings.addDynamicSetting(SETTINGS_READ_TIMEOUT);
dynamicSettings.addDynamicSetting(SETTINGS_SSL_HOSTNAME_VERIFICATION);
nodeSettingsService.addListener(this);
if (!settings.getByPrefix(SETTINGS_SSL_PREFIX).getAsMap().isEmpty()) {

View File

@ -6,8 +6,6 @@
package org.elasticsearch.marvel.agent.settings;
import com.google.common.collect.ImmutableList;
import org.elasticsearch.cluster.settings.ClusterDynamicSettings;
import org.elasticsearch.cluster.settings.DynamicSettings;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.inject.Inject;
@ -75,17 +73,9 @@ public class MarvelSettingsService extends AbstractComponent implements NodeSett
}
@Inject
public MarvelSettingsService(Settings clusterSettings, NodeSettingsService nodeSettingsService, @ClusterDynamicSettings DynamicSettings dynamicSettings) {
public MarvelSettingsService(Settings clusterSettings, NodeSettingsService nodeSettingsService) {
this(clusterSettings);
logger.trace("registering dynamic marvel settings:");
for (MarvelSetting setting : settings) {
if (setting.isDynamic()) {
logger.trace("dynamic setting [{}] registered", setting.getName());
dynamicSettings.addDynamicSetting(setting.dynamicSettingName());
}
}
logger.trace("registering the service as a node settings listener");
nodeSettingsService.addListener(this);
}