Use SdkClient for persistence in MonitorMetadataService - #2083
Merged
engechas merged 1 commit intoApr 6, 2026
Conversation
manaswini1920
requested review from
AWSHurneyt,
amsiglan,
bowenlan-amzn,
eirsep,
engechas,
getsaurabh02,
goyamegh,
jowg-amazon,
lezzago,
praveensameneni,
rishabhmaurya,
riysaxen-amzn,
sbcd90 and
toepkerd
as code owners
April 3, 2026 21:54
engechas
approved these changes
Apr 3, 2026
Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com>
manaswini1920
force-pushed
the
feature/sdk-background-services
branch
from
April 6, 2026 19:28
592e473 to
4e7543f
Compare
eirsep
reviewed
Apr 6, 2026
| xContentRegistry, | ||
| settings | ||
| ) | ||
| MonitorMetadataService.sdkClient = sdkClient |
Member
There was a problem hiding this comment.
why aren't we adding it in the constructor?
Collaborator
Author
There was a problem hiding this comment.
Because MonitorMetadataService is a Kotlin object (singleton), not a class — it doesn't have a constructor. It's initialized via MonitorMetadataService.initialize(client, clusterService, xContentRegistry, settings) which sets fields individually. The
sdkClient follows the same pattern.
You could add it as a parameter to initialize() instead of setting it separately. That would be cleaner:
kotlin
fun initialize(
client: Client,
clusterService: ClusterService,
xContentRegistry: NamedXContentRegistry,
settings: Settings,
sdkClient: SdkClient
) {
...
this.sdkClient = sdkClient
}
i can take it as follow up on the next PR
eirsep
requested changes
Apr 6, 2026
| } | ||
| } | ||
|
|
||
| private fun isIndexNotFoundException(e: Throwable): Boolean { |
Member
There was a problem hiding this comment.
isthis a common method used every where. can we move it to commons and add an extra log line
eirsep
approved these changes
Apr 6, 2026
engechas
merged commit Apr 6, 2026
4bff5b3
into
opensearch-project:remote-metadata-support
18 checks passed
Merged
1 task
manaswini1920
pushed a commit
to manaswini1920/alerting
that referenced
this pull request
Apr 7, 2026
…back Migrate AlertService to use SdkClient for all alert persistence: - searchAlerts: SearchDataObjectRequest with routing - upsertMonitorErrorAlert: search + put via SdkClient - clearMonitorErrorAlert: search + bulk put via SdkClient - moveClearedErrorAlertsToHistory: search + bulk put via SdkClient - saveAlerts: bulk put/delete via SdkClient - saveNewAlerts: bulk put via SdkClient - deleteByQuery stays on direct client (no SDK equivalent) Address PR opensearch-project#2083 review feedback: - Move sdkClient into MonitorMetadataService.initialize() parameter - Use AlertingException.isIndexNotFoundException() from common-utils - Move sdkClient creation before AlertService in AlertingPlugin Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com>
1 task
riysaxen-amzn
pushed a commit
that referenced
this pull request
Apr 9, 2026
…ations ( (#2088) * Use SdkClient for persistence in AlertService and address review feedback Migrate AlertService to use SdkClient for all alert persistence: - searchAlerts: SearchDataObjectRequest with routing - upsertMonitorErrorAlert: search + put via SdkClient - clearMonitorErrorAlert: search + bulk put via SdkClient - moveClearedErrorAlertsToHistory: search + bulk put via SdkClient - saveAlerts: bulk put/delete via SdkClient - saveNewAlerts: bulk put via SdkClient - deleteByQuery stays on direct client (no SDK equivalent) Address PR #2083 review feedback: - Move sdkClient into MonitorMetadataService.initialize() parameter - Use AlertingException.isIndexNotFoundException() from common-utils - Move sdkClient creation before AlertService in AlertingPlugin Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> * chore: Retrigger CI after common-utils merge Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> * chore: Retrigger CI after SDK 3.6 backport merge Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> * chore: Retrigger CI Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> --------- Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> Co-authored-by: Manaswini Ragamouni <ragamanu@amazon.com>
5 tasks
manaswini1920
pushed a commit
to manaswini1920/alerting
that referenced
this pull request
Apr 10, 2026
…etadata support - Migrate TransportGetMonitorAction to use SdkClient (opensearch-project#2053) - Migrate GetAlerts, DeleteComment, GetWorkflowAlerts, ExecuteMonitor to SdkClient (opensearch-project#2061) - Fix listener leak in TransportExecuteMonitorAction for empty source (opensearch-project#2080) - Migrate DeleteMonitor, GetDestinations, SearchAlertingComment, SearchMonitor to SdkClient (opensearch-project#2060) - Migrate IndexAlertingComment, IndexMonitor to SdkClient (opensearch-project#2081) - Migrate MonitorMetadataService to SdkClient (opensearch-project#2083) - Add new query level trigger evaluation independent of ScriptingService (opensearch-project#2079, opensearch-project#2090) - Migrate AlertService to SdkClient (opensearch-project#2088) - Migrate TransportAcknowledgeAlertAction to SdkClient (opensearch-project#2089) Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com>
AWSHurneyt
pushed a commit
that referenced
this pull request
Apr 10, 2026
…etadata support (#2093) - Migrate TransportGetMonitorAction to use SdkClient (#2053) - Migrate GetAlerts, DeleteComment, GetWorkflowAlerts, ExecuteMonitor to SdkClient (#2061) - Fix listener leak in TransportExecuteMonitorAction for empty source (#2080) - Migrate DeleteMonitor, GetDestinations, SearchAlertingComment, SearchMonitor to SdkClient (#2060) - Migrate IndexAlertingComment, IndexMonitor to SdkClient (#2081) - Migrate MonitorMetadataService to SdkClient (#2083) - Add new query level trigger evaluation independent of ScriptingService (#2079, #2090) - Migrate AlertService to SdkClient (#2088) - Migrate TransportAcknowledgeAlertAction to SdkClient (#2089) Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> Co-authored-by: Manaswini Ragamouni <ragamanu@amazon.com>
eirsep
pushed a commit
to eirsep/alerting
that referenced
this pull request
Apr 20, 2026
…roject#2083) Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> Co-authored-by: Manaswini Ragamouni <ragamanu@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Migrates MonitorMetadataService.upsertMetadata() and getMetadata() to use SdkClient instead of direct OpenSearch client calls, as part of the remote metadata SDK migration for background services.
Changes:
Notes:
Related Issues
Part of #2094
Part of #2094
Check List
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](https://github.com/opensearch-project/alerting/blob/main/CONTRIBUTING.md#developer-certificate
-of-origin).