forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create listener to refresh search thread resource usage (opensearch-p…
…roject#14832) Signed-off-by: Siddhant Deshmukh <[email protected]> * [bug fix] fix incorrect coordinator node search resource usages Signed-off-by: Chenyang Ji <[email protected]> * fix bug on serialization when passing task resource usage to coordinator Signed-off-by: Chenyang Ji <[email protected]> * add more unit tests Signed-off-by: Chenyang Ji <[email protected]> * remove query insights plugin related code Signed-off-by: Chenyang Ji <[email protected]> * create per request listener to refresh task resource usage Signed-off-by: Chenyang Ji <[email protected]> * Make new listener API public Signed-off-by: Siddhant Deshmukh <[email protected]> * Add changelog Signed-off-by: Siddhant Deshmukh <[email protected]> * Remove wrong files added Signed-off-by: Siddhant Deshmukh <[email protected]> * Address review comments Signed-off-by: Siddhant Deshmukh <[email protected]> * Build fix Signed-off-by: Siddhant Deshmukh <[email protected]> * Make singleton Signed-off-by: Siddhant Deshmukh <[email protected]> * Address review comments Signed-off-by: Siddhant Deshmukh <[email protected]> * Make sure listener runs before plugin listeners Signed-off-by: Siddhant Deshmukh <[email protected]> * Spotless Signed-off-by: Siddhant Deshmukh <[email protected]> * Minor fix Signed-off-by: Siddhant Deshmukh <[email protected]> --------- Signed-off-by: Chenyang Ji <[email protected]> Signed-off-by: Siddhant Deshmukh <[email protected]> Signed-off-by: Jay Deng <[email protected]> Co-authored-by: Chenyang Ji <[email protected]> Co-authored-by: Jay Deng <[email protected]> (cherry picked from commit 8ff3bcc)
- Loading branch information
Showing
3 changed files
with
42 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
server/src/main/java/org/opensearch/action/search/SearchTaskRequestOperationsListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.action.search; | ||
|
||
import org.opensearch.tasks.TaskResourceTrackingService; | ||
|
||
/** | ||
* SearchTaskRequestOperationsListener subscriber for operations on search tasks resource usages. | ||
* Listener ensures to refreshResourceStats on request end capturing the search task resource usage | ||
* upon request completion. | ||
* | ||
*/ | ||
public final class SearchTaskRequestOperationsListener extends SearchRequestOperationsListener { | ||
private final TaskResourceTrackingService taskResourceTrackingService; | ||
|
||
public SearchTaskRequestOperationsListener(TaskResourceTrackingService taskResourceTrackingService) { | ||
this.taskResourceTrackingService = taskResourceTrackingService; | ||
} | ||
|
||
@Override | ||
public void onRequestEnd(SearchPhaseContext context, SearchRequestContext searchRequestContext) { | ||
taskResourceTrackingService.refreshResourceStats(context.getTask()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters