Skip to content

Commit

Permalink
Deprecate alternatives to the hot threads API (#52930)
Browse files Browse the repository at this point in the history
This commit deprecates various undocumented alternatives to the hot
threads API.
  • Loading branch information
muachilin authored and jasontedor committed Mar 24, 2020
1 parent e3ca124 commit b33fbe7
Showing 1 changed file with 50 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,67 @@

import java.io.IOException;
import java.util.List;
import java.util.Locale;

import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
import static org.elasticsearch.rest.RestRequest.Method.GET;


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
public List<Route> routes() {
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/{nodeId}/hotthreads"),
new Route(GET, "/_nodes/{nodeId}/hot_threads")));
new Route(GET, "/_nodes/{nodeId}/hot_threads")
));
}

@Override
Expand Down

0 comments on commit b33fbe7

Please sign in to comment.