Deprecate alternatives to the hot threads API (#52930)

This commit deprecates various undocumented alternatives to the hot
threads API.
This commit is contained in:
muachilin 2020-03-24 11:22:50 +08:00 committed by Jason Tedor
parent e3ca124537
commit b33fbe7026
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
1 changed files with 50 additions and 8 deletions

View File

@ -34,25 +34,67 @@ import org.elasticsearch.rest.action.RestResponseListener;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Locale;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList; import static java.util.Collections.unmodifiableList;
import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestNodesHotThreadsAction extends BaseRestHandler { public class RestNodesHotThreadsAction extends BaseRestHandler {
private static final String formatDeprecatedMessageWithoutNodeID = "[%s] is a deprecated endpoint. " +
"Please use [/_nodes/hot_threads] instead.";
private static final String formatDeprecatedMessageWithNodeID = "[%s] is a deprecated endpoint. " +
"Please use [/_nodes/{nodeId}/hot_threads] instead.";
private static final String DEPRECATED_MESSAGE_CLUSTER_NODES_HOT_THREADS = String.format(Locale.ROOT,
formatDeprecatedMessageWithoutNodeID,
"/_cluster/nodes/hot_threads"
);
private static final String DEPRECATED_MESSAGE_CLUSTER_NODES_NODEID_HOT_THREADS = String.format(Locale.ROOT,
formatDeprecatedMessageWithNodeID,
"/_cluster/nodes/{nodeId}/hot_threads"
);
private static final String DEPRECATED_MESSAGE_CLUSTER_NODES_HOTTHREADS = String.format(Locale.ROOT,
formatDeprecatedMessageWithoutNodeID,
"/_cluster/nodes/hotthreads"
);
private static final String DEPRECATED_MESSAGE_CLUSTER_NODES_NODEID_HOTTHREADS = String.format(Locale.ROOT,
formatDeprecatedMessageWithNodeID,
"/_cluster/nodes/{nodeId}/hotthreads"
);
private static final String DEPRECATED_MESSAGE_NODES_HOTTHREADS = String.format(Locale.ROOT,
formatDeprecatedMessageWithoutNodeID,
"/_nodes/hotthreads"
);
private static final String DEPRECATED_MESSAGE_NODES_NODEID_HOTTHREADS = String.format(Locale.ROOT,
formatDeprecatedMessageWithNodeID,
"/_nodes/{nodeId}/hotthreads"
);
@Override
public List<DeprecatedRoute> deprecatedRoutes() {
return unmodifiableList(asList(
new DeprecatedRoute(GET, "/_cluster/nodes/hot_threads",
DEPRECATED_MESSAGE_CLUSTER_NODES_HOT_THREADS),
new DeprecatedRoute(GET, "/_cluster/nodes/{nodeId}/hot_threads",
DEPRECATED_MESSAGE_CLUSTER_NODES_NODEID_HOT_THREADS),
new DeprecatedRoute(GET, "/_cluster/nodes/hotthreads",
DEPRECATED_MESSAGE_CLUSTER_NODES_HOTTHREADS),
new DeprecatedRoute(GET, "/_cluster/nodes/{nodeId}/hotthreads",
DEPRECATED_MESSAGE_CLUSTER_NODES_NODEID_HOTTHREADS),
new DeprecatedRoute(GET, "/_nodes/hotthreads",
DEPRECATED_MESSAGE_NODES_HOTTHREADS),
new DeprecatedRoute(GET, "/_nodes/{nodeId}/hotthreads",
DEPRECATED_MESSAGE_NODES_NODEID_HOTTHREADS)
));
}
@Override @Override
public List<Route> routes() { public List<Route> routes() {
return unmodifiableList(asList( return unmodifiableList(asList(
new Route(GET, "/_cluster/nodes/hotthreads"),
new Route(GET, "/_cluster/nodes/hot_threads"),
new Route(GET, "/_cluster/nodes/{nodeId}/hotthreads"),
new Route(GET, "/_cluster/nodes/{nodeId}/hot_threads"),
new Route(GET, "/_nodes/hotthreads"),
new Route(GET, "/_nodes/hot_threads"), new Route(GET, "/_nodes/hot_threads"),
new Route(GET, "/_nodes/{nodeId}/hotthreads"), new Route(GET, "/_nodes/{nodeId}/hot_threads")
new Route(GET, "/_nodes/{nodeId}/hot_threads"))); ));
} }
@Override @Override