|
14 | 14 | import org.elasticsearch.action.admin.cluster.node.hotthreads.TransportNodesHotThreadsAction; |
15 | 15 | import org.elasticsearch.client.internal.node.NodeClient; |
16 | 16 | import org.elasticsearch.common.Strings; |
17 | | -import org.elasticsearch.core.RestApiVersion; |
18 | 17 | import org.elasticsearch.monitor.jvm.HotThreads; |
19 | 18 | import org.elasticsearch.rest.BaseRestHandler; |
20 | 19 | import org.elasticsearch.rest.RestRequest; |
|
26 | 25 |
|
27 | 26 | import java.io.IOException; |
28 | 27 | import java.util.List; |
29 | | -import java.util.Locale; |
30 | 28 |
|
31 | 29 | import static org.elasticsearch.rest.ChunkedRestResponseBodyPart.fromTextChunks; |
32 | 30 | import static org.elasticsearch.rest.RestRequest.Method.GET; |
|
36 | 34 | @ServerlessScope(Scope.INTERNAL) |
37 | 35 | public class RestNodesHotThreadsAction extends BaseRestHandler { |
38 | 36 |
|
39 | | - private static final String formatDeprecatedMessageWithoutNodeID = "[%s] is a deprecated endpoint. " |
40 | | - + "Please use [/_nodes/hot_threads] instead."; |
41 | | - private static final String formatDeprecatedMessageWithNodeID = "[%s] is a deprecated endpoint. " |
42 | | - + "Please use [/_nodes/{nodeId}/hot_threads] instead."; |
43 | | - private static final String DEPRECATED_MESSAGE_CLUSTER_NODES_HOT_THREADS = String.format( |
44 | | - Locale.ROOT, |
45 | | - formatDeprecatedMessageWithoutNodeID, |
46 | | - "/_cluster/nodes/hot_threads" |
47 | | - ); |
48 | | - private static final String DEPRECATED_MESSAGE_CLUSTER_NODES_NODEID_HOT_THREADS = String.format( |
49 | | - Locale.ROOT, |
50 | | - formatDeprecatedMessageWithNodeID, |
51 | | - "/_cluster/nodes/{nodeId}/hot_threads" |
52 | | - ); |
53 | | - private static final String DEPRECATED_MESSAGE_CLUSTER_NODES_HOTTHREADS = String.format( |
54 | | - Locale.ROOT, |
55 | | - formatDeprecatedMessageWithoutNodeID, |
56 | | - "/_cluster/nodes/hotthreads" |
57 | | - ); |
58 | | - private static final String DEPRECATED_MESSAGE_CLUSTER_NODES_NODEID_HOTTHREADS = String.format( |
59 | | - Locale.ROOT, |
60 | | - formatDeprecatedMessageWithNodeID, |
61 | | - "/_cluster/nodes/{nodeId}/hotthreads" |
62 | | - ); |
63 | | - private static final String DEPRECATED_MESSAGE_NODES_HOTTHREADS = String.format( |
64 | | - Locale.ROOT, |
65 | | - formatDeprecatedMessageWithoutNodeID, |
66 | | - "/_nodes/hotthreads" |
67 | | - ); |
68 | | - private static final String DEPRECATED_MESSAGE_NODES_NODEID_HOTTHREADS = String.format( |
69 | | - Locale.ROOT, |
70 | | - formatDeprecatedMessageWithNodeID, |
71 | | - "/_nodes/{nodeId}/hotthreads" |
72 | | - ); |
73 | | - |
74 | 37 | @Override |
75 | 38 | public List<Route> routes() { |
76 | | - return List.of( |
77 | | - new Route(GET, "/_nodes/hot_threads"), |
78 | | - new Route(GET, "/_nodes/{nodeId}/hot_threads"), |
79 | | - |
80 | | - Route.builder(GET, "/_cluster/nodes/hot_threads") |
81 | | - .deprecated(DEPRECATED_MESSAGE_CLUSTER_NODES_HOT_THREADS, RestApiVersion.V_7) |
82 | | - .build(), |
83 | | - Route.builder(GET, "/_cluster/nodes/{nodeId}/hot_threads") |
84 | | - .deprecated(DEPRECATED_MESSAGE_CLUSTER_NODES_NODEID_HOT_THREADS, RestApiVersion.V_7) |
85 | | - .build(), |
86 | | - Route.builder(GET, "/_cluster/nodes/hotthreads") |
87 | | - .deprecated(DEPRECATED_MESSAGE_CLUSTER_NODES_HOTTHREADS, RestApiVersion.V_7) |
88 | | - .build(), |
89 | | - Route.builder(GET, "/_cluster/nodes/{nodeId}/hotthreads") |
90 | | - .deprecated(DEPRECATED_MESSAGE_CLUSTER_NODES_NODEID_HOTTHREADS, RestApiVersion.V_7) |
91 | | - .build(), |
92 | | - Route.builder(GET, "/_nodes/hotthreads").deprecated(DEPRECATED_MESSAGE_NODES_HOTTHREADS, RestApiVersion.V_7).build(), |
93 | | - Route.builder(GET, "/_nodes/{nodeId}/hotthreads") |
94 | | - .deprecated(DEPRECATED_MESSAGE_NODES_NODEID_HOTTHREADS, RestApiVersion.V_7) |
95 | | - .build() |
96 | | - ); |
| 39 | + return List.of(new Route(GET, "/_nodes/hot_threads"), new Route(GET, "/_nodes/{nodeId}/hot_threads")); |
97 | 40 | } |
98 | 41 |
|
99 | 42 | @Override |
|
0 commit comments