Skip to content

Commit

Permalink
Add deprecation log to monitoring bulk endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaiera committed Jan 28, 2025
1 parent 8bd4fb7 commit 156de26
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
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;
import org.elasticsearch.rest.RestResponse;
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;
Expand All @@ -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";
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit 156de26

Please sign in to comment.