Skip to content

Commit

Permalink
revise
Browse files Browse the repository at this point in the history
Signed-off-by: Ruirui Zhang <[email protected]>
  • Loading branch information
ruai0511 committed Oct 4, 2024
1 parent 27d7ea0 commit 736dcfa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
public class TransportWlmStatsAction extends TransportNodesAction<WlmStatsRequest, WlmStatsResponse, WlmStatsRequest, QueryGroupStats> {

QueryGroupService queryGroupService;
final QueryGroupService queryGroupService;

@Inject
public TransportWlmStatsAction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
public class WlmStatsAction extends ActionType<WlmStatsResponse> {
public static final WlmStatsAction INSTANCE = new WlmStatsAction();
public static final String NAME = "cluster:monitor/query_group_stats";
public static final String NAME = "cluster:monitor/wlm/stats";

private WlmStatsAction() {
super(NAME, WlmStatsResponse::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.opensearch.wlm;

import org.opensearch.ResourceNotFoundException;
import org.opensearch.cluster.metadata.QueryGroup;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.cluster.service.ClusterService;
Expand Down Expand Up @@ -63,7 +64,13 @@ public void incrementFailuresFor(final String queryGroupId) {
*/
public QueryGroupStats nodeStats(Set<String> queryGroupIds, Boolean requestedBreached) {
final Map<String, QueryGroupStatsHolder> statsHolderMap = new HashMap<>();

if (!queryGroupIds.contains("_all")) {
for (String id : queryGroupIds) {
if (!queryGroupStateMap.containsKey(id)) {
throw new ResourceNotFoundException("QueryGroup with id " + id + " does not exist");
}
}
}
queryGroupStateMap.forEach((queryGroupId, currentState) -> {
boolean shouldInclude = (queryGroupIds.size() == 1 && queryGroupIds.contains("_all")) || queryGroupIds.contains(queryGroupId);

Expand Down

0 comments on commit 736dcfa

Please sign in to comment.