Integrate with Notifications plugin for Alerting backend#401
Integrate with Notifications plugin for Alerting backend#401qreshi merged 10 commits intoopensearch-project:mainfrom
Conversation
| logger.info("Migrated ${migratedDestinations.size} destinations") | ||
| val failedDeletedDestinations = deleteOldDestinations(client, migratedDestinations) | ||
| logger.info("Failed to delete ${failedDeletedDestinations.size} destinations from migration process cleanup") | ||
| val migratedConfigs = createNotificationChannelIfNotExists(client, configsToMigrate) |
There was a problem hiding this comment.
This might be scope of this PR, but what if the user who created the notification config, is deleted? Will it still migrate it? Or will it fail and keep retrying forever?
There was a problem hiding this comment.
You mean the user we're trying to inject in the thread context for the object is deleted?
Hmm, Security might handle that and treat it as no permissions? We'll want to test that when we test Alerting/Notif security integration. That's out of scope for this PR for now but a good callout.
| // Adding a check on TEST_ACTION Destination type here to avoid supporting it as a LegacyBaseMessage type | ||
| // just for Alerting integration tests | ||
| if (config.destination?.isTestAction() == true) { | ||
| return "test action" |
There was a problem hiding this comment.
can we define this constant somewhere else and use it both at the time assert and here.
| return "test action" | ||
| } | ||
|
|
||
| if (config.destination?.isAllowed(allowList) == false) { |
There was a problem hiding this comment.
can we rename allowList to destinationsAllowList for better readability.
| // Adding a check on TEST_ACTION Destination type here to avoid supporting it as a LegacyBaseMessage type | ||
| // just for Alerting integration tests | ||
| if (config.destination?.isTestAction() == true) { | ||
| return "test action" |
| } | ||
|
|
||
| private fun <T> fallback(key: String, affixSetting: AffixSetting<T>, regex: String, replacement: String): Setting<T>? { | ||
| return if ("_na_" == key) { |
…d Notification Channels Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com>
…to either Notification Channels or Destination Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com>
…TEST_ACTION for tests Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com>
Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com>
Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com>
Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com>
Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com>
Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com>
Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com>
…vice Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com>
76ebd85 to
a997d40
Compare
Codecov Report
@@ Coverage Diff @@
## main #401 +/- ##
============================================
+ Coverage 78.31% 78.50% +0.19%
+ Complexity 268 263 -5
============================================
Files 180 180
Lines 7631 7625 -6
Branches 1065 1069 +4
============================================
+ Hits 5976 5986 +10
+ Misses 1106 1083 -23
- Partials 549 556 +7
Continue to review full report at Codecov.
|
|
As discussed, the non-blocking comments will be addressed in a follow-up. Also, the only failing GitHub Actions now that the dependent PRs are merged in is the security workflow which is being fixed in #407, merging in for now. |
…project#401) * Add utils for retrieving notifications to both legacy Destinations and Notification Channels Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com> * Refactor runAction in MonitorRunner to be able to send notifications to either Notification Channels or Destination Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com> * Fix error handling when Notification config is not found and support TEST_ACTION for tests Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com> * Fix issue with fallback setting for Destination email keystore settings Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com> * Add publishing email Destinations via Notifications passthrough API Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com> * Remove unused code in NotificationApiUtils Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com> * Use subject as the title for Email Channels Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com> * Combine runAction() methods Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com> * Pass accountName to LegacyEmailMessage Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com> * Split retrieval of Destination configs in DestinationMigrationUtilService Signed-off-by: Mohammad Qureshi <47198598+qreshi@users.noreply.github.com> Signed-off-by: Angie Zhang <langelzh@amazon.com>
Issue #, if available: #105
Description of changes:
This PR depends on opensearch-project/common-utils#158 and opensearch-project/notifications#406 so the GitHub Actions are expected to fail without at least
common-utilsbeing merged inThe main changes in this PR are:
email_groupconfigs were being checked with a string match which could also appear in the Email Destination (this would cause it to use the wrong parser so the fetching of the different config types has been split up)opendistro*.variants this would cause runtime errors when it tried to load the keystore settings and failed on falling back to the old settingCheckList:
[x] 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.