Process monitor refresh interval setting
This commit converts the process monitor refresh interval setting "monitor.process.refresh_interval" to the new settings infrastructure.
This commit is contained in:
parent
d13739fcb9
commit
4eed71cad2
|
@ -68,6 +68,7 @@ import org.elasticsearch.indices.recovery.RecoverySettings;
|
|||
import org.elasticsearch.indices.store.IndicesStore;
|
||||
import org.elasticsearch.indices.ttl.IndicesTTLService;
|
||||
import org.elasticsearch.monitor.os.OsService;
|
||||
import org.elasticsearch.monitor.process.ProcessService;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
||||
import org.elasticsearch.repositories.fs.FsRepository;
|
||||
|
@ -319,6 +320,7 @@ public final class ClusterSettings extends AbstractScopedSettings {
|
|||
NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING,
|
||||
NodeEnvironment.ENABLE_LUCENE_SEGMENT_INFOS_TRACE_SETTING,
|
||||
NodeEnvironment.ADD_NODE_ID_TO_CUSTOM_PATH,
|
||||
OsService.REFRESH_INTERVAL_SETTING
|
||||
OsService.REFRESH_INTERVAL_SETTING,
|
||||
ProcessService.REFRESH_INTERVAL_SETTING
|
||||
)));
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.elasticsearch.monitor.process;
|
||||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.SingleObjectCache;
|
||||
|
@ -33,11 +34,14 @@ public final class ProcessService extends AbstractComponent {
|
|||
private final ProcessInfo info;
|
||||
private final SingleObjectCache<ProcessStats> processStatsCache;
|
||||
|
||||
public final static Setting<TimeValue> REFRESH_INTERVAL_SETTING =
|
||||
Setting.timeSetting("monitor.process.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false, Setting.Scope.CLUSTER);
|
||||
|
||||
public ProcessService(Settings settings) {
|
||||
super(settings);
|
||||
this.probe = ProcessProbe.getInstance();
|
||||
|
||||
final TimeValue refreshInterval = settings.getAsTime("monitor.process.refresh_interval", TimeValue.timeValueSeconds(1));
|
||||
final TimeValue refreshInterval = REFRESH_INTERVAL_SETTING.get(settings);
|
||||
processStatsCache = new ProcessStatsCache(refreshInterval, probe.processStats());
|
||||
this.info = probe.processInfo();
|
||||
this.info.refreshInterval = refreshInterval.millis();
|
||||
|
|
Loading…
Reference in New Issue