Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/reference/migration/migrate_8_0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ coming[8.0.0]
* <<breaking_80_ingest_changes>>
* <<breaking_80_java_changes>>
* <<breaking_80_mappings_changes>>
* <<breaking_80_monitoring_changes>>
* <<breaking_80_network_changes>>
* <<breaking_80_node_changes>>
* <<breaking_80_packaging_changes>>
Expand Down Expand Up @@ -128,7 +127,6 @@ include::migrate_8_0/indices.asciidoc[]
include::migrate_8_0/ingest.asciidoc[]
include::migrate_8_0/java.asciidoc[]
include::migrate_8_0/mappings.asciidoc[]
include::migrate_8_0/monitoring.asciidoc[]
include::migrate_8_0/network.asciidoc[]
include::migrate_8_0/node.asciidoc[]
include::migrate_8_0/packaging.asciidoc[]
Expand Down
47 changes: 0 additions & 47 deletions docs/reference/migration/migrate_8_0/monitoring.asciidoc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.monitoring;
package org.elasticsearch.xpack.core.monitoring;

import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ private DeprecationChecks() {
static List<BiFunction<Settings, PluginsAndModules, DeprecationIssue>> NODE_SETTINGS_CHECKS = List.of(
NodeDeprecationChecks::checkSharedDataPathSetting,
NodeDeprecationChecks::checkReservedPrefixedRealmNames,
NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting
NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting,
NodeDeprecationChecks::checkExporterUseIngestPipelineSettings,
NodeDeprecationChecks::checkExporterPipelineMasterTimeoutSetting,
NodeDeprecationChecks::checkExporterCreateLegacyTemplateSetting
);

static List<Function<IndexMetadata, DeprecationIssue>> INDEX_SETTINGS_CHECKS = List.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
import org.elasticsearch.xpack.core.monitoring.MonitoringDeprecatedSettings;
import org.elasticsearch.xpack.core.security.authc.RealmConfig;
import org.elasticsearch.xpack.core.security.authc.RealmSettings;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -93,4 +95,48 @@ static DeprecationIssue checkSingleDataNodeWatermarkSetting(final Settings setti

return null;
}

private static DeprecationIssue deprecatedAffixSetting(Setting.AffixSetting<?> deprecatedAffixSetting, String detailPattern,
String url, DeprecationIssue.Level warningLevel, Settings settings) {
List<Setting<?>> deprecatedConcreteSettings = deprecatedAffixSetting.getAllConcreteSettings(settings)
.sorted(Comparator.comparing(Setting::getKey)).collect(Collectors.toList());

if (deprecatedConcreteSettings.isEmpty()) {
return null;
}

final String concatSettingNames = deprecatedConcreteSettings.stream().map(Setting::getKey).collect(Collectors.joining(","));
final String message = String.format(
Locale.ROOT,
"The [%s] settings are deprecated and will be removed after 8.0",
concatSettingNames
);
final String details = String.format(Locale.ROOT, detailPattern, concatSettingNames);

return new DeprecationIssue(warningLevel, message, url, details, false, null);
}

static DeprecationIssue checkExporterUseIngestPipelineSettings(final Settings settings, final PluginsAndModules pluginsAndModules) {
return deprecatedAffixSetting(MonitoringDeprecatedSettings.USE_INGEST_PIPELINE_SETTING,
"Remove the following settings from elasticsearch.yml: [%s]",
"https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting",
DeprecationIssue.Level.WARNING,
settings);
}

static DeprecationIssue checkExporterPipelineMasterTimeoutSetting(final Settings settings, final PluginsAndModules pluginsAndModules) {
return deprecatedAffixSetting(MonitoringDeprecatedSettings.PIPELINE_CHECK_TIMEOUT_SETTING,
"Remove the following settings from elasticsearch.yml: [%s]",
"https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting",
DeprecationIssue.Level.WARNING,
settings);
}

static DeprecationIssue checkExporterCreateLegacyTemplateSetting(final Settings settings, final PluginsAndModules pluginsAndModules) {
return deprecatedAffixSetting(MonitoringDeprecatedSettings.TEMPLATE_CREATE_LEGACY_VERSIONS_SETTING,
"Remove the following settings from elasticsearch.yml: [%s]",
"https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting",
DeprecationIssue.Level.WARNING,
settings);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.env.Environment;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
Expand Down Expand Up @@ -138,4 +139,57 @@ public void testSingleDataNodeWatermarkSetting() {
" Discontinue use of this setting.",
false, null)));
}

public void testExporterUseIngestPipelineSettings() {
Settings settings = Settings.builder()
.put("xpack.monitoring.exporters.test.use_ingest", true)
.build();

List<DeprecationIssue> issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null));

final String expectedUrl =
"https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting";
assertThat(issues, hasItem(
new DeprecationIssue(DeprecationIssue.Level.WARNING,
"The [xpack.monitoring.exporters.test.use_ingest] settings are deprecated and will be removed after 8.0",
expectedUrl,
"Remove the following settings from elasticsearch.yml: [xpack.monitoring.exporters.test.use_ingest]",
false, null)));
}

public void testExporterPipelineMasterTimeoutSetting() {
Settings settings = Settings.builder()
.put("xpack.monitoring.exporters.test.index.pipeline.master_timeout", TimeValue.timeValueSeconds(10))
.build();

List<DeprecationIssue> issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null));

final String expectedUrl =
"https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting";
assertThat(issues, hasItem(
new DeprecationIssue(DeprecationIssue.Level.WARNING,
"The [xpack.monitoring.exporters.test.index.pipeline.master_timeout] settings are deprecated and will be removed after 8.0",
expectedUrl,
"Remove the following settings from elasticsearch.yml: [xpack.monitoring.exporters.test.index.pipeline.master_timeout]",
false, null)));
}

public void testExporterCreateLegacyTemplateSetting() {
Settings settings = Settings.builder()
.put("xpack.monitoring.exporters.test.index.template.create_legacy_templates", true)
.build();

List<DeprecationIssue> issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null));

final String expectedUrl =
"https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting";
assertThat(issues, hasItem(
new DeprecationIssue(DeprecationIssue.Level.WARNING,
"The [xpack.monitoring.exporters.test.index.template.create_legacy_templates] settings are deprecated and will be " +
"removed after 8.0",
expectedUrl,
"Remove the following settings from elasticsearch.yml: " +
"[xpack.monitoring.exporters.test.index.template.create_legacy_templates]",
false, null)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.elasticsearch.xpack.core.XPackPlugin;
import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction;
import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction;
import org.elasticsearch.xpack.core.monitoring.MonitoringDeprecatedSettings;
import org.elasticsearch.xpack.core.monitoring.MonitoringField;
import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkAction;
import org.elasticsearch.xpack.core.monitoring.action.MonitoringMigrateAlertsAction;
Expand Down