mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
OS monitor refresh interval setting
This commit converts the OS monitor refresh interval setting "monitor.os.refresh_interval" to the new settings infrastructure.
This commit is contained in:
parent
74a1959c3b
commit
d13739fcb9
@ -67,6 +67,7 @@ import org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache;
|
|||||||
import org.elasticsearch.indices.recovery.RecoverySettings;
|
import org.elasticsearch.indices.recovery.RecoverySettings;
|
||||||
import org.elasticsearch.indices.store.IndicesStore;
|
import org.elasticsearch.indices.store.IndicesStore;
|
||||||
import org.elasticsearch.indices.ttl.IndicesTTLService;
|
import org.elasticsearch.indices.ttl.IndicesTTLService;
|
||||||
|
import org.elasticsearch.monitor.os.OsService;
|
||||||
import org.elasticsearch.node.Node;
|
import org.elasticsearch.node.Node;
|
||||||
import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
||||||
import org.elasticsearch.repositories.fs.FsRepository;
|
import org.elasticsearch.repositories.fs.FsRepository;
|
||||||
@ -317,5 +318,7 @@ public final class ClusterSettings extends AbstractScopedSettings {
|
|||||||
ESLoggerFactory.LOG_LEVEL_SETTING,
|
ESLoggerFactory.LOG_LEVEL_SETTING,
|
||||||
NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING,
|
NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING,
|
||||||
NodeEnvironment.ENABLE_LUCENE_SEGMENT_INFOS_TRACE_SETTING,
|
NodeEnvironment.ENABLE_LUCENE_SEGMENT_INFOS_TRACE_SETTING,
|
||||||
NodeEnvironment.ADD_NODE_ID_TO_CUSTOM_PATH)));
|
NodeEnvironment.ADD_NODE_ID_TO_CUSTOM_PATH,
|
||||||
|
OsService.REFRESH_INTERVAL_SETTING
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package org.elasticsearch.monitor.os;
|
package org.elasticsearch.monitor.os;
|
||||||
|
|
||||||
import org.elasticsearch.common.component.AbstractComponent;
|
import org.elasticsearch.common.component.AbstractComponent;
|
||||||
|
import org.elasticsearch.common.settings.Setting;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.util.SingleObjectCache;
|
import org.elasticsearch.common.util.SingleObjectCache;
|
||||||
@ -36,11 +37,14 @@ public class OsService extends AbstractComponent {
|
|||||||
|
|
||||||
private SingleObjectCache<OsStats> osStatsCache;
|
private SingleObjectCache<OsStats> osStatsCache;
|
||||||
|
|
||||||
|
public final static Setting<TimeValue> REFRESH_INTERVAL_SETTING =
|
||||||
|
Setting.timeSetting("monitor.os.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false, Setting.Scope.CLUSTER);
|
||||||
|
|
||||||
public OsService(Settings settings) {
|
public OsService(Settings settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
this.probe = OsProbe.getInstance();
|
this.probe = OsProbe.getInstance();
|
||||||
|
|
||||||
TimeValue refreshInterval = settings.getAsTime("monitor.os.refresh_interval", TimeValue.timeValueSeconds(1));
|
TimeValue refreshInterval = REFRESH_INTERVAL_SETTING.get(settings);
|
||||||
|
|
||||||
this.info = probe.osInfo();
|
this.info = probe.osInfo();
|
||||||
this.info.refreshInterval = refreshInterval.millis();
|
this.info.refreshInterval = refreshInterval.millis();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user