-
Notifications
You must be signed in to change notification settings - Fork 105
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
Reference get monitor and search monitor action / request / responses from common-utils #1305
Conversation
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
Changing to draft to ensure this is not merged until opensearch-project/common-utils#566 is merged first. Will then re-run CI checks. |
@@ -167,7 +166,7 @@ class TransportGetFindingsSearchAction @Inject constructor( | |||
) | |||
val getMonitorResponse: GetMonitorResponse = | |||
[email protected] { | |||
execute(GetMonitorAction.INSTANCE, getMonitorRequest, it) | |||
execute(AlertingActions.GET_MONITOR_ACTION_TYPE, getMonitorRequest, it) |
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.
rewrite request to avoid serialization issue?
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.
This is following strategies of your previous refactoring PRs - see https://github.com/opensearch-project/alerting/pull/606/files
Could you explain more what the potential issue could be?
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.
we had faced ser/deserialization issues due to different plugins not sharing the same classloader amongst themselves
so, although these tests may pass now, the plugin invoking get monitor request would fail if the request is not transformed and re-deserialized in the transport layer
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.
Got it, thanks for the clarification. Updated the transport actions in latest commit, and did another round of manual verification on the changed APIs
plz add verification in rest tests to ensure get monitor api still works as expected. |
This is already covered via the different REST handler test suites - MonitorRestApiIT & SecureMonitorRestApiIT. I've confirmed this all tests locally as well, the failures in the CI are unrelated. Also, I've manually tested out by spinning up a local cluster and exercising all of the APIs. |
Signed-off-by: Tyler Ohlsen <[email protected]>
@@ -131,7 +131,6 @@ class TransportGetMonitorAction @Inject constructor( | |||
response.version, | |||
response.seqNo, | |||
response.primaryTerm, | |||
RestStatus.OK, |
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.
What happened with this line
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.
See last bullet point in opensearch-project/common-utils#566:
removed the status field from GetMonitorResponse. This is so we can change the response from extending ActionResponse and ToXContentObject explicitly, and changing to BaseResponse, which has an override for getStatus(). Note the BaseResponse extends the same ActionResponse and ToXContentObject. This follows the same approach as done previously - see https://github.com/opensearch-project/alerting/pull/556/files as an example.
Signed-off-by: Tyler Ohlsen <[email protected]>
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/alerting/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/alerting/backport-2.x
# Create a new branch
git switch --create backport-1305-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b7c1823ea8e6ddba894f92a6f30ad2750ca6edd9
# Push it to GitHub
git push --set-upstream origin backport-1305-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/alerting/backport-2.x Then, create a pull request where the |
… from common-utils (opensearch-project#1305) * Use get monitor action / req / resp from common-utils Signed-off-by: Tyler Ohlsen <[email protected]> * Clean up remaining references Signed-off-by: Tyler Ohlsen <[email protected]> * Refactor search monitor action/request also Signed-off-by: Tyler Ohlsen <[email protected]> * Rewrite get monitor and search monitor transport action requests Signed-off-by: Tyler Ohlsen <[email protected]> --------- Signed-off-by: Tyler Ohlsen <[email protected]>
… from common-utils (#1305) * Use get monitor action / req / resp from common-utils Signed-off-by: Tyler Ohlsen <[email protected]> * Clean up remaining references Signed-off-by: Tyler Ohlsen <[email protected]> * Refactor search monitor action/request also Signed-off-by: Tyler Ohlsen <[email protected]> * Rewrite get monitor and search monitor transport action requests Signed-off-by: Tyler Ohlsen <[email protected]> --------- Signed-off-by: Tyler Ohlsen <[email protected]> Signed-off-by: Chase Engelbrecht <[email protected]>
Issue #, if available:
Description of changes:
Refactors the get monitor and search monitor action / request / responses from its definitions in this repository, to use the referenced definitions in common-utils. See related common-utils PR: opensearch-project/common-utils#566.
Historically, this was done for several of the alerting transport actions already - see #606 for an example
GetMonitorAction
/GetMonitorRequest
/GetMonitorResponse
/SearchMonitorAction
/SearchMonitorRequest
GetMonitorAction.INSTANCE
->AlertingActions.GET_MONITOR_ACTION_TYPE
, and all instances ofSearchMonitorAction.INSTANCE
->AlertingActions.SEARCH_MONITORS_ACTION_TYPE
AlertingPlugin
to reference the correct get monitor & search monitor actionsConfirmed build and all tests pass. Tested on a local cluster using the changes in common-utils, confirmed all functionality and APIs work as expected.
CheckList:
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.