From 156de2649a1b21013f9f37cf4c2de5b6ad7e5a1d Mon Sep 17 00:00:00 2001 From: James Baiera Date: Tue, 28 Jan 2025 15:44:58 -0500 Subject: [PATCH] Add deprecation log to monitoring bulk endpoint --- .../monitoring/rest/action/RestMonitoringBulkAction.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java index 762cbffacb082..32bea002dfba1 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java @@ -10,6 +10,8 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.internal.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.logging.DeprecationCategory; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; @@ -17,6 +19,7 @@ import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.xcontent.XContentBuilder; import org.elasticsearch.xpack.core.monitoring.MonitoredSystem; +import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkAction; import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkRequestBuilder; import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkResponse; import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils; @@ -32,6 +35,10 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestMonitoringBulkAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(MonitoringBulkAction.class); + private static final String DEPRECATION_ID = "xpack_monitoring_bulk_api_removal"; + private static final String DEPRECATION_MESSAGE = + "The xpack monitoring bulk action is deprecated and will be removed in the next major release."; public static final String MONITORING_ID = "system_id"; public static final String MONITORING_VERSION = "system_api_version"; @@ -63,6 +70,7 @@ public String getName() { @Override public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException { + deprecationLogger.critical(DeprecationCategory.API, DEPRECATION_ID, DEPRECATION_MESSAGE); final String id = request.param(MONITORING_ID); if (Strings.isEmpty(id)) {