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) * [bug fix] fix incorrect coordinator node search resource usages Signed-off-by: Chenyang Ji <cyji@amazon.com> * fix bug on serialization when passing task resource usage to coordinator Signed-off-by: Chenyang Ji <cyji@amazon.com> * add more unit tests Signed-off-by: Chenyang Ji <cyji@amazon.com> * remove query insights plugin related code Signed-off-by: Chenyang Ji <cyji@amazon.com> * create per request listener to refresh task resource usage Signed-off-by: Chenyang Ji <cyji@amazon.com> * Make new listener API public Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Add changelog Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Remove wrong files added Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Address review comments Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Build fix Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Make singleton Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Address review comments Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Make sure listener runs before plugin listeners Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Spotless Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Minor fix Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> --------- Signed-off-by: Chenyang Ji <cyji@amazon.com> Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> Signed-off-by: Jay Deng <jayd0104@gmail.com> Co-authored-by: Chenyang Ji <cyji@amazon.com> Co-authored-by: Jay Deng <jayd0104@gmail.com>
- Loading branch information
1 parent
c82a282
commit 8ff3bcc
Showing
3 changed files
with
42 additions
and
7 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