-
Notifications
You must be signed in to change notification settings - Fork 73
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
[Extensions] Migrates Search, SearchResults and SearchADTasks action to extensions #849
[Extensions] Migrates Search, SearchResults and SearchADTasks action to extensions #849
Conversation
@Override | ||
public RestResponse buildResponse(SearchResponse response) throws Exception { | ||
protected ExtensionRestResponse search(ExtensionRestRequest request, SearchResponse response) throws IOException { | ||
// return new RestResponseListener<SearchResponse>(channel) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbwiddis need some suggestion here. Do we require a Transport API for RestResponseListener
or CompletableFuture should be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owaiskazi19 I'm not sure I understand the question here. Is this a situation where we have a long-running request?
My initial thoughts are "wait some reasonable timeout for a fast request, if it's done send the search response, if not, send a response containing information to access the results later".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean CompletableFuture should be enough to handle the RestResponseListener
here?
6d065ec
to
fd57c8c
Compare
f57529f
to
bc315cd
Compare
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## feature/extensions #849 +/- ##
========================================================
- Coverage 35.96% 35.91% -0.05%
- Complexity 1916 1917 +1
========================================================
Files 299 299
Lines 17615 17645 +30
Branches 1862 1861 -1
========================================================
+ Hits 6335 6337 +2
- Misses 10825 10854 +29
+ Partials 455 454 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
bc315cd
to
34edec8
Compare
public class SearchAnomalyDetectorAction extends ActionType<SearchResponse> { | ||
// External Action which used for public facing RestAPIs. | ||
public static final String NAME = CommonValue.EXTERNAL_ACTION_PREFIX + "detector/search"; | ||
public static final SearchAnomalyDetectorAction INSTANCE = new SearchAnomalyDetectorAction(); | ||
|
||
@Inject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im curious about the purpose of adding an inject annotation to a no arg constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call out. Removed it.
public class SearchAnomalyResultAction extends ActionType<SearchResponse> { | ||
// External Action which used for public facing RestAPIs. | ||
public static final String NAME = CommonValue.EXTERNAL_ACTION_PREFIX + "result/search"; | ||
public static final SearchAnomalyResultAction INSTANCE = new SearchAnomalyResultAction(); | ||
|
||
@Inject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
private volatile Boolean filterEnabled; | ||
|
||
public ADSearchHandler(Settings settings, ClusterService clusterService, Client client) { | ||
@Inject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that we're returning this object as part of create components, there's no need to add this inject annotation here. I may be wrong though, for my own learnings, what's the reason for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. Removed it. I'm a beginner in Guice and learning it step by step. 😄
e465480
to
64f0abb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than a minor nit, looks good to me
Settings settings = Settings.EMPTY; | ||
List<Setting<?>> settingsList = List.of(AnomalyDetectorSettings.MAX_ENTITIES_FOR_PREVIEW, AnomalyDetectorSettings.PAGE_SIZE); | ||
clusterService = mock(SDKClusterService.class); | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like a stray semicolon :)
64f0abb
to
42e9dcc
Compare
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
42e9dcc
to
2ce8222
Compare
Description
This PR migrates SearchDetector, SearchResultAnomalyDetector and SearchADTasks to extension for GET and POST request.
Issues Resolved
Part of opensearch-project/opensearch-sdk-java#376, opensearch-project/opensearch-sdk-java#377 and opensearch-project/opensearch-sdk-java#380
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.