Skip to content

Commit ceaf53c

Browse files
authored
Add deprecation info API entries for deprecated monitoring settings (#78799)
Recently we have deprecated a number of settings in monitoring. These settings should be represented in the deprecation info API. This PR will be backported with some minor changes to the 7.x branch so that we can start the deprecation process in that release cycle.
1 parent d6ef299 commit ceaf53c

File tree

7 files changed

+106
-51
lines changed

7 files changed

+106
-51
lines changed

docs/reference/migration/migrate_8_0.asciidoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ coming[8.0.0]
2525
* <<breaking_80_ingest_changes>>
2626
* <<breaking_80_java_changes>>
2727
* <<breaking_80_mappings_changes>>
28-
* <<breaking_80_monitoring_changes>>
2928
* <<breaking_80_network_changes>>
3029
* <<breaking_80_node_changes>>
3130
* <<breaking_80_packaging_changes>>
@@ -128,7 +127,6 @@ include::migrate_8_0/indices.asciidoc[]
128127
include::migrate_8_0/ingest.asciidoc[]
129128
include::migrate_8_0/java.asciidoc[]
130129
include::migrate_8_0/mappings.asciidoc[]
131-
include::migrate_8_0/monitoring.asciidoc[]
132130
include::migrate_8_0/network.asciidoc[]
133131
include::migrate_8_0/node.asciidoc[]
134132
include::migrate_8_0/packaging.asciidoc[]

docs/reference/migration/migrate_8_0/monitoring.asciidoc

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77

8-
package org.elasticsearch.xpack.monitoring;
8+
package org.elasticsearch.xpack.core.monitoring;
99

1010
import org.elasticsearch.common.settings.Setting;
1111
import org.elasticsearch.common.settings.Setting.Property;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ private DeprecationChecks() {
4545
static List<BiFunction<Settings, PluginsAndModules, DeprecationIssue>> NODE_SETTINGS_CHECKS = List.of(
4646
NodeDeprecationChecks::checkSharedDataPathSetting,
4747
NodeDeprecationChecks::checkReservedPrefixedRealmNames,
48-
NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting
48+
NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting,
49+
NodeDeprecationChecks::checkExporterUseIngestPipelineSettings,
50+
NodeDeprecationChecks::checkExporterPipelineMasterTimeoutSetting,
51+
NodeDeprecationChecks::checkExporterCreateLegacyTemplateSetting
4952
);
5053

5154
static List<Function<IndexMetadata, DeprecationIssue>> INDEX_SETTINGS_CHECKS = List.of(

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
import org.elasticsearch.common.settings.Settings;
1414
import org.elasticsearch.env.Environment;
1515
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
16+
import org.elasticsearch.xpack.core.monitoring.MonitoringDeprecatedSettings;
1617
import org.elasticsearch.xpack.core.security.authc.RealmConfig;
1718
import org.elasticsearch.xpack.core.security.authc.RealmSettings;
1819

1920
import java.util.ArrayList;
21+
import java.util.Comparator;
2022
import java.util.List;
2123
import java.util.Locale;
2224
import java.util.Map;
@@ -93,4 +95,48 @@ static DeprecationIssue checkSingleDataNodeWatermarkSetting(final Settings setti
9395

9496
return null;
9597
}
98+
99+
private static DeprecationIssue deprecatedAffixSetting(Setting.AffixSetting<?> deprecatedAffixSetting, String detailPattern,
100+
String url, DeprecationIssue.Level warningLevel, Settings settings) {
101+
List<Setting<?>> deprecatedConcreteSettings = deprecatedAffixSetting.getAllConcreteSettings(settings)
102+
.sorted(Comparator.comparing(Setting::getKey)).collect(Collectors.toList());
103+
104+
if (deprecatedConcreteSettings.isEmpty()) {
105+
return null;
106+
}
107+
108+
final String concatSettingNames = deprecatedConcreteSettings.stream().map(Setting::getKey).collect(Collectors.joining(","));
109+
final String message = String.format(
110+
Locale.ROOT,
111+
"The [%s] settings are deprecated and will be removed after 8.0",
112+
concatSettingNames
113+
);
114+
final String details = String.format(Locale.ROOT, detailPattern, concatSettingNames);
115+
116+
return new DeprecationIssue(warningLevel, message, url, details, false, null);
117+
}
118+
119+
static DeprecationIssue checkExporterUseIngestPipelineSettings(final Settings settings, final PluginsAndModules pluginsAndModules) {
120+
return deprecatedAffixSetting(MonitoringDeprecatedSettings.USE_INGEST_PIPELINE_SETTING,
121+
"Remove the following settings from elasticsearch.yml: [%s]",
122+
"https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting",
123+
DeprecationIssue.Level.WARNING,
124+
settings);
125+
}
126+
127+
static DeprecationIssue checkExporterPipelineMasterTimeoutSetting(final Settings settings, final PluginsAndModules pluginsAndModules) {
128+
return deprecatedAffixSetting(MonitoringDeprecatedSettings.PIPELINE_CHECK_TIMEOUT_SETTING,
129+
"Remove the following settings from elasticsearch.yml: [%s]",
130+
"https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting",
131+
DeprecationIssue.Level.WARNING,
132+
settings);
133+
}
134+
135+
static DeprecationIssue checkExporterCreateLegacyTemplateSetting(final Settings settings, final PluginsAndModules pluginsAndModules) {
136+
return deprecatedAffixSetting(MonitoringDeprecatedSettings.TEMPLATE_CREATE_LEGACY_VERSIONS_SETTING,
137+
"Remove the following settings from elasticsearch.yml: [%s]",
138+
"https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting",
139+
DeprecationIssue.Level.WARNING,
140+
settings);
141+
}
96142
}

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.elasticsearch.common.Strings;
1212
import org.elasticsearch.common.settings.Setting;
1313
import org.elasticsearch.common.settings.Settings;
14+
import org.elasticsearch.core.TimeValue;
1415
import org.elasticsearch.env.Environment;
1516
import org.elasticsearch.test.ESTestCase;
1617
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
@@ -138,4 +139,57 @@ public void testSingleDataNodeWatermarkSetting() {
138139
" Discontinue use of this setting.",
139140
false, null)));
140141
}
142+
143+
public void testExporterUseIngestPipelineSettings() {
144+
Settings settings = Settings.builder()
145+
.put("xpack.monitoring.exporters.test.use_ingest", true)
146+
.build();
147+
148+
List<DeprecationIssue> issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null));
149+
150+
final String expectedUrl =
151+
"https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting";
152+
assertThat(issues, hasItem(
153+
new DeprecationIssue(DeprecationIssue.Level.WARNING,
154+
"The [xpack.monitoring.exporters.test.use_ingest] settings are deprecated and will be removed after 8.0",
155+
expectedUrl,
156+
"Remove the following settings from elasticsearch.yml: [xpack.monitoring.exporters.test.use_ingest]",
157+
false, null)));
158+
}
159+
160+
public void testExporterPipelineMasterTimeoutSetting() {
161+
Settings settings = Settings.builder()
162+
.put("xpack.monitoring.exporters.test.index.pipeline.master_timeout", TimeValue.timeValueSeconds(10))
163+
.build();
164+
165+
List<DeprecationIssue> issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null));
166+
167+
final String expectedUrl =
168+
"https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting";
169+
assertThat(issues, hasItem(
170+
new DeprecationIssue(DeprecationIssue.Level.WARNING,
171+
"The [xpack.monitoring.exporters.test.index.pipeline.master_timeout] settings are deprecated and will be removed after 8.0",
172+
expectedUrl,
173+
"Remove the following settings from elasticsearch.yml: [xpack.monitoring.exporters.test.index.pipeline.master_timeout]",
174+
false, null)));
175+
}
176+
177+
public void testExporterCreateLegacyTemplateSetting() {
178+
Settings settings = Settings.builder()
179+
.put("xpack.monitoring.exporters.test.index.template.create_legacy_templates", true)
180+
.build();
181+
182+
List<DeprecationIssue> issues = DeprecationChecks.filterChecks(NODE_SETTINGS_CHECKS, c -> c.apply(settings, null));
183+
184+
final String expectedUrl =
185+
"https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting";
186+
assertThat(issues, hasItem(
187+
new DeprecationIssue(DeprecationIssue.Level.WARNING,
188+
"The [xpack.monitoring.exporters.test.index.template.create_legacy_templates] settings are deprecated and will be " +
189+
"removed after 8.0",
190+
expectedUrl,
191+
"Remove the following settings from elasticsearch.yml: " +
192+
"[xpack.monitoring.exporters.test.index.template.create_legacy_templates]",
193+
false, null)));
194+
}
141195
}

x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.elasticsearch.xpack.core.XPackPlugin;
3838
import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction;
3939
import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction;
40+
import org.elasticsearch.xpack.core.monitoring.MonitoringDeprecatedSettings;
4041
import org.elasticsearch.xpack.core.monitoring.MonitoringField;
4142
import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkAction;
4243
import org.elasticsearch.xpack.core.monitoring.action.MonitoringMigrateAlertsAction;

0 commit comments

Comments
 (0)