Skip to content

Commit 0552802

Browse files
authored
[7.x] Add deprecation info API entries for deprecated monitoring settings #78799 (#79527)
1 parent 35dc030 commit 0552802

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ private DeprecationChecks() {
132132
NodeDeprecationChecks::checkMaxLocalStorageNodesSetting,
133133
NodeDeprecationChecks::checkSamlNameIdFormatSetting,
134134
NodeDeprecationChecks::checkClusterRoutingAllocationIncludeRelocationsSetting,
135+
NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting,
136+
NodeDeprecationChecks::checkExporterUseIngestPipelineSettings,
137+
NodeDeprecationChecks::checkExporterPipelineMasterTimeoutSetting,
138+
NodeDeprecationChecks::checkExporterCreateLegacyTemplateSetting,
139+
NodeDeprecationChecks::checkClusterRoutingAllocationIncludeRelocationsSetting,
135140
NodeDeprecationChecks::checkScriptContextCache,
136141
NodeDeprecationChecks::checkScriptContextCompilationsRateLimitSetting,
137142
NodeDeprecationChecks::checkScriptContextCacheSizeSetting,

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,4 +1072,62 @@ static DeprecationIssue checkScriptContextCacheExpirationSetting(final Settings
10721072
}
10731073
return null;
10741074
}
1075+
1076+
private static DeprecationIssue deprecatedAffixSetting(Setting.AffixSetting<?> deprecatedAffixSetting, String detailPattern,
1077+
String url, DeprecationIssue.Level warningLevel, Settings settings) {
1078+
List<Setting<?>> deprecatedConcreteSettings = deprecatedAffixSetting.getAllConcreteSettings(settings)
1079+
.sorted(Comparator.comparing(Setting::getKey)).collect(Collectors.toList());
1080+
1081+
if (deprecatedConcreteSettings.isEmpty()) {
1082+
return null;
1083+
}
1084+
1085+
final String concatSettingNames = deprecatedConcreteSettings.stream().map(Setting::getKey).collect(Collectors.joining(","));
1086+
final String message = String.format(
1087+
Locale.ROOT,
1088+
"The [%s] settings are deprecated and will be removed after 8.0",
1089+
concatSettingNames
1090+
);
1091+
final String details = String.format(Locale.ROOT, detailPattern, concatSettingNames);
1092+
1093+
return new DeprecationIssue(warningLevel, message, url, details, false, null);
1094+
}
1095+
1096+
static DeprecationIssue checkExporterUseIngestPipelineSettings(final Settings settings,
1097+
final PluginsAndModules pluginsAndModules,
1098+
final ClusterState clusterState,
1099+
final XPackLicenseState licenseState) {
1100+
return deprecatedAffixSetting(
1101+
Setting.affixKeySetting("xpack.monitoring.exporters.","use_ingest", key -> Setting.boolSetting(key, true)),
1102+
"Remove the following settings from elasticsearch.yml: [%s]",
1103+
"https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting",
1104+
DeprecationIssue.Level.WARNING,
1105+
settings);
1106+
}
1107+
1108+
static DeprecationIssue checkExporterPipelineMasterTimeoutSetting(final Settings settings,
1109+
final PluginsAndModules pluginsAndModules,
1110+
final ClusterState clusterState,
1111+
final XPackLicenseState licenseState) {
1112+
return deprecatedAffixSetting(
1113+
Setting.affixKeySetting("xpack.monitoring.exporters.","index.pipeline.master_timeout",
1114+
(key) -> Setting.timeSetting(key, TimeValue.MINUS_ONE)),
1115+
"Remove the following settings from elasticsearch.yml: [%s]",
1116+
"https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting",
1117+
DeprecationIssue.Level.WARNING,
1118+
settings);
1119+
}
1120+
1121+
static DeprecationIssue checkExporterCreateLegacyTemplateSetting(final Settings settings,
1122+
final PluginsAndModules pluginsAndModules,
1123+
final ClusterState clusterState,
1124+
final XPackLicenseState licenseState) {
1125+
return deprecatedAffixSetting(
1126+
Setting.affixKeySetting("xpack.monitoring.exporters.","index.template.create_legacy_templates",
1127+
(key) -> Setting.boolSetting(key, true)),
1128+
"Remove the following settings from elasticsearch.yml: [%s]",
1129+
"https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting",
1130+
DeprecationIssue.Level.WARNING,
1131+
settings);
1132+
}
10751133
}

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.elasticsearch.common.util.concurrent.EsExecutors;
2424
import org.elasticsearch.core.Set;
2525
import org.elasticsearch.core.SuppressForbidden;
26+
import org.elasticsearch.core.TimeValue;
2627
import org.elasticsearch.env.Environment;
2728
import org.elasticsearch.env.NodeEnvironment;
2829
import org.elasticsearch.gateway.GatewayService;
@@ -1554,4 +1555,63 @@ public void testScriptContextCacheExpirationSetting() {
15541555
"[script.context.moving-function.cache_expire] setting was deprecated in Elasticsearch and will be removed in a future" +
15551556
" release! See the breaking changes documentation for the next major version.");
15561557
}
1558+
1559+
public void testExporterUseIngestPipelineSettings() {
1560+
Settings settings = Settings.builder()
1561+
.put("xpack.monitoring.exporters.test.use_ingest", true)
1562+
.build();
1563+
1564+
List<DeprecationIssue> issues = Collections.singletonList(
1565+
NodeDeprecationChecks.checkExporterUseIngestPipelineSettings(settings, null, null, null)
1566+
);
1567+
1568+
final String expectedUrl =
1569+
"https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting";
1570+
assertThat(issues, hasItem(
1571+
new DeprecationIssue(DeprecationIssue.Level.WARNING,
1572+
"The [xpack.monitoring.exporters.test.use_ingest] settings are deprecated and will be removed after 8.0",
1573+
expectedUrl,
1574+
"Remove the following settings from elasticsearch.yml: [xpack.monitoring.exporters.test.use_ingest]",
1575+
false, null)));
1576+
}
1577+
1578+
public void testExporterPipelineMasterTimeoutSetting() {
1579+
Settings settings = Settings.builder()
1580+
.put("xpack.monitoring.exporters.test.index.pipeline.master_timeout", TimeValue.timeValueSeconds(10))
1581+
.build();
1582+
1583+
List<DeprecationIssue> issues = Collections.singletonList(
1584+
NodeDeprecationChecks.checkExporterPipelineMasterTimeoutSetting(settings, null, null, null)
1585+
);
1586+
1587+
final String expectedUrl =
1588+
"https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting";
1589+
assertThat(issues, hasItem(
1590+
new DeprecationIssue(DeprecationIssue.Level.WARNING,
1591+
"The [xpack.monitoring.exporters.test.index.pipeline.master_timeout] settings are deprecated and will be removed after 8.0",
1592+
expectedUrl,
1593+
"Remove the following settings from elasticsearch.yml: [xpack.monitoring.exporters.test.index.pipeline.master_timeout]",
1594+
false, null)));
1595+
}
1596+
1597+
public void testExporterCreateLegacyTemplateSetting() {
1598+
Settings settings = Settings.builder()
1599+
.put("xpack.monitoring.exporters.test.index.template.create_legacy_templates", true)
1600+
.build();
1601+
1602+
List<DeprecationIssue> issues = Collections.singletonList(
1603+
NodeDeprecationChecks.checkExporterCreateLegacyTemplateSetting(settings, null, null, null)
1604+
);
1605+
1606+
final String expectedUrl =
1607+
"https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting";
1608+
assertThat(issues, hasItem(
1609+
new DeprecationIssue(DeprecationIssue.Level.WARNING,
1610+
"The [xpack.monitoring.exporters.test.index.template.create_legacy_templates] settings are deprecated and will be " +
1611+
"removed after 8.0",
1612+
expectedUrl,
1613+
"Remove the following settings from elasticsearch.yml: " +
1614+
"[xpack.monitoring.exporters.test.index.template.create_legacy_templates]",
1615+
false, null)));
1616+
}
15571617
}

0 commit comments

Comments
 (0)