From 12d10b07d720e22031416d9e8342fb1967dc7ca1 Mon Sep 17 00:00:00 2001 From: James Baiera Date: Wed, 20 Oct 2021 01:15:44 -0400 Subject: [PATCH] Deprecate Monitoring Settings (#79499) This PR deprecates all monitoring settings as well as adds deprecation info entries for each setting. Collecting and shipping monitoring data using the Monitoring plugin will be deprecated in 7.16 and will be removed at some point in the 8.x line after sufficient wait time. The recommended approach for collecting and shipping monitoring data going forward is to use Metricbeat. The recommended approach for alerting is Kibana alerting. --- .../collecting-monitoring-data.asciidoc | 4 + .../configuring-metricbeat.asciidoc | 5 + .../restore-snapshot.asciidoc | 1 + .../test/rest/ESRestTestCase.java | 3 +- x-pack/docs/build.gradle | 3 - .../smoketest/XDocsClientYamlTestSuiteIT.java | 5 - x-pack/plugin/build.gradle | 2 - .../collector/ccr/StatsCollectorTests.java | 3 + .../core/monitoring/MonitoringField.java | 2 +- .../xpack/deprecation/DeprecationChecks.java | 33 ++- .../deprecation/NodeDeprecationChecks.java | 225 ++++++++++++++++++ .../NodeDeprecationChecksTests.java | 157 ++++++++++++ .../enrich/EnrichStatsCollectorTests.java | 5 + .../smoketest/MlWithSecurityIT.java | 5 - .../qa/native-multi-node-tests/build.gradle | 1 - .../xpack/monitoring/Monitoring.java | 2 +- .../xpack/monitoring/MonitoringService.java | 6 +- .../xpack/monitoring/collector/Collector.java | 5 +- .../indices/IndexRecoveryCollector.java | 3 +- .../xpack/monitoring/exporter/Exporter.java | 14 +- .../exporter/http/HttpExporter.java | 30 ++- .../exporter/local/LocalExporter.java | 3 +- ...onitoringHistoryDurationSettingsTests.java | 6 + .../monitoring/MonitoringServiceTests.java | 8 + .../cleaner/CleanerServiceTests.java | 14 +- .../cluster/ClusterStatsCollectorTests.java | 9 + .../indices/IndexRecoveryCollectorTests.java | 11 + .../indices/IndexStatsCollectorTests.java | 6 + .../collector/ml/JobStatsCollectorTests.java | 6 + .../node/NodeStatsCollectorTests.java | 9 + .../shards/ShardsCollectorTests.java | 3 + .../exporter/ClusterAlertsUtilTests.java | 6 + .../monitoring/exporter/ExportersTests.java | 21 ++ .../http/HttpExporterResourceTests.java | 3 + .../exporter/http/HttpExporterTests.java | 90 +++++++ .../test/rest/AbstractXPackRestTest.java | 105 -------- .../TextStructureWithSecurityIT.java | 5 - .../MonitoringWithWatcherRestIT.java | 18 -- 38 files changed, 662 insertions(+), 175 deletions(-) diff --git a/docs/reference/monitoring/collecting-monitoring-data.asciidoc b/docs/reference/monitoring/collecting-monitoring-data.asciidoc index b43f4b82182ec..769387b8c06e9 100644 --- a/docs/reference/monitoring/collecting-monitoring-data.asciidoc +++ b/docs/reference/monitoring/collecting-monitoring-data.asciidoc @@ -55,7 +55,10 @@ For example, use the following APIs to review and change this setting: [source,console] ---------------------------------- GET _cluster/settings +---------------------------------- +[source,console] +---------------------------------- PUT _cluster/settings { "persistent": { @@ -63,6 +66,7 @@ PUT _cluster/settings } } ---------------------------------- +// TEST[warning:[xpack.monitoring.collection.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.] Alternatively, you can enable this setting in {kib}. In the side navigation, click *Monitoring*. If data collection is disabled, you are prompted to turn it diff --git a/docs/reference/monitoring/configuring-metricbeat.asciidoc b/docs/reference/monitoring/configuring-metricbeat.asciidoc index d8a5ba1b042f4..29b7bc5f38654 100644 --- a/docs/reference/monitoring/configuring-metricbeat.asciidoc +++ b/docs/reference/monitoring/configuring-metricbeat.asciidoc @@ -26,7 +26,10 @@ You can use the following APIs to review and change this setting: [source,console] ---------------------------------- GET _cluster/settings +---------------------------------- +[source,console] +---------------------------------- PUT _cluster/settings { "persistent": { @@ -34,6 +37,7 @@ PUT _cluster/settings } } ---------------------------------- +// TEST[warning:[xpack.monitoring.collection.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.] If {es} {security-features} are enabled, you must have `monitor` cluster privileges to view the cluster settings and `manage` cluster privileges to change them. @@ -201,6 +205,7 @@ PUT _cluster/settings } } ---------------------------------- +// TEST[warning:[xpack.monitoring.elasticsearch.collection.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.] If {es} {security-features} are enabled, you must have `monitor` cluster privileges to view the cluster settings and `manage` cluster privileges diff --git a/docs/reference/snapshot-restore/restore-snapshot.asciidoc b/docs/reference/snapshot-restore/restore-snapshot.asciidoc index eda412f0084e7..d12e803edda01 100644 --- a/docs/reference/snapshot-restore/restore-snapshot.asciidoc +++ b/docs/reference/snapshot-restore/restore-snapshot.asciidoc @@ -277,6 +277,7 @@ PUT _cluster/settings } } ---- +// TEST[warning:[xpack.monitoring.collection.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.] // TEST[continued] //// diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index d13588a7a8bd4..0b41adafb96c5 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -927,7 +927,8 @@ private void wipeClusterSettings() throws IOException { } else if (warnings.size() > 1) { return true; } else { - return warnings.get(0).startsWith("[transient settings removal]") == false; + return warnings.get(0).startsWith("[transient settings removal]") == false && + warnings.get(0).contains("xpack.monitoring") == false; } })); diff --git a/x-pack/docs/build.gradle b/x-pack/docs/build.gradle index c2a4ea7402810..1486ec7c8afa6 100644 --- a/x-pack/docs/build.gradle +++ b/x-pack/docs/build.gradle @@ -34,9 +34,6 @@ testClusters.matching { it.name == "integTest" }.configureEach { setting 'xpack.security.enabled', 'true' setting 'xpack.security.authc.api_key.enabled', 'true' setting 'xpack.security.authc.token.enabled', 'true' - // Disable monitoring exporters for the docs tests - setting 'xpack.monitoring.exporters._local.type', 'local' - setting 'xpack.monitoring.exporters._local.enabled', 'false' // disable the ILM history for doc tests to avoid potential lingering tasks that'd cause test flakiness setting 'indices.lifecycle.history_index_enabled', 'false' setting 'xpack.license.self_generated.type', 'trial' diff --git a/x-pack/docs/src/test/java/org/elasticsearch/smoketest/XDocsClientYamlTestSuiteIT.java b/x-pack/docs/src/test/java/org/elasticsearch/smoketest/XDocsClientYamlTestSuiteIT.java index a008bf1d59b26..099cf545f305a 100644 --- a/x-pack/docs/src/test/java/org/elasticsearch/smoketest/XDocsClientYamlTestSuiteIT.java +++ b/x-pack/docs/src/test/java/org/elasticsearch/smoketest/XDocsClientYamlTestSuiteIT.java @@ -120,11 +120,6 @@ protected boolean isWatcherTest() { return testName != null && (testName.contains("watcher/") || testName.contains("watcher\\")); } - @Override - protected boolean isMonitoringTest() { - return false; - } - @Override protected boolean isMachineLearningTest() { String testName = getTestName(); diff --git a/x-pack/plugin/build.gradle b/x-pack/plugin/build.gradle index 780fb3a6f8b1f..b97206ef18b80 100644 --- a/x-pack/plugin/build.gradle +++ b/x-pack/plugin/build.gradle @@ -192,8 +192,6 @@ testClusters.configureEach { setting 'xpack.security.enabled', 'true' setting 'xpack.watcher.enabled', 'false' // Integration tests are supposed to enable/disable exporters before/after each test - setting 'xpack.monitoring.exporters._local.type', 'local' - setting 'xpack.monitoring.exporters._local.enabled', 'false' setting 'xpack.security.authc.token.enabled', 'true' setting 'xpack.security.authc.api_key.enabled', 'true' setting 'xpack.security.transport.ssl.enabled', 'true' diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/StatsCollectorTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/StatsCollectorTests.java index cbb533c9491fe..9b1ad916c9d8d 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/StatsCollectorTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/StatsCollectorTests.java @@ -149,6 +149,9 @@ public void testDoCollect() throws Exception { assertThat(document.getType(), is(AutoFollowStatsMonitoringDoc.TYPE)); assertThat(document.getId(), nullValue()); assertThat(document.stats(), is(autoFollowStats)); + + assertWarnings("[xpack.monitoring.collection.ccr.stats.timeout] setting was deprecated in Elasticsearch and will be removed in " + + "a future release! See the breaking changes documentation for the next major version."); } private List mockStatuses() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/MonitoringField.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/MonitoringField.java index 2085457cd1b40..934e40b500757 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/MonitoringField.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/MonitoringField.java @@ -31,7 +31,7 @@ public final class MonitoringField { public static final Setting HISTORY_DURATION = timeSetting("xpack.monitoring.history.duration", TimeValue.timeValueHours(7 * 24), // default value (7 days) HISTORY_DURATION_MINIMUM, // minimum value - Setting.Property.Dynamic, Setting.Property.NodeScope); + Setting.Property.Dynamic, Setting.Property.NodeScope, Setting.Property.Deprecated); private MonitoringField() {} } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java index 2593f736bf39f..cece62ed0b853 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java @@ -48,7 +48,38 @@ private DeprecationChecks() { NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting, NodeDeprecationChecks::checkExporterUseIngestPipelineSettings, NodeDeprecationChecks::checkExporterPipelineMasterTimeoutSetting, - NodeDeprecationChecks::checkExporterCreateLegacyTemplateSetting + NodeDeprecationChecks::checkExporterCreateLegacyTemplateSetting, + NodeDeprecationChecks::checkMonitoringSettingHistoryDuration, + NodeDeprecationChecks::checkMonitoringSettingCollectIndexRecovery, + NodeDeprecationChecks::checkMonitoringSettingCollectIndices, + NodeDeprecationChecks::checkMonitoringSettingCollectCcrTimeout, + NodeDeprecationChecks::checkMonitoringSettingCollectEnrichStatsTimeout, + NodeDeprecationChecks::checkMonitoringSettingCollectIndexRecoveryStatsTimeout, + NodeDeprecationChecks::checkMonitoringSettingCollectIndexStatsTimeout, + NodeDeprecationChecks::checkMonitoringSettingCollectMlJobStatsTimeout, + NodeDeprecationChecks::checkMonitoringSettingCollectNodeStatsTimeout, + NodeDeprecationChecks::checkMonitoringSettingCollectClusterStatsTimeout, + NodeDeprecationChecks::checkMonitoringSettingExportersHost, + NodeDeprecationChecks::checkMonitoringSettingExportersBulkTimeout, + NodeDeprecationChecks::checkMonitoringSettingExportersConnectionTimeout, + NodeDeprecationChecks::checkMonitoringSettingExportersConnectionReadTimeout, + NodeDeprecationChecks::checkMonitoringSettingExportersAuthUsername, + NodeDeprecationChecks::checkMonitoringSettingExportersAuthPass, + NodeDeprecationChecks::checkMonitoringSettingExportersSSL, + NodeDeprecationChecks::checkMonitoringSettingExportersProxyBase, + NodeDeprecationChecks::checkMonitoringSettingExportersSniffEnabled, + NodeDeprecationChecks::checkMonitoringSettingExportersHeaders, + NodeDeprecationChecks::checkMonitoringSettingExportersTemplateTimeout, + NodeDeprecationChecks::checkMonitoringSettingExportersMasterTimeout, + NodeDeprecationChecks::checkMonitoringSettingExportersEnabled, + NodeDeprecationChecks::checkMonitoringSettingExportersType, + NodeDeprecationChecks::checkMonitoringSettingExportersAlertsEnabled, + NodeDeprecationChecks::checkMonitoringSettingExportersAlertsBlacklist, + NodeDeprecationChecks::checkMonitoringSettingExportersIndexNameTimeFormat, + NodeDeprecationChecks::checkMonitoringSettingDecommissionAlerts, + NodeDeprecationChecks::checkMonitoringSettingEsCollectionEnabled, + NodeDeprecationChecks::checkMonitoringSettingCollectionEnabled, + NodeDeprecationChecks::checkMonitoringSettingCollectionInterval ); static List> INDEX_SETTINGS_CHECKS = List.of( diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java index d9fede7274447..e3471d4df7a82 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java @@ -9,6 +9,7 @@ import org.elasticsearch.action.admin.cluster.node.info.PluginsAndModules; import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; +import org.elasticsearch.common.settings.SecureSetting; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; @@ -22,12 +23,28 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Set; +import java.util.function.Function; import java.util.stream.Collectors; import static org.elasticsearch.xpack.core.security.authc.RealmSettings.RESERVED_REALM_NAME_PREFIX; public class NodeDeprecationChecks { + static DeprecationIssue checkDeprecatedSetting(final Settings settings, final Setting deprecatedSetting, final String url, + final String whenRemoved) { + if (deprecatedSetting.exists(settings) == false) { + return null; + } + final String deprecatedSettingKey = deprecatedSetting.getKey(); + final String value = deprecatedSetting.get(settings).toString(); + final String message = + String.format(Locale.ROOT, "setting [%s] is deprecated and will be removed " + whenRemoved, deprecatedSettingKey); + final String details = + String.format(Locale.ROOT, "the setting [%s] is currently set to [%s], remove this setting", deprecatedSettingKey, value); + return new DeprecationIssue(DeprecationIssue.Level.WARNING, message, url, details, false, null); + } + static DeprecationIssue checkRemovedSetting(final Settings settings, final Setting removedSetting, final String url) { if (removedSetting.exists(settings) == false) { return null; @@ -116,6 +133,214 @@ private static DeprecationIssue deprecatedAffixSetting(Setting.AffixSetting d return new DeprecationIssue(warningLevel, message, url, details, false, null); } + private static DeprecationIssue deprecatedAffixGroupedSetting(Setting.AffixSetting deprecatedAffixSetting, + String detailPattern, String url, DeprecationIssue.Level warningLevel, + Settings settings) { + List> deprecatedConcreteSettings = deprecatedAffixSetting.getAllConcreteSettings(settings) + .sorted(Comparator.comparing(Setting::getKey)).collect(Collectors.toList()); + + if (deprecatedConcreteSettings.isEmpty()) { + return null; + } + + // The concrete setting names that are the root of the grouped settings (with asterisk appended for display) + final String groupSettingNames = deprecatedConcreteSettings.stream() + .map(Setting::getKey) + .map(key -> key + "*") + .collect(Collectors.joining(",")); + // The actual group setting that are present in the settings object, with full setting name prepended. + String allSubSettings = deprecatedConcreteSettings.stream().map(affixSetting -> { + String groupPrefix = affixSetting.getKey(); + Settings groupSettings = affixSetting.get(settings); + Set subSettings = groupSettings.keySet(); + return subSettings.stream().map(key -> groupPrefix + key).collect(Collectors.joining(",")); + }).collect(Collectors.joining(";")); + + final String message = String.format( + Locale.ROOT, + "The [%s] settings are deprecated and will be removed after 8.0", + groupSettingNames + ); + final String details = String.format(Locale.ROOT, detailPattern, allSubSettings); + + return new DeprecationIssue(warningLevel, message, url, details, false, null); + } + + private static final String MONITORING_SETTING_DEPRECATION_LINK = "https://ela.st/es-deprecation-7-monitoring-settings"; + private static final String MONITORING_SETTING_REMOVAL_TIME = "after 8.0"; + + static DeprecationIssue genericMonitoringSetting(final Settings settings, final Setting deprecated) { + return checkDeprecatedSetting(settings, deprecated, MONITORING_SETTING_DEPRECATION_LINK, MONITORING_SETTING_REMOVAL_TIME); + } + + static DeprecationIssue genericMonitoringAffixSetting(final Settings settings, final String deprecatedSuffix) { + return deprecatedAffixSetting( + Setting.affixKeySetting("xpack.monitoring.exporters.", deprecatedSuffix, + (Function>) Setting::simpleString), + "Remove the following settings from elasticsearch.yml: [%s]", + MONITORING_SETTING_DEPRECATION_LINK, + DeprecationIssue.Level.WARNING, + settings); + } + + static DeprecationIssue genericMonitoringAffixSecureSetting(final Settings settings, final String deprecatedSuffix) { + return deprecatedAffixSetting( + Setting.affixKeySetting("xpack.monitoring.exporters.", deprecatedSuffix, + k -> SecureSetting.secureString(k, null)), + "Remove the following settings from the keystore: [%s]", + MONITORING_SETTING_DEPRECATION_LINK, + DeprecationIssue.Level.WARNING, + settings); + } + + static DeprecationIssue genericMonitoringAffixGroupedSetting(final Settings settings, final String deprecatedSuffix) { + return deprecatedAffixGroupedSetting( + Setting.affixKeySetting("xpack.monitoring.exporters.", deprecatedSuffix, k -> Setting.groupSetting(k + ".")), + "Remove the following settings from elasticsearch.yml: [%s]", + MONITORING_SETTING_DEPRECATION_LINK, + DeprecationIssue.Level.WARNING, + settings); + } + + static DeprecationIssue checkMonitoringSettingHistoryDuration(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.history.duration")); + } + + static DeprecationIssue checkMonitoringSettingCollectIndexRecovery(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.index.recovery.active_only")); + } + + static DeprecationIssue checkMonitoringSettingCollectIndices(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.indices")); + } + + static DeprecationIssue checkMonitoringSettingCollectCcrTimeout(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.ccr.stats.timeout")); + } + + static DeprecationIssue checkMonitoringSettingCollectEnrichStatsTimeout(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.enrich.stats.timeout")); + } + + static DeprecationIssue checkMonitoringSettingCollectIndexRecoveryStatsTimeout(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.index.recovery.timeout")); + } + + static DeprecationIssue checkMonitoringSettingCollectIndexStatsTimeout(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.index.stats.timeout")); + } + + static DeprecationIssue checkMonitoringSettingCollectMlJobStatsTimeout(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.ml.job.stats.timeout")); + } + + static DeprecationIssue checkMonitoringSettingCollectNodeStatsTimeout(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.node.stats.timeout")); + } + + static DeprecationIssue checkMonitoringSettingCollectClusterStatsTimeout(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.cluster.stats.timeout")); + } + + static DeprecationIssue checkMonitoringSettingExportersHost(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "host"); + } + + static DeprecationIssue checkMonitoringSettingExportersBulkTimeout(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "bulk.timeout"); + } + + static DeprecationIssue checkMonitoringSettingExportersConnectionTimeout(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "connection.timeout"); + } + + static DeprecationIssue checkMonitoringSettingExportersConnectionReadTimeout(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "connection.read_timeout"); + } + + static DeprecationIssue checkMonitoringSettingExportersAuthUsername(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "auth.username"); + } + + static DeprecationIssue checkMonitoringSettingExportersAuthPass(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSecureSetting(settings, "auth.secure_password"); + } + + static DeprecationIssue checkMonitoringSettingExportersSSL(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixGroupedSetting(settings, "ssl"); + } + + static DeprecationIssue checkMonitoringSettingExportersProxyBase(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "proxy.base_path"); + } + + static DeprecationIssue checkMonitoringSettingExportersSniffEnabled(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "sniff.enabled"); + } + + static DeprecationIssue checkMonitoringSettingExportersHeaders(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixGroupedSetting(settings, "headers"); + } + + static DeprecationIssue checkMonitoringSettingExportersTemplateTimeout(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "index.template.master_timeout"); + } + + static DeprecationIssue checkMonitoringSettingExportersMasterTimeout(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "wait_master.timeout"); + } + + static DeprecationIssue checkMonitoringSettingExportersEnabled(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "enabled"); + } + + static DeprecationIssue checkMonitoringSettingExportersType(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "type"); + } + + static DeprecationIssue checkMonitoringSettingExportersAlertsEnabled(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "cluster_alerts.management.enabled"); + } + + static DeprecationIssue checkMonitoringSettingExportersAlertsBlacklist(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "cluster_alerts.management.blacklist"); + } + + static DeprecationIssue checkMonitoringSettingExportersIndexNameTimeFormat(final Settings settings, + final PluginsAndModules pluginsAndModules) { + return genericMonitoringAffixSetting(settings, "index.name.time_format"); + } + + static DeprecationIssue checkMonitoringSettingDecommissionAlerts(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.migration.decommission_alerts")); + } + + static DeprecationIssue checkMonitoringSettingEsCollectionEnabled(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.elasticsearch.collection.enabled")); + } + + static DeprecationIssue checkMonitoringSettingCollectionEnabled(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.enabled")); + } + + static DeprecationIssue checkMonitoringSettingCollectionInterval(final Settings settings, final PluginsAndModules pluginsAndModules) { + return genericMonitoringSetting(settings, Setting.simpleString("xpack.monitoring.collection.interval")); + } + static DeprecationIssue checkExporterUseIngestPipelineSettings(final Settings settings, final PluginsAndModules pluginsAndModules) { return deprecatedAffixSetting(MonitoringDeprecatedSettings.USE_INGEST_PIPELINE_SETTING, "Remove the following settings from elasticsearch.yml: [%s]", diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java index 42088a0ba89c2..7e490157966d7 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java @@ -9,6 +9,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.settings.MockSecureSettings; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.TimeValue; @@ -140,6 +141,162 @@ public void testSingleDataNodeWatermarkSetting() { false, null))); } + void monitoringSetting(String settingKey, String value) { + Settings settings = Settings.builder() + .put(settingKey, value) + .build(); + List issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null)); + final String expectedUrl = "https://ela.st/es-deprecation-7-monitoring-settings"; + assertThat(issues, hasItem( + new DeprecationIssue(DeprecationIssue.Level.WARNING, + "setting ["+settingKey+"] is deprecated and will be removed after 8.0", + expectedUrl, + "the setting ["+settingKey+"] is currently set to ["+value+"], remove this setting", + false, null))); + } + + void monitoringExporterSetting(String suffix, String value) { + String settingKey = "xpack.monitoring.exporters.test." + suffix; + Settings settings = Settings.builder() + .put(settingKey, value) + .build(); + List issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null)); + final String expectedUrl = "https://ela.st/es-deprecation-7-monitoring-settings"; + assertThat(issues, hasItem( + new DeprecationIssue(DeprecationIssue.Level.WARNING, + "The ["+settingKey+"] settings are deprecated and will be removed after 8.0", + expectedUrl, + "Remove the following settings from elasticsearch.yml: ["+settingKey+"]", + false, null))); + } + + void monitoringExporterGroupedSetting(String suffix, String value) { + String settingKey = "xpack.monitoring.exporters.test." + suffix; + String subSettingKey = settingKey + ".subsetting"; + Settings settings = Settings.builder() + .put(subSettingKey, value) + .build(); + List issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null)); + final String expectedUrl = "https://ela.st/es-deprecation-7-monitoring-settings"; + assertThat(issues, hasItem( + new DeprecationIssue(DeprecationIssue.Level.WARNING, + "The ["+settingKey+".*] settings are deprecated and will be removed after 8.0", + expectedUrl, + "Remove the following settings from elasticsearch.yml: ["+subSettingKey+"]", + false, null))); + } + + void monitoringExporterSecureSetting(String suffix, String value) { + String settingKey = "xpack.monitoring.exporters.test." + suffix; + MockSecureSettings secureSettings = new MockSecureSettings(); + secureSettings.setString(settingKey, value); + Settings settings = Settings.builder() + .setSecureSettings(secureSettings) + .build(); + List issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null)); + final String expectedUrl = "https://ela.st/es-deprecation-7-monitoring-settings"; + assertThat(issues, hasItem( + new DeprecationIssue(DeprecationIssue.Level.WARNING, + "The ["+settingKey+"] settings are deprecated and will be removed after 8.0", + expectedUrl, + "Remove the following settings from the keystore: ["+settingKey+"]", + false, null))); + } + + public void testCheckMonitoringSettingHistoryDuration() { + monitoringSetting("xpack.monitoring.history.duration", "7d"); + } + public void testCheckMonitoringSettingCollectIndexRecovery() { + monitoringSetting("xpack.monitoring.collection.index.recovery.active_only", "true"); + } + public void testCheckMonitoringSettingCollectIndices() { + monitoringSetting("xpack.monitoring.collection.indices", "[test1,test2]"); + } + public void testCheckMonitoringSettingCollectCcrTimeout() { + monitoringSetting("xpack.monitoring.collection.ccr.stats.timeout", "10s"); + } + public void testCheckMonitoringSettingCollectEnrichStatsTimeout() { + monitoringSetting("xpack.monitoring.collection.enrich.stats.timeout", "10s"); + } + public void testCheckMonitoringSettingCollectIndexRecoveryStatsTimeout() { + monitoringSetting("xpack.monitoring.collection.index.recovery.timeout", "10s"); + } + public void testCheckMonitoringSettingCollectIndexStatsTimeout() { + monitoringSetting("xpack.monitoring.collection.index.stats.timeout", "10s"); + } + public void testCheckMonitoringSettingCollectMlJobStatsTimeout() { + monitoringSetting("xpack.monitoring.collection.ml.job.stats.timeout", "10s"); + } + public void testCheckMonitoringSettingCollectNodeStatsTimeout() { + monitoringSetting("xpack.monitoring.collection.node.stats.timeout", "10s"); + } + public void testCheckMonitoringSettingCollectClusterStatsTimeout() { + monitoringSetting("xpack.monitoring.collection.cluster.stats.timeout", "10s"); + } + public void testCheckMonitoringSettingExportersHost() { + monitoringExporterSetting("host", "abcdef"); + } + public void testCheckMonitoringSettingExportersBulkTimeout() { + monitoringExporterSetting("bulk.timeout", "10s"); + } + public void testCheckMonitoringSettingExportersConnectionTimeout() { + monitoringExporterSetting("connection.timeout", "10s"); + } + public void testCheckMonitoringSettingExportersConnectionReadTimeout() { + monitoringExporterSetting("connection.read_timeout", "10s"); + } + public void testCheckMonitoringSettingExportersAuthUsername() { + monitoringExporterSetting("auth.username", "abcdef"); + } + public void testCheckMonitoringSettingExportersAuthPass() { + monitoringExporterSecureSetting("auth.secure_password", "abcdef"); + } + public void testCheckMonitoringSettingExportersSSL() { + monitoringExporterGroupedSetting("ssl", "abcdef"); + } + public void testCheckMonitoringSettingExportersProxyBase() { + monitoringExporterSetting("proxy.base_path", "abcdef"); + } + public void testCheckMonitoringSettingExportersSniffEnabled() { + monitoringExporterSetting("sniff.enabled", "true"); + } + public void testCheckMonitoringSettingExportersHeaders() { + monitoringExporterGroupedSetting("headers", "abcdef"); + } + public void testCheckMonitoringSettingExportersTemplateTimeout() { + monitoringExporterSetting("index.template.master_timeout", "10s"); + } + public void testCheckMonitoringSettingExportersMasterTimeout() { + monitoringExporterSetting("wait_master.timeout", "10s"); + } + public void testCheckMonitoringSettingExportersEnabled() { + monitoringExporterSetting("enabled", "true"); + } + public void testCheckMonitoringSettingExportersType() { + monitoringExporterSetting("type", "local"); + } + public void testCheckMonitoringSettingExportersAlertsEnabled() { + monitoringExporterSetting("cluster_alerts.management.enabled", "true"); + } + public void testCheckMonitoringSettingExportersAlertsBlacklist() { + monitoringExporterSetting("cluster_alerts.management.blacklist", "[abcdef,ghijkl]"); + } + public void testCheckMonitoringSettingExportersIndexNameTimeFormat() { + monitoringExporterSetting("index.name.time_format", "yyyy-mm-dd"); + } + public void testCheckMonitoringSettingDecomissionAlerts() { + monitoringSetting("xpack.monitoring.migration.decommission_alerts", "true"); + } + public void testCheckMonitoringSettingEsCollectionEnabled() { + monitoringSetting("xpack.monitoring.elasticsearch.collection.enabled", "true"); + } + public void testCheckMonitoringSettingCollectionEnabled() { + monitoringSetting("xpack.monitoring.collection.enabled", "true"); + } + public void testCheckMonitoringSettingCollectionInterval() { + monitoringSetting("xpack.monitoring.collection.interval", "10s"); + } + public void testExporterUseIngestPipelineSettings() { Settings settings = Settings.builder() .put("xpack.monitoring.exporters.test.use_ingest", true) diff --git a/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/monitoring/collector/enrich/EnrichStatsCollectorTests.java b/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/monitoring/collector/enrich/EnrichStatsCollectorTests.java index 22352cd5ca2f5..386a2fa379c68 100644 --- a/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/monitoring/collector/enrich/EnrichStatsCollectorTests.java +++ b/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/monitoring/collector/enrich/EnrichStatsCollectorTests.java @@ -140,6 +140,11 @@ public void testDoCollect() throws Exception { assertThat(actual.getId(), nullValue()); assertThat(actual.getExecutingPolicy(), equalTo(expected)); } + + assertWarnings( + "[xpack.monitoring.collection.enrich.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version." + ); } private EnrichStatsCollector createCollector(ClusterService clusterService, XPackLicenseState licenseState, Client client) { diff --git a/x-pack/plugin/ml/qa/ml-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/MlWithSecurityIT.java b/x-pack/plugin/ml/qa/ml-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/MlWithSecurityIT.java index 1a3363fabe431..1676c3c385be9 100644 --- a/x-pack/plugin/ml/qa/ml-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/MlWithSecurityIT.java +++ b/x-pack/plugin/ml/qa/ml-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/MlWithSecurityIT.java @@ -54,11 +54,6 @@ protected Map getApiCallHeaders() { SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING)); } - @Override - protected boolean isMonitoringTest() { - return false; - } - @Override protected boolean isMachineLearningTest() { return true; diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle index 9ec7ee72f7848..a58a8569a1d45 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle @@ -40,7 +40,6 @@ testClusters.configureEach { testDistribution = 'DEFAULT' setting 'xpack.security.enabled', 'true' - setting 'xpack.monitoring.elasticsearch.collection.enabled', 'false' setting 'xpack.ml.enabled', 'true' setting 'xpack.watcher.enabled', 'false' setting 'xpack.security.authc.token.enabled', 'true' diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java index 14ece00b640dc..fb9f01713457d 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java @@ -78,7 +78,7 @@ public class Monitoring extends Plugin implements ActionPlugin, ReloadablePlugin { public static final Setting MIGRATION_DECOMMISSION_ALERTS = boolSetting("xpack.monitoring.migration.decommission_alerts", - false, Setting.Property.Dynamic, Setting.Property.NodeScope); + false, Setting.Property.Dynamic, Setting.Property.NodeScope, Setting.Property.Deprecated); public static final LicensedFeature.Momentary MONITORING_CLUSTER_ALERTS_FEATURE = LicensedFeature.momentary("monitoring", "cluster-alerts", License.OperationMode.STANDARD); diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringService.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringService.java index 76dbf8c2797c7..7c854fa5fc58c 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringService.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringService.java @@ -59,7 +59,7 @@ public class MonitoringService extends AbstractLifecycleComponent { */ public static final Setting ELASTICSEARCH_COLLECTION_ENABLED = Setting.boolSetting("xpack.monitoring.elasticsearch.collection.enabled", true, - Setting.Property.Dynamic, Setting.Property.NodeScope); + Setting.Property.Dynamic, Setting.Property.NodeScope, Setting.Property.Deprecated); /** * Dynamically controls enabling or disabling the collection of Monitoring data from Elasticsearch as well as other products @@ -67,14 +67,14 @@ public class MonitoringService extends AbstractLifecycleComponent { */ public static final Setting ENABLED = Setting.boolSetting("xpack.monitoring.collection.enabled", false, - Setting.Property.Dynamic, Setting.Property.NodeScope); + Setting.Property.Dynamic, Setting.Property.NodeScope, Setting.Property.Deprecated); /** * Sampling interval between two collections (default to 10s) */ public static final Setting INTERVAL = Setting.timeSetting("xpack.monitoring.collection.interval", TimeValue.timeValueSeconds(10), MIN_INTERVAL, - Setting.Property.Dynamic, Setting.Property.NodeScope); + Setting.Property.Dynamic, Setting.Property.NodeScope, Setting.Property.Deprecated); /** State of the monitoring service, either started or stopped **/ private final AtomicBoolean started = new AtomicBoolean(false); diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/Collector.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/Collector.java index 90002e720d1c4..9f9749e3c453f 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/Collector.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/Collector.java @@ -41,7 +41,8 @@ public abstract class Collector { * List of indices names whose stats will be exported (default to all indices) */ public static final Setting> INDICES = - listSetting(collectionSetting("indices"), emptyList(), Function.identity(), Property.Dynamic, Property.NodeScope); + listSetting(collectionSetting("indices"), emptyList(), Function.identity(), Property.Dynamic, Property.NodeScope, + Setting.Property.Deprecated); private final String name; private final Setting collectionTimeoutSetting; @@ -170,6 +171,6 @@ protected static String collectionSetting(final String settingName) { protected static Setting collectionTimeoutSetting(final String settingName) { String name = collectionSetting(settingName); - return timeSetting(name, TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); + return timeSetting(name, TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope, Property.Deprecated); } } diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexRecoveryCollector.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexRecoveryCollector.java index da6bb1e74440c..c44a28cc2c2c1 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexRecoveryCollector.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexRecoveryCollector.java @@ -43,7 +43,8 @@ public class IndexRecoveryCollector extends Collector { * Flag to indicate if only active recoveries should be collected (default to false: all recoveries are collected) */ public static final Setting INDEX_RECOVERY_ACTIVE_ONLY = - boolSetting(collectionSetting("index.recovery.active_only"), false, Setting.Property.Dynamic, Setting.Property.NodeScope); + boolSetting(collectionSetting("index.recovery.active_only"), false, Setting.Property.Dynamic, Setting.Property.NodeScope, + Setting.Property.Deprecated); private final Client client; diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporter.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporter.java index 26ee9eacfae2e..e778ea106c63f 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporter.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporter.java @@ -33,7 +33,7 @@ public abstract class Exporter implements AutoCloseable { private static final Setting.AffixSetting ENABLED_SETTING = Setting.affixKeySetting("xpack.monitoring.exporters.","enabled", - key -> Setting.boolSetting(key, true, Property.Dynamic, Property.NodeScope), TYPE_DEPENDENCY); + key -> Setting.boolSetting(key, true, Property.Dynamic, Property.NodeScope, Property.Deprecated), TYPE_DEPENDENCY); public static final Setting.AffixSetting TYPE_SETTING = Setting.affixKeySetting( "xpack.monitoring.exporters.", @@ -80,13 +80,14 @@ public Iterator> settings() { }, Property.Dynamic, - Property.NodeScope)); + Property.NodeScope, + Property.Deprecated)); /** * Every {@code Exporter} allows users to explicitly disable cluster alerts. */ public static final Setting.AffixSetting CLUSTER_ALERTS_MANAGEMENT_SETTING = Setting.affixKeySetting("xpack.monitoring.exporters.", "cluster_alerts.management.enabled", - key -> Setting.boolSetting(key, true, Property.Dynamic, Property.NodeScope), TYPE_DEPENDENCY); + key -> Setting.boolSetting(key, true, Property.Dynamic, Property.NodeScope, Property.Deprecated), TYPE_DEPENDENCY); /** * Every {@code Exporter} allows users to explicitly disable specific cluster alerts. *

@@ -94,8 +95,8 @@ public Iterator> settings() { */ public static final Setting.AffixSetting> CLUSTER_ALERTS_BLACKLIST_SETTING = Setting .affixKeySetting("xpack.monitoring.exporters.", "cluster_alerts.management.blacklist", - key -> Setting.listSetting(key, Collections.emptyList(), Function.identity(), Property.Dynamic, Property.NodeScope), - TYPE_DEPENDENCY); + key -> Setting.listSetting(key, Collections.emptyList(), Function.identity(), Property.Dynamic, Property.NodeScope, + Property.Deprecated), TYPE_DEPENDENCY); /** * Every {@code Exporter} allows users to use a different index time format. @@ -107,7 +108,8 @@ public Iterator> settings() { Exporter.INDEX_FORMAT, DateFormatter::forPattern, Property.Dynamic, - Property.NodeScope), TYPE_DEPENDENCY); + Property.NodeScope, + Property.Deprecated), TYPE_DEPENDENCY); private static final String INDEX_FORMAT = "yyyy.MM.dd"; diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java index 6733754be11e3..610fcc9917bac 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java @@ -170,7 +170,8 @@ public Iterator> settings() { }, Property.Dynamic, - Property.NodeScope), + Property.NodeScope, + Property.Deprecated), HTTP_TYPE_DEPENDENCY); /** @@ -178,7 +179,8 @@ public Iterator> settings() { */ public static final Setting.AffixSetting BULK_TIMEOUT_SETTING = Setting.affixKeySetting("xpack.monitoring.exporters.","bulk.timeout", - (key) -> Setting.timeSetting(key, TimeValue.MINUS_ONE, Property.Dynamic, Property.NodeScope), HTTP_TYPE_DEPENDENCY); + (key) -> Setting.timeSetting(key, TimeValue.MINUS_ONE, Property.Dynamic, Property.NodeScope, Property.Deprecated), + HTTP_TYPE_DEPENDENCY); /** * Timeout used for initiating a connection. */ @@ -186,7 +188,7 @@ public Iterator> settings() { Setting.affixKeySetting( "xpack.monitoring.exporters.", "connection.timeout", - (key) -> Setting.timeSetting(key, TimeValue.timeValueSeconds(6), Property.Dynamic, Property.NodeScope), + (key) -> Setting.timeSetting(key, TimeValue.timeValueSeconds(6), Property.Dynamic, Property.NodeScope, Property.Deprecated), HTTP_TYPE_DEPENDENCY); /** * Timeout used for reading from the connection. @@ -195,7 +197,8 @@ public Iterator> settings() { Setting.affixKeySetting( "xpack.monitoring.exporters.", "connection.read_timeout", - (key) -> Setting.timeSetting(key, TimeValue.timeValueSeconds(60), Property.Dynamic, Property.NodeScope), + (key) -> Setting.timeSetting(key, TimeValue.timeValueSeconds(60), Property.Dynamic, Property.NodeScope, + Property.Deprecated), HTTP_TYPE_DEPENDENCY); /** * Username for basic auth. @@ -239,7 +242,8 @@ public Iterator> settings() { }, Property.Dynamic, Property.NodeScope, - Property.Filtered), + Property.Filtered, + Property.Deprecated), HTTP_TYPE_DEPENDENCY); /** * Secure password for basic auth. @@ -248,7 +252,7 @@ public Iterator> settings() { Setting.affixKeySetting( "xpack.monitoring.exporters.", "auth.secure_password", - key -> SecureSetting.secureString(key, null), + key -> SecureSetting.secureString(key, null, Setting.Property.Deprecated), HTTP_TYPE_DEPENDENCY); /** * The SSL settings. @@ -259,7 +263,7 @@ public Iterator> settings() { Setting.affixKeySetting( "xpack.monitoring.exporters.", "ssl", - (key) -> Setting.groupSetting(key + ".", Property.Dynamic, Property.NodeScope, Property.Filtered), + (key) -> Setting.groupSetting(key + ".", Property.Dynamic, Property.NodeScope, Property.Filtered, Property.Deprecated), HTTP_TYPE_DEPENDENCY); /** @@ -280,14 +284,16 @@ public Iterator> settings() { } }, Property.Dynamic, - Property.NodeScope), + Property.NodeScope, + Property.Deprecated), HTTP_TYPE_DEPENDENCY); /** * A boolean setting to enable or disable sniffing for extra connections. */ public static final Setting.AffixSetting SNIFF_ENABLED_SETTING = Setting.affixKeySetting("xpack.monitoring.exporters.","sniff.enabled", - (key) -> Setting.boolSetting(key, false, Property.Dynamic, Property.NodeScope), HTTP_TYPE_DEPENDENCY); + (key) -> Setting.boolSetting(key, false, Property.Dynamic, Property.NodeScope, Property.Deprecated), + HTTP_TYPE_DEPENDENCY); /** * A parent setting to header key/value pairs, whose names are user defined. */ @@ -309,7 +315,8 @@ public Iterator> settings() { } }, Property.Dynamic, - Property.NodeScope), + Property.NodeScope, + Property.Deprecated), HTTP_TYPE_DEPENDENCY); /** * Blacklist of headers that the user is not allowed to set. @@ -322,7 +329,8 @@ public Iterator> settings() { */ public static final Setting.AffixSetting TEMPLATE_CHECK_TIMEOUT_SETTING = Setting.affixKeySetting("xpack.monitoring.exporters.","index.template.master_timeout", - (key) -> Setting.timeSetting(key, TimeValue.MINUS_ONE, Property.Dynamic, Property.NodeScope), HTTP_TYPE_DEPENDENCY); + (key) -> Setting.timeSetting(key, TimeValue.MINUS_ONE, Property.Dynamic, Property.NodeScope, Property.Deprecated), + HTTP_TYPE_DEPENDENCY); /** * Minimum supported version of the remote monitoring cluster (same major). */ diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java index 3ffac18519496..e3713b4c2260a 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java @@ -91,7 +91,8 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle public static final Setting.AffixSetting WAIT_MASTER_TIMEOUT_SETTING = Setting.affixKeySetting( "xpack.monitoring.exporters.", "wait_master.timeout", - (key) -> Setting.timeSetting(key, TimeValue.timeValueSeconds(30), Property.Dynamic, Property.NodeScope), TYPE_DEPENDENCY + (key) -> Setting.timeSetting(key, TimeValue.timeValueSeconds(30), Property.Dynamic, Property.NodeScope, Property.Deprecated), + TYPE_DEPENDENCY ); private final Client client; diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringHistoryDurationSettingsTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringHistoryDurationSettingsTests.java index 9833ceae566ef..f9499966631da 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringHistoryDurationSettingsTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringHistoryDurationSettingsTests.java @@ -20,12 +20,16 @@ public void testHistoryDurationDefaults7Days() { assertEquals(sevenDays, MonitoringField.HISTORY_DURATION.get(Settings.EMPTY)); // Note: this verifies the semantics because this is taken for granted that it never returns null! assertEquals(sevenDays, MonitoringField.HISTORY_DURATION.get(buildSettings(MonitoringField.HISTORY_DURATION.getKey(), null))); + assertWarnings("[xpack.monitoring.history.duration] setting was deprecated in Elasticsearch and will be removed in a future " + + "release! See the breaking changes documentation for the next major version."); } public void testHistoryDurationMinimum24Hours() { // hit the minimum assertEquals(MonitoringField.HISTORY_DURATION_MINIMUM, MonitoringField.HISTORY_DURATION.get(buildSettings(MonitoringField.HISTORY_DURATION.getKey(), "24h"))); + assertWarnings("[xpack.monitoring.history.duration] setting was deprecated in Elasticsearch and will be removed in a future " + + "release! See the breaking changes documentation for the next major version."); } public void testHistoryDurationMinimum24HoursBlocksLower() { @@ -33,6 +37,8 @@ public void testHistoryDurationMinimum24HoursBlocksLower() { final String oneSecondEarly = (MonitoringField.HISTORY_DURATION_MINIMUM.millis() - 1) + "ms"; expectThrows(IllegalArgumentException.class, () -> MonitoringField.HISTORY_DURATION.get(buildSettings(MonitoringField.HISTORY_DURATION.getKey(), oneSecondEarly))); + assertWarnings("[xpack.monitoring.history.duration] setting was deprecated in Elasticsearch and will be removed in a future " + + "release! See the breaking changes documentation for the next major version."); } private Settings buildSettings(String key, String value) { diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringServiceTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringServiceTests.java index ea6be8f685135..e6c134512e0e7 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringServiceTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringServiceTests.java @@ -118,6 +118,8 @@ public void testInterval() throws Exception { // take down threads monitoringService.setMonitoringActive(false); + assertWarnings("[xpack.monitoring.collection.interval] setting was deprecated in Elasticsearch and will be removed in " + + "a future release! See the breaking changes documentation for the next major version."); } public void testSkipExecution() throws Exception { @@ -141,6 +143,12 @@ public void testSkipExecution() throws Exception { latch.countDown(); assertThat(exporter.getExportsCount(), equalTo(1)); + assertWarnings( + "[xpack.monitoring.collection.enabled] setting was deprecated in Elasticsearch and will be removed in " + + "a future release! See the breaking changes documentation for the next major version.", + "[xpack.monitoring.collection.interval] setting was deprecated in Elasticsearch and will be removed in " + + "a future release! See the breaking changes documentation for the next major version." + ); } class CountingExporter extends Exporters { diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/cleaner/CleanerServiceTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/cleaner/CleanerServiceTests.java index 380e075a44a28..8563bd55e72ab 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/cleaner/CleanerServiceTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/cleaner/CleanerServiceTests.java @@ -53,10 +53,15 @@ public void testConstructorWithInvalidRetention() { // invalid setting expectedException.expect(IllegalArgumentException.class); - TimeValue expected = TimeValue.timeValueHours(1); - Settings settings = Settings.builder().put(MonitoringField.HISTORY_DURATION.getKey(), expected.getStringRep()).build(); + try { + TimeValue expected = TimeValue.timeValueHours(1); + Settings settings = Settings.builder().put(MonitoringField.HISTORY_DURATION.getKey(), expected.getStringRep()).build(); - new CleanerService(settings, clusterSettings, threadPool, licenseState); + new CleanerService(settings, clusterSettings, threadPool, licenseState); + } finally { + assertWarnings("[xpack.monitoring.history.duration] setting was deprecated in Elasticsearch and will be removed in " + + "a future release! See the breaking changes documentation for the next major version."); + } } public void testGetRetention() { @@ -64,6 +69,9 @@ public void testGetRetention() { Settings settings = Settings.builder().put(MonitoringField.HISTORY_DURATION.getKey(), expected.getStringRep()).build(); assertEquals(expected, new CleanerService(settings, clusterSettings, threadPool, licenseState).getRetention()); + + assertWarnings("[xpack.monitoring.history.duration] setting was deprecated in Elasticsearch and will be removed in " + + "a future release! See the breaking changes documentation for the next major version."); } public void testSetGlobalRetention() { diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStatsCollectorTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStatsCollectorTests.java index 0ac2de54d078a..9dc3a648bf3dc 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStatsCollectorTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStatsCollectorTests.java @@ -269,6 +269,9 @@ public void testDoCollect() throws Exception { verify(licenseService, times(1)).getLicense(); verify(clusterAdminClient).prepareClusterStats(); verify(client).execute(same(XPackUsageAction.INSTANCE), any(XPackUsageRequest.class)); + + assertWarnings("[xpack.monitoring.collection.cluster.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } public void testDoCollectNoLicense() throws Exception { @@ -330,6 +333,9 @@ public void testDoCollectNoLicense() throws Exception { assertEquals(1, results.size()); final ClusterStatsMonitoringDoc doc = (ClusterStatsMonitoringDoc) results.iterator().next(); assertThat(doc.getLicense(), nullValue()); + + assertWarnings("[xpack.monitoring.collection.cluster.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } public void testDoCollectThrowsTimeoutException() throws Exception { @@ -383,6 +389,9 @@ public void testDoCollectThrowsTimeoutException() throws Exception { new ClusterStatsCollector(settings.build(), clusterService, licenseState, client, licenseService, indexNameExpressionResolver); expectThrows(ElasticsearchTimeoutException.class, () -> collector.doCollect(node, interval, clusterState)); + + assertWarnings("[xpack.monitoring.collection.cluster.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } } diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexRecoveryCollectorTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexRecoveryCollectorTests.java index 4243bdc7a3a03..7e7107249d7c6 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexRecoveryCollectorTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexRecoveryCollectorTests.java @@ -169,6 +169,14 @@ public void testDoCollect() throws Exception { assertThat(recoveries.hasRecoveries(), equalTo(true)); assertThat(recoveries.shardRecoveryStates().size(), equalTo(nbRecoveries)); } + + assertWarnings("[xpack.monitoring.collection.index.recovery.timeout] setting was deprecated in Elasticsearch and will be " + + "removed in a future release! See the breaking changes documentation for the next major version.", + "[xpack.monitoring.collection.index.recovery.active_only] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version.", + "[xpack.monitoring.collection.indices] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version." + ); } public void testDoCollectThrowsTimeoutException() throws Exception { @@ -211,6 +219,9 @@ public void testDoCollectThrowsTimeoutException() throws Exception { final long interval = randomNonNegativeLong(); expectThrows(ElasticsearchTimeoutException.class, () -> collector.doCollect(node, interval, clusterState)); + + assertWarnings("[xpack.monitoring.collection.index.recovery.timeout] setting was deprecated in Elasticsearch and will be " + + "removed in a future release! See the breaking changes documentation for the next major version."); } } diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexStatsCollectorTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexStatsCollectorTests.java index 6556b49b6ae7f..649fa603fffb8 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexStatsCollectorTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndexStatsCollectorTests.java @@ -170,6 +170,9 @@ public void testDoCollect() throws Exception { assertThat(indexStatsDocument.getIndexRoutingTable(), is(indicesRoutingTable.get(index))); } } + + assertWarnings("[xpack.monitoring.collection.index.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } public void testDoCollectThrowsTimeoutException() throws Exception { @@ -203,6 +206,9 @@ public void testDoCollectThrowsTimeoutException() throws Exception { final long interval = randomNonNegativeLong(); expectThrows(ElasticsearchTimeoutException.class, () -> collector.doCollect(node, interval, clusterState)); + + assertWarnings("[xpack.monitoring.collection.index.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } } diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/ml/JobStatsCollectorTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/ml/JobStatsCollectorTests.java index 03c19484c5db1..4b18beeb11a60 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/ml/JobStatsCollectorTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/ml/JobStatsCollectorTests.java @@ -141,6 +141,9 @@ public void testDoCollect() throws Exception { assertThat(jobStatsMonitoringDoc.getJobStats(), is(jobStat)); } + + assertWarnings("[xpack.monitoring.collection.ml.job.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } public void testDoCollectThrowsTimeoutException() throws Exception { @@ -170,6 +173,9 @@ public void testDoCollectThrowsTimeoutException() throws Exception { final long interval = randomNonNegativeLong(); expectThrows(ElasticsearchTimeoutException.class, () -> collector.doCollect(node, interval, clusterState)); + + assertWarnings("[xpack.monitoring.collection.ml.job.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } private List mockJobStats() { diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/node/NodeStatsCollectorTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/node/NodeStatsCollectorTests.java index 0b0a5276807e9..86faf853886af 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/node/NodeStatsCollectorTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/node/NodeStatsCollectorTests.java @@ -65,6 +65,9 @@ public void testDoCollectWithFailures() throws Exception { final FailedNodeException e = expectThrows(FailedNodeException.class, () -> collector.doCollect(randomMonitoringNode(random()), randomNonNegativeLong(), clusterState)); assertEquals(exception, e); + + assertWarnings("[xpack.monitoring.collection.node.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } public void testDoCollect() throws Exception { @@ -118,6 +121,9 @@ public void testDoCollect() throws Exception { assertThat(document.getNodeId(), equalTo(node.getUUID())); assertThat(document.getNodeStats(), is(nodeStats)); assertThat(document.isMlockall(), equalTo(BootstrapInfo.isMemoryLocked())); + + assertWarnings("[xpack.monitoring.collection.node.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } public void testDoCollectThrowsTimeout() throws Exception { @@ -146,6 +152,9 @@ public void testDoCollectThrowsTimeout() throws Exception { final long interval = randomNonNegativeLong(); expectThrows(ElasticsearchTimeoutException.class, () -> collector.doCollect(node, interval, clusterState)); + + assertWarnings("[xpack.monitoring.collection.node.stats.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } private void thenReturnNodeStats(final Client client, final TimeValue timeout, final NodesStatsResponse nodesStatsResponse) { diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/shards/ShardsCollectorTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/shards/ShardsCollectorTests.java index b5374bd28a1a0..fd06ac328770f 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/shards/ShardsCollectorTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/shards/ShardsCollectorTests.java @@ -121,6 +121,9 @@ public void testDoCollect() throws Exception { } } + + assertWarnings("[xpack.monitoring.collection.indices] setting was deprecated in Elasticsearch and will be removed in a" + + " future release! See the breaking changes documentation for the next major version."); } private static RoutingTable mockRoutingTable() { diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/ClusterAlertsUtilTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/ClusterAlertsUtilTests.java index 3ef782a947d49..07aa0087697d6 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/ClusterAlertsUtilTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/ClusterAlertsUtilTests.java @@ -108,12 +108,18 @@ public void testGetClusterAlertsBlacklistThrowsForUnknownWatchId() { assertThat(exception.getMessage(), equalTo("[xpack.monitoring.exporters._random.cluster_alerts.management.blacklist] contains unrecognized Cluster " + "Alert IDs [" + unknownIdsString + "]")); + + assertWarnings("[xpack.monitoring.exporters._random.cluster_alerts.management.blacklist] setting was deprecated in " + + "Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version."); } public void testGetClusterAlertsBlacklist() { final List blacklist = randomSubsetOf(Arrays.asList(ClusterAlertsUtil.WATCH_IDS)); assertThat(blacklist, equalTo(ClusterAlertsUtil.getClusterAlertsBlacklist(createConfigWithBlacklist("any", blacklist)))); + + assertWarnings("[xpack.monitoring.exporters.any.cluster_alerts.management.blacklist] setting was deprecated in Elasticsearch " + + "and will be removed in a future release! See the breaking changes documentation for the next major version."); } private Exporter.Config createConfigWithBlacklist(final String name, final List blacklist) { diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/ExportersTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/ExportersTests.java index b705f06069a8b..082830e0a5892 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/ExportersTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/ExportersTests.java @@ -117,6 +117,8 @@ public void testHostsMustBeSetIfTypeIsHttp() { assertThat(e, hasToString(containsString("Failed to parse value [http] for setting [" + prefix + ".type]"))); assertThat(e.getCause(), instanceOf(SettingsException.class)); assertThat(e.getCause(), hasToString(containsString("host list for [" + prefix + ".host] is empty"))); + assertWarnings("[xpack.monitoring.exporters.example.type] setting was deprecated in Elasticsearch and will be removed in a " + + "future release! See the breaking changes documentation for the next major version."); } public void testIndexNameTimeFormatMustBeValid() { @@ -130,6 +132,8 @@ public void testIndexNameTimeFormatMustBeValid() { assertThat(e, hasToString(containsString("Invalid format: [" + value + "]: Unknown pattern letter: j"))); assertThat(e.getCause(), instanceOf(IllegalArgumentException.class)); assertThat(e.getCause(), hasToString(containsString("Unknown pattern letter: j"))); + assertWarnings("[xpack.monitoring.exporters.example.index.name.time_format] setting was deprecated in Elasticsearch and will " + + "be removed in a future release! See the breaking changes documentation for the next major version."); } public void testExporterIndexPattern() { @@ -181,6 +185,9 @@ public void testInitExportersSingleDisabled() throws Exception { // the only configured exporter is disabled... yet we intentionally don't fallback on the default assertThat(internalExporters.size(), is(0)); + + assertWarnings("[xpack.monitoring.exporters._name.enabled] setting was deprecated in Elasticsearch and will be removed in a " + + "future release! See the breaking changes documentation for the next major version."); } public void testInitExportersSingleUnknownType() throws Exception { @@ -265,6 +272,17 @@ InitializedExporters initExporters(Settings settings) { assertEquals(settings.get("xpack.monitoring.exporters._name0.cluster_alerts.management.blacklist"), "true"); assertEquals(settings.get("xpack.monitoring.exporters._name1.type"), "http"); assertEquals(settings.get("xpack.monitoring.exporters._name1.cluster_alerts.management.blacklist"), "false"); + + assertWarnings( + "[xpack.monitoring.exporters._name1.type] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters._name0.type] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters._name0.cluster_alerts.management.blacklist] setting was deprecated in Elasticsearch and will " + + "be removed in a future release! See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters._name1.cluster_alerts.management.blacklist] setting was deprecated in Elasticsearch and will " + + "be removed in a future release! See the breaking changes documentation for the next major version." + ); } public void testExporterBlocksOnClusterState() { @@ -311,6 +329,9 @@ public void testNoExporters() throws Exception { assertExporters(exporters); exporters.close(); + + assertWarnings("[xpack.monitoring.exporters.explicitly_disabled.enabled] setting was deprecated in Elasticsearch and will be " + + "removed in a future release! See the breaking changes documentation for the next major version."); } /** diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterResourceTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterResourceTests.java index 0eab67a81a5f2..02a02253199de 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterResourceTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterResourceTests.java @@ -362,6 +362,9 @@ public void testDeployClusterAlerts() { verifyPutWatches(0); verifyDeleteWatches(EXPECTED_WATCHES); verifyNoMoreInteractions(client); + + assertWarnings("[xpack.monitoring.migration.decommission_alerts] setting was deprecated in Elasticsearch and will be " + + "removed in a future release! See the breaking changes documentation for the next major version."); } public void testSuccessfulChecksOnElectedMasterNode() { diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterTests.java index ed5a0deb5e2ae..842edfe74f67f 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterTests.java @@ -100,8 +100,11 @@ public void testEmptyHostListExplicit() { private void runTestEmptyHostList(final boolean useDefault) { final String prefix = "xpack.monitoring.exporters.example"; final Settings.Builder builder = Settings.builder().put(prefix + ".type", "http"); + List expectedWarnings = new ArrayList<>(); if (useDefault == false) { builder.putList(prefix + ".host", Collections.emptyList()); + expectedWarnings.add("[xpack.monitoring.exporters.example.host] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } final Settings settings = builder.build(); final IllegalArgumentException e = expectThrows( @@ -110,6 +113,9 @@ private void runTestEmptyHostList(final boolean useDefault) { assertThat(e, hasToString(containsString("Failed to parse value [[]] for setting [" + prefix + ".host]"))); assertThat(e.getCause(), instanceOf(SettingsException.class)); assertThat(e.getCause(), hasToString(containsString("host list for [" + prefix + ".host] is empty"))); + expectedWarnings.add("[xpack.monitoring.exporters.example.type] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); + assertWarnings(expectedWarnings.toArray(new String[0])); } public void testEmptyHostListOkayIfTypeNotSetDefault() { @@ -129,6 +135,8 @@ private void runTestEmptyHostListOkayIfTypeNotSet(final boolean useDefault) { builder.putList(prefix + ".host", Collections.emptyList()); final Settings settings = builder.build(); HttpExporter.HOST_SETTING.getConcreteSetting(prefix + ".host").get(settings); + assertWarnings("[xpack.monitoring.exporters.example.host] setting was deprecated in Elasticsearch and will be removed in a " + + "future release! See the breaking changes documentation for the next major version."); } public void testHostListIsRejectedIfTypeIsNotHttp() { @@ -139,6 +147,12 @@ public void testHostListIsRejectedIfTypeIsNotHttp() { final ClusterSettings clusterSettings = new ClusterSettings(settings, Set.of(HttpExporter.HOST_SETTING, Exporter.TYPE_SETTING)); final SettingsException e = expectThrows(SettingsException.class, () -> clusterSettings.validate(settings, true)); assertThat(e, hasToString(containsString("[" + prefix + ".host] is set but type is [local]"))); + assertWarnings( + "[xpack.monitoring.exporters.example.type] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters.example.host] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version." + ); } public void testSecurePasswordIsRejectedIfTypeIsNotHttp() { @@ -157,6 +171,12 @@ public void testSecurePasswordIsRejectedIfTypeIsNotHttp() { new ClusterSettings(settings, Set.of(HttpExporter.AUTH_SECURE_PASSWORD_SETTING, Exporter.TYPE_SETTING)); final SettingsException e = expectThrows(SettingsException.class, () -> clusterSettings.validate(settings, true)); assertThat(e, hasToString(containsString("[" + prefix + settingName + "] is set but type is [local]"))); + assertWarnings( + "[xpack.monitoring.exporters.example.type] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters.example.auth.secure_password] setting was deprecated in Elasticsearch and will be removed in a " + + "future release! See the breaking changes documentation for the next major version." + ); } public void testInvalidHost() { @@ -176,6 +196,12 @@ public void testInvalidHost() { assertThat(e.getCause(), hasToString(containsString("[" + prefix + ".host] invalid host: [" + host + "]"))); assertThat(e.getCause().getCause(), instanceOf(IllegalArgumentException.class)); assertThat(e.getCause().getCause(), hasToString(containsString("HttpHosts do not use paths [/]."))); + assertWarnings( + "[xpack.monitoring.exporters.example.host] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters.example.type] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version." + ); } public void testMixedSchemes() { @@ -195,6 +221,12 @@ public void testMixedSchemes() { "Failed to parse value [[\"" + httpHost + "\",\"" + httpsHost + "\"]] for setting [" + prefix + ".host]"))); assertThat(e.getCause(), instanceOf(SettingsException.class)); assertThat(e.getCause(), hasToString(containsString("[" + prefix + ".host] must use a consistent scheme: http or https"))); + assertWarnings( + "[xpack.monitoring.exporters.example.host] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters.example.type] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version." + ); } public void testExporterWithBlacklistedHeaders() { @@ -217,6 +249,13 @@ public void testExporterWithBlacklistedHeaders() { expectThrows(SettingsException.class, () -> new HttpExporter(config, sslService, threadContext, coordinator)); assertThat(exception.getMessage(), equalTo(expected)); + + assertWarnings( + "[xpack.monitoring.exporters._http.host] setting was deprecated in Elasticsearch and will be removed in a " + + "future release! See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters._http.type] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version." + ); } public void testExporterWithEmptyHeaders() { @@ -238,6 +277,12 @@ public void testExporterWithEmptyHeaders() { expectThrows(SettingsException.class, () -> new HttpExporter(config, sslService, threadContext, coordinator)); assertThat(exception.getMessage(), equalTo(expected)); + assertWarnings( + "[xpack.monitoring.exporters._http.host] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters._http.type] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version." + ); } public void testExporterWithUnknownBlacklistedClusterAlerts() { @@ -267,6 +312,8 @@ public void testExporterWithUnknownBlacklistedClusterAlerts() { assertThat(exception.getMessage(), equalTo("[xpack.monitoring.exporters._http.cluster_alerts.management.blacklist] contains unrecognized Cluster " + "Alert IDs [does_not_exist]")); + assertWarnings("[xpack.monitoring.exporters._http.cluster_alerts.management.blacklist] setting was deprecated in Elasticsearch" + + " and will be removed in a future release! See the breaking changes documentation for the next major version."); } public void testExporterWithHostOnly() throws Exception { @@ -281,6 +328,12 @@ public void testExporterWithHostOnly() throws Exception { final MonitoringMigrationCoordinator coordinator = new MonitoringMigrationCoordinator(); new HttpExporter(config, sslService, threadContext, coordinator).close(); + assertWarnings( + "[xpack.monitoring.exporters._http.host] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters._http.type] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version." + ); } public void testExporterWithInvalidProxyBasePath() throws Exception { @@ -304,16 +357,23 @@ public void testExporterWithInvalidProxyBasePath() throws Exception { assertThat(e.getCause(), instanceOf(SettingsException.class)); assertThat(e.getCause(), hasToString(containsString(expected))); + assertWarnings("[xpack.monitoring.exporters._http.proxy.base_path] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } public void testCreateRestClient() throws IOException { final SSLIOSessionStrategy sslStrategy = mock(SSLIOSessionStrategy.class); when(sslService.sslIOSessionStrategy(any(Settings.class))).thenReturn(sslStrategy); + List expectedWarnings = new ArrayList<>(); final Settings.Builder builder = Settings.builder() .put("xpack.monitoring.exporters._http.type", "http") .put("xpack.monitoring.exporters._http.host", "http://localhost:9200"); + expectedWarnings.add("[xpack.monitoring.exporters._http.host] setting was deprecated in Elasticsearch and will be removed in " + + "a future release! See the breaking changes documentation for the next major version."); + expectedWarnings.add("[xpack.monitoring.exporters._http.type] setting was deprecated in Elasticsearch and will be removed in " + + "a future release! See the breaking changes documentation for the next major version."); // use basic auth final boolean useBasicAuth = randomBoolean(); @@ -322,6 +382,8 @@ public void testCreateRestClient() throws IOException { MockSecureSettings mockSecureSettings = new MockSecureSettings(); mockSecureSettings.setString("xpack.monitoring.exporters._http.auth.secure_password", "securePassword"); builder.setSecureSettings(mockSecureSettings); + expectedWarnings.add("[xpack.monitoring.exporters._http.auth.username] setting was deprecated in Elasticsearch and will be " + + "removed in a future release! See the breaking changes documentation for the next major version."); } // use headers @@ -334,6 +396,10 @@ public void testCreateRestClient() throws IOException { // doesn't explode HttpExporter.createRestClient(config, sslService, listener).close(); + + if (expectedWarnings.size() > 0) { + assertWarnings(expectedWarnings.toArray(new String[0])); + } } public void testCreateCredentialsProviderWithoutSecurity() { @@ -345,6 +411,9 @@ public void testCreateCredentialsProviderWithoutSecurity() { CredentialsProvider provider = HttpExporter.createCredentialsProvider(config); assertNull(provider); + + assertWarnings("[xpack.monitoring.exporters._http.type] setting was deprecated in Elasticsearch and will be removed in a " + + "future release! See the breaking changes documentation for the next major version."); } public void testCreateSnifferDisabledByDefault() { @@ -383,6 +452,15 @@ public void testCreateSniffer() throws IOException { verify(client, atMost(1)).performRequest(any(Request.class)); verifyNoMoreInteractions(client, listener); + + assertWarnings( + "[xpack.monitoring.exporters._http.sniff.enabled] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters._http.host] setting was deprecated in Elasticsearch and will be removed in a future release!" + + " See the breaking changes documentation for the next major version.", + "[xpack.monitoring.exporters._http.type] setting was deprecated in Elasticsearch and will be removed in a future release!" + + " See the breaking changes documentation for the next major version." + ); } public void testCreateResources() { @@ -391,13 +469,20 @@ public void testCreateResources() { final Settings.Builder builder = Settings.builder() .put("xpack.monitoring.exporters._http.type", "http"); + List warningsExpected = new ArrayList<>(); if (clusterAlertManagement == false) { builder.put("xpack.monitoring.exporters._http.cluster_alerts.management.enabled", false); + warningsExpected.add("[xpack.monitoring.exporters._http.cluster_alerts.management.enabled] setting was deprecated in " + + "Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major " + + "version."); } if (templateTimeout != null) { builder.put("xpack.monitoring.exporters._http.index.template.master_timeout", templateTimeout.getStringRep()); + warningsExpected.add("[xpack.monitoring.exporters._http.index.template.master_timeout] setting was deprecated in " + + "Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major " + + "version."); } final Config config = createConfig(builder.build()); @@ -441,6 +526,9 @@ public void testCreateResources() { assertThat(uniqueOwners, hasSize(1)); assertThat(uniqueOwners.get(0), equalTo("xpack.monitoring.exporters._http")); + if (warningsExpected.size() > 0) { + assertWarnings(warningsExpected.toArray(new String[0])); + } } public void testCreateDefaultParams() { @@ -461,6 +549,8 @@ public void testCreateDefaultParams() { if (bulkTimeout != null) { assertThat(parameters.remove("timeout"), equalTo(bulkTimeout.toString())); + assertWarnings("[xpack.monitoring.exporters._http.bulk.timeout] setting was deprecated in Elasticsearch and will be removed " + + "in a future release! See the breaking changes documentation for the next major version."); } else { assertNull(parameters.remove("timeout")); } diff --git a/x-pack/plugin/src/test/java/org/elasticsearch/xpack/test/rest/AbstractXPackRestTest.java b/x-pack/plugin/src/test/java/org/elasticsearch/xpack/test/rest/AbstractXPackRestTest.java index ef85405adf1ff..f7433e2414ec1 100644 --- a/x-pack/plugin/src/test/java/org/elasticsearch/xpack/test/rest/AbstractXPackRestTest.java +++ b/x-pack/plugin/src/test/java/org/elasticsearch/xpack/test/rest/AbstractXPackRestTest.java @@ -11,10 +11,8 @@ import org.apache.http.HttpStatus; import org.apache.lucene.util.TimeUnits; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.core.CheckedFunction; import org.elasticsearch.plugins.MetadataUpgrader; import org.elasticsearch.test.SecuritySettingsSourceField; @@ -32,20 +30,13 @@ import java.io.IOException; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; import static java.util.Collections.emptyList; -import static java.util.Collections.emptyMap; -import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; -import static org.elasticsearch.common.xcontent.support.XContentMapValues.extractValue; -import static org.elasticsearch.rest.action.search.RestSearchAction.TOTAL_HITS_AS_INT_PARAM; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; /** Runs rest tests against external cluster */ // TODO: Remove this timeout increase once this test suite is broken up @@ -74,7 +65,6 @@ protected Settings restClientSettings() { @Before public void setupForTests() throws Exception { waitForTemplates(); - enableMonitoring(); } /** @@ -96,95 +86,6 @@ private void waitForTemplates() { } } - /** - * Enable monitoring and waits for monitoring documents to be collected and indexed in - * monitoring indices.This is the signal that the local exporter is started and ready - * for the tests. - */ - private void enableMonitoring() throws Exception { - if (isMonitoringTest()) { - final ClientYamlTestResponse xpackUsage = - callApi("xpack.usage", singletonMap("filter_path", "monitoring.enabled_exporters"), emptyList(), getApiCallHeaders()); - - @SuppressWarnings("unchecked") - final Map exporters = (Map) xpackUsage.evaluate("monitoring.enabled_exporters"); - assertNotNull("List of monitoring exporters must not be null", exporters); - assertThat("List of enabled exporters must be empty before enabling monitoring", - XContentMapValues.extractRawValues("monitoring.enabled_exporters", exporters), hasSize(0)); - - final Map settings = new HashMap<>(); - settings.put("xpack.monitoring.collection.enabled", true); - settings.put("xpack.monitoring.collection.interval", "1s"); - settings.put("xpack.monitoring.exporters._local.type", "local"); - settings.put("xpack.monitoring.exporters._local.enabled", true); - - awaitCallApi("cluster.put_settings", emptyMap(), - singletonList(singletonMap("persistent", settings)), - response -> { - Object acknowledged = response.evaluate("acknowledged"); - return acknowledged != null && (Boolean) acknowledged; - }, - () -> "Exception when enabling monitoring"); - Map searchParams = new HashMap<>(); - searchParams.put("index", ".monitoring-*"); - searchParams.put(TOTAL_HITS_AS_INT_PARAM, "true"); - awaitCallApi("search", searchParams, emptyList(), - response -> ((Number) response.evaluate("hits.total")).intValue() > 0, - () -> "Exception when waiting for monitoring documents to be indexed"); - } - } - - /** - * Disable monitoring - */ - private void disableMonitoring() throws Exception { - if (isMonitoringTest()) { - final Map settings = new HashMap<>(); - settings.put("xpack.monitoring.collection.enabled", null); - settings.put("xpack.monitoring.collection.interval", null); - settings.put("xpack.monitoring.exporters._local.enabled", null); - - awaitCallApi("cluster.put_settings", emptyMap(), - singletonList(singletonMap("persistent", settings)), - response -> { - Object acknowledged = response.evaluate("acknowledged"); - return acknowledged != null && (Boolean) acknowledged; - }, - () -> "Exception when disabling monitoring"); - - assertBusy(() -> { - try { - ClientYamlTestResponse response = - callApi("xpack.usage", singletonMap("filter_path", "monitoring.enabled_exporters"), emptyList(), - getApiCallHeaders()); - - @SuppressWarnings("unchecked") - final Map exporters = (Map) response.evaluate("monitoring.enabled_exporters"); - if (exporters.isEmpty() == false) { - fail("Exporters were not found"); - } - - final Map params = new HashMap<>(); - params.put("node_id", "_local"); - params.put("metric", "thread_pool"); - params.put("filter_path", "nodes.*.thread_pool.write.active"); - response = callApi("nodes.stats", params, emptyList(), getApiCallHeaders()); - - @SuppressWarnings("unchecked") - final Map nodes = (Map) response.evaluate("nodes"); - @SuppressWarnings("unchecked") - final Map node = (Map) nodes.values().iterator().next(); - - final Number activeWrites = (Number) extractValue("thread_pool.write.active", node); - assertNotNull(activeWrites); - assertThat(activeWrites, equalTo(0)); - } catch (Exception e) { - throw new ElasticsearchException("Failed to wait for monitoring exporters to stop:", e); - } - }); - } - } - /** * Cleanup after tests. * @@ -193,7 +94,6 @@ private void disableMonitoring() throws Exception { */ @After public void cleanup() throws Exception { - disableMonitoring(); clearMlState(); if (isWaitForPendingTasks()) { // This waits for pending tasks to complete, so must go last (otherwise @@ -251,11 +151,6 @@ protected boolean installTemplates() { return true; } - protected boolean isMonitoringTest() { - String testName = getTestName(); - return testName != null && (testName.contains("=monitoring/") || testName.contains("=monitoring\\")); - } - protected boolean isMachineLearningTest() { String testName = getTestName(); return testName != null && (testName.contains("=ml/") || testName.contains("=ml\\")); diff --git a/x-pack/plugin/text-structure/qa/text-structure-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/TextStructureWithSecurityIT.java b/x-pack/plugin/text-structure/qa/text-structure-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/TextStructureWithSecurityIT.java index 551147b1699de..b6892ff884d5b 100644 --- a/x-pack/plugin/text-structure/qa/text-structure-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/TextStructureWithSecurityIT.java +++ b/x-pack/plugin/text-structure/qa/text-structure-with-security/src/yamlRestTest/java/org/elasticsearch/smoketest/TextStructureWithSecurityIT.java @@ -51,9 +51,4 @@ protected Map getApiCallHeaders() { ); } - @Override - protected boolean isMonitoringTest() { - return false; - } - } diff --git a/x-pack/plugin/watcher/qa/with-monitoring/src/javaRestTest/java/org/elasticsearch/smoketest/MonitoringWithWatcherRestIT.java b/x-pack/plugin/watcher/qa/with-monitoring/src/javaRestTest/java/org/elasticsearch/smoketest/MonitoringWithWatcherRestIT.java index 7b646abaef688..e2aa12023cfd1 100644 --- a/x-pack/plugin/watcher/qa/with-monitoring/src/javaRestTest/java/org/elasticsearch/smoketest/MonitoringWithWatcherRestIT.java +++ b/x-pack/plugin/watcher/qa/with-monitoring/src/javaRestTest/java/org/elasticsearch/smoketest/MonitoringWithWatcherRestIT.java @@ -61,24 +61,6 @@ public void testThatLocalExporterAddsWatches() throws Exception { assertMonitoringWatchHasBeenOverWritten(watchId); } - public void testThatHttpExporterAddsWatches() throws Exception { - String watchId = createMonitoringWatch(); - String httpHost = getHttpHost(); - - Request request = new Request("PUT", "/_cluster/settings"); - request.setJsonEntity(Strings.toString(jsonBuilder().startObject() - .startObject("persistent") - .field("xpack.monitoring.exporters.my_http_exporter.type", "http") - .field("xpack.monitoring.exporters.my_http_exporter.host", httpHost) - .field("xpack.monitoring.exporters.my_http_exporter.cluster_alerts.management.enabled", true) - .endObject().endObject())); - adminClient().performRequest(request); - - assertTotalWatchCount(WATCH_IDS.length); - - assertMonitoringWatchHasBeenOverWritten(watchId); - } - private void assertMonitoringWatchHasBeenOverWritten(String watchId) throws Exception { assertBusy(() -> { ObjectPath path = ObjectPath.createFromResponse(client().performRequest(new Request("GET", "/_watcher/watch/" + watchId)));