Skip to content
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

Address search request timeouts as transient error #561

Merged
merged 3 commits into from
Oct 5, 2023

Conversation

jowg-amazon
Copy link
Collaborator

Description

Change rest status on search request timeouts to be a transient error: REQUEST_TIMEOUT

Issues Resolved

#502

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Merging #561 (13677f4) into main (b838dd8) will not change coverage.
The diff coverage is 0.00%.

@@            Coverage Diff            @@
##               main     #561   +/-   ##
=========================================
  Coverage     25.02%   25.02%           
  Complexity      943      943           
=========================================
  Files           255      255           
  Lines         11155    11155           
  Branches       1250     1250           
=========================================
  Hits           2791     2791           
  Misses         8110     8110           
  Partials        254      254           
Files Coverage Δ
...ransport/TransportDeleteCorrelationRuleAction.java 0.00% <ø> (ø)
...arch/securityanalytics/correlation/JoinEngine.java 0.00% <0.00%> (ø)
...arch/securityanalytics/logtype/LogTypeService.java 41.32% <0.00%> (ø)
...ityanalytics/resthandler/RestSearchRuleAction.java 0.00% <0.00%> (ø)
...yanalytics/transport/TransportIndexRuleAction.java 0.00% <0.00%> (ø)
...tics/transport/TransportListCorrelationAction.java 0.00% <0.00%> (ø)
...opensearch/securityanalytics/util/RuleIndices.java 0.00% <0.00%> (ø)
.../transport/TransportDeleteCustomLogTypeAction.java 0.00% <0.00%> (ø)
...analytics/transport/TransportDeleteRuleAction.java 0.00% <0.00%> (ø)
...yanalytics/correlation/VectorEmbeddingsEngine.java 0.00% <0.00%> (ø)
... and 3 more

@@ -336,7 +336,7 @@ public void onResponse(IndexResponse response) {
@Override
public void onResponse(SearchResponse response) {
if (response.isTimedOut()) {
onFailures(new OpenSearchStatusException(response.toString(), RestStatus.INTERNAL_SERVER_ERROR));
onFailures(new OpenSearchStatusException(response.toString(), RestStatus.REQUEST_TIMEOUT));
Copy link
Contributor

@sandeshkr419 sandeshkr419 Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rely on response.toString() or should we have a more customized error message which can help debug better?

(this comment applies to other code changes as well where we are generating similar timeout errors using response.toString())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated so all errors are consistent with a "Search request timed out" message

@@ -65,10 +65,10 @@ public void onResponse(BulkByScrollResponse response) {
new OpenSearchStatusException(
String.format(
Locale.getDefault(),
"Correlation Rule with id %s cannot be deleted",
"Search request timed out. Correlation Rule with id %s cannot be deleted",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a search request?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to "request timed out"

@@ -152,7 +152,7 @@ private void onGetResponse(Rule rule) {
@Override
public void onResponse(SearchResponse response) {
if (response.isTimedOut()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a generic utils method which is invoked mutliple times. else the error message and format wont be consistent

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a utils method called handleSearchResponseTimeOut() maybe?

@lezzago lezzago merged commit 3aa2844 into opensearch-project:main Oct 5, 2023
8 of 15 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 5, 2023
Signed-off-by: jowg-amazon <[email protected]>
(cherry picked from commit 3aa2844)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 5, 2023
Signed-off-by: jowg-amazon <[email protected]>
(cherry picked from commit 3aa2844)
lezzago pushed a commit that referenced this pull request Oct 5, 2023
Signed-off-by: jowg-amazon <[email protected]>
(cherry picked from commit 3aa2844)

Co-authored-by: Joanne Wang <[email protected]>
lezzago pushed a commit that referenced this pull request Oct 5, 2023
Signed-off-by: jowg-amazon <[email protected]>
(cherry picked from commit 3aa2844)

Co-authored-by: Joanne Wang <[email protected]>
@jowg-amazon jowg-amazon deleted the request_timeout branch October 23, 2023 21:34
riysaxen-amzn pushed a commit to riysaxen-amzn/security-analytics that referenced this pull request Feb 20, 2024
* passing props for date time filter (opensearch-project#551)

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* added loading state

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* ux improvements

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* transform vega-lite files for jest testing

Signed-off-by: Amardeepsingh Siglani <[email protected]>

---------

Signed-off-by: Amardeepsingh Siglani <[email protected]>
@jowg-amazon jowg-amazon added the backport 2.9 backports to 2.9 label Mar 12, 2024
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.9 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.9 2.9
# Navigate to the new working tree
cd .worktrees/backport-2.9
# Create a new branch
git switch --create backport/backport-561-to-2.9
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 3aa28448a05aee7001323065ad06606acdb7383d
# Push it to GitHub
git push --set-upstream origin backport/backport-561-to-2.9
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.9

Then, create a pull request where the base branch is 2.9 and the compare/head branch is backport/backport-561-to-2.9.

@jowg-amazon jowg-amazon removed the backport 2.9 backports to 2.9 label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants