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

BugFix: Notification integration issues #339

Merged
merged 2 commits into from
Apr 19, 2022

Conversation

thalurur
Copy link
Contributor

@thalurur thalurur commented Apr 19, 2022

Signed-off-by: Ravi Thaluru [email protected]

Issue #, if available:
N/A

Description of changes:
At the moment when notification plugin is called from IM the thread context is not populated with user information as a result when filter by backend roles is enabled in notification - IM won't be able to successfully send the notification. Updating logic to populate the thread context correctly

Added all the required run time dependencies to successfully send notifications through custom webhook

CheckList:

  • 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.

@thalurur thalurur requested a review from a team April 19, 2022 01:40
@thalurur thalurur marked this pull request as draft April 19, 2022 01:40
@thalurur thalurur force-pushed the notif branch 3 times, most recently from 6ba8c33 to a353c11 Compare April 19, 2022 01:49
@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2022

Codecov Report

Merging #339 (4c1a529) into main (62858ce) will decrease coverage by 0.19%.
The diff coverage is 5.00%.

@@             Coverage Diff              @@
##               main     #339      +/-   ##
============================================
- Coverage     75.11%   74.91%   -0.20%     
+ Complexity     2139     2137       -2     
============================================
  Files           262      262              
  Lines         12425    12434       +9     
  Branches       1966     1966              
============================================
- Hits           9333     9315      -18     
- Misses         2029     2052      +23     
- Partials       1063     1067       +4     
Impacted Files Coverage Δ
...ement/step/notification/AttemptNotificationStep.kt 9.37% <0.00%> (ø)
...ent/indexstatemanagement/util/NotificationUtils.kt 0.00% <0.00%> (ø)
...agement/indexstatemanagement/ManagedIndexRunner.kt 46.10% <50.00%> (+0.12%) ⬆️
...statemanagement/model/destination/CustomWebhook.kt 67.14% <0.00%> (-28.58%) ⬇️
...nt/indexstatemanagement/model/destination/Slack.kt 55.55% <0.00%> (-22.23%) ⬇️
...gement/indexstatemanagement/action/ShrinkAction.kt 66.17% <0.00%> (-2.95%) ⬇️
...ndexstatemanagement/IndexStateManagementHistory.kt 78.62% <0.00%> (-1.38%) ⬇️
...nt/indexstatemanagement/ManagedIndexCoordinator.kt 75.22% <0.00%> (-0.62%) ⬇️
.../opensearch/indexmanagement/rollup/model/Rollup.kt 86.04% <0.00%> (+0.46%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62858ce...4c1a529. Read the comment docs.

@thalurur thalurur marked this pull request as ready for review April 19, 2022 08:09
@@ -174,6 +174,8 @@ dependencies {
implementation "org.opensearch:common-utils:${common_utils_version}"
implementation "com.github.seancfoley:ipaddress:5.3.3"
implementation "commons-codec:commons-codec:${versions.commonscodec}"
implementation "org.apache.httpcomponents:httpclient:4.5.13"
Copy link
Member

Choose a reason for hiding this comment

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

Curious why these are added along with this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems these are needed for the sending notification to legacy custom_webhook endpoints, the libraries are no longer in class path - I am not entirely sure where this was removed. Since IM needs it bundling it as part of the zip.

The PR is meant to fix bugs with notification plugin integration and since this is one of the bugs fixed it - I added a line in overview for this. However, I think I missed the renaming of PR - I updated it now

it
)
client.threadPool().threadContext.stashContext().use {
// We need to set the user context information in the thread context for notification plugin to correctly resolve the user object
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we setting the user object twice in the threadContext? Here and above the calling stack in the runner?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe the stash context will remove all the set variables but yes, we are setting it twice but in different format and in a different location in thread context

It seems notification plugin has special requirement for internal transport action calls than rest of the cluster

@thalurur thalurur changed the title Correction: Setting whole user object when calling notification plugin BugFix: Notification integration issues Apr 19, 2022
@thalurur thalurur merged commit 1d1d62e into opensearch-project:main Apr 19, 2022
wuychn pushed a commit to ochprince/index-management that referenced this pull request Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants