-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Create listener to refresh search thread resource usage #14832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jed326
merged 16 commits into
opensearch-project:main
from
deshsidd:bugfix-insights-coordinator-resource
Jul 23, 2024
+42
−7
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ac188bf
[bug fix] fix incorrect coordinator node search resource usages
ansjcy e5081ff
fix bug on serialization when passing task resource usage to coordinator
ansjcy cc335cc
add more unit tests
ansjcy 7185e59
remove query insights plugin related code
ansjcy 110e4fe
create per request listener to refresh task resource usage
ansjcy 545e235
Make new listener API public
deshsidd 64b779a
Add changelog
deshsidd 837ad26
Remove wrong files added
deshsidd 12c9844
Address review comments
deshsidd 6c9dbf6
Build fix
deshsidd 6a92627
Make singleton
deshsidd 7ca5cfe
Address review comments
deshsidd 0e8d668
Make sure listener runs before plugin listeners
deshsidd fa26a0c
Spotless
deshsidd b056d05
Minor fix
deshsidd a698029
Merge branch 'main' into bugfix-insights-coordinator-resource
jed326 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.