From 398d9ca7fc238f6fe6c5e70ac800b99e490bad2d Mon Sep 17 00:00:00 2001 From: Manaswini Ragamouni Date: Wed, 25 Mar 2026 21:17:51 +0000 Subject: [PATCH 1/2] Revert "Inject SdkClient into transport actions for SDK persistence support (#2052)" This reverts commit 551e26e4f64a6165b950b78d66800b133c40481a. Signed-off-by: Manaswini Ragamouni --- alerting/build.gradle | 5 ----- .../transport/TransportAcknowledgeAlertAction.kt | 4 +--- .../TransportAcknowledgeChainedAlertAction.kt | 2 -- .../TransportDeleteAlertingCommentAction.kt | 4 +--- .../transport/TransportDeleteMonitorAction.kt | 4 +--- .../transport/TransportExecuteMonitorAction.kt | 4 +--- .../transport/TransportGetAlertsAction.kt | 4 +--- .../transport/TransportGetDestinationsAction.kt | 4 +--- .../transport/TransportGetMonitorAction.kt | 2 -- .../transport/TransportGetWorkflowAlertsAction.kt | 2 -- .../TransportIndexAlertingCommentAction.kt | 2 -- .../transport/TransportIndexMonitorAction.kt | 2 -- .../TransportSearchAlertingCommentAction.kt | 4 +--- .../transport/TransportSearchMonitorAction.kt | 4 +--- .../org/opensearch/alerting/MonitorTests.kt | 15 +++++++-------- .../opensearch/alerting/util/IndexUtilsTests.kt | 6 +++--- 16 files changed, 18 insertions(+), 50 deletions(-) diff --git a/alerting/build.gradle b/alerting/build.gradle index 5a53f45d7..bb44c8e62 100644 --- a/alerting/build.gradle +++ b/alerting/build.gradle @@ -102,12 +102,7 @@ configurations.all { resolutionStrategy { force "joda-time:joda-time:${versions.joda}" force "com.fasterxml.jackson.core:jackson-core:${versions.jackson}" - force "com.fasterxml.jackson.core:jackson-databind:${versions.jackson_databind}" - force "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson_annotations}" force "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}" - force "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${versions.jackson}" - force "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.jackson}" - force "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${versions.jackson}" force "commons-logging:commons-logging:${versions.commonslogging}" // force the version until OpenSearch upgrade to an invulnerable one, https://www.whitesourcesoftware.com/vulnerability-database/WS-2019-0379 force "commons-codec:commons-codec:1.13" diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeAlertAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeAlertAction.kt index ae6581824..6cc60732a 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeAlertAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeAlertAction.kt @@ -45,7 +45,6 @@ import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.core.xcontent.XContentParser import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.index.query.QueryBuilders -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.rest.RestRequest import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.search.fetch.subphase.FetchSourceContext @@ -65,8 +64,7 @@ class TransportAcknowledgeAlertAction @Inject constructor( actionFilters: ActionFilters, val settings: Settings, val xContentRegistry: NamedXContentRegistry, - val transportGetMonitorAction: TransportGetMonitorAction, - val sdkClient: SdkClient + val transportGetMonitorAction: TransportGetMonitorAction ) : HandledTransportAction( AlertingActions.ACKNOWLEDGE_ALERTS_ACTION_NAME, transportService, actionFilters, ::AcknowledgeAlertRequest ) { diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeChainedAlertAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeChainedAlertAction.kt index 1752de0df..1d94cc2f8 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeChainedAlertAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeChainedAlertAction.kt @@ -52,7 +52,6 @@ import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.core.xcontent.XContentParser import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.index.query.QueryBuilders -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.tasks.Task import org.opensearch.transport.TransportService @@ -70,7 +69,6 @@ class TransportAcknowledgeChainedAlertAction @Inject constructor( actionFilters: ActionFilters, val settings: Settings, val xContentRegistry: NamedXContentRegistry, - val sdkClient: SdkClient, ) : HandledTransportAction( AlertingActions.ACKNOWLEDGE_CHAINED_ALERTS_ACTION_NAME, transportService, diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteAlertingCommentAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteAlertingCommentAction.kt index fbf3ac423..09f8d2e00 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteAlertingCommentAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteAlertingCommentAction.kt @@ -38,7 +38,6 @@ import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.core.xcontent.XContentParser import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.index.query.QueryBuilders -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.tasks.Task import org.opensearch.transport.TransportService @@ -53,8 +52,7 @@ class TransportDeleteAlertingCommentAction @Inject constructor( actionFilters: ActionFilters, val clusterService: ClusterService, settings: Settings, - val xContentRegistry: NamedXContentRegistry, - val sdkClient: SdkClient + val xContentRegistry: NamedXContentRegistry ) : HandledTransportAction( AlertingActions.DELETE_COMMENT_ACTION_NAME, transportService, actionFilters, ::DeleteCommentRequest ), diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteMonitorAction.kt index 464992cfe..b28311bd0 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteMonitorAction.kt @@ -36,7 +36,6 @@ import org.opensearch.commons.utils.recreateObject import org.opensearch.core.action.ActionListener import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.NamedXContentRegistry -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.tasks.Task import org.opensearch.transport.TransportService import org.opensearch.transport.client.Client @@ -50,8 +49,7 @@ class TransportDeleteMonitorAction @Inject constructor( actionFilters: ActionFilters, val clusterService: ClusterService, settings: Settings, - val xContentRegistry: NamedXContentRegistry, - val sdkClient: SdkClient + val xContentRegistry: NamedXContentRegistry ) : HandledTransportAction( AlertingActions.DELETE_MONITOR_ACTION_NAME, transportService, actionFilters, ::DeleteMonitorRequest ), diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportExecuteMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportExecuteMonitorAction.kt index 27c55b3db..f2769ad70 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportExecuteMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportExecuteMonitorAction.kt @@ -39,7 +39,6 @@ import org.opensearch.commons.authuser.User import org.opensearch.core.action.ActionListener import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.NamedXContentRegistry -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.tasks.Task import org.opensearch.transport.TransportService import org.opensearch.transport.client.Client @@ -57,8 +56,7 @@ class TransportExecuteMonitorAction @Inject constructor( actionFilters: ActionFilters, val xContentRegistry: NamedXContentRegistry, private val docLevelMonitorQueries: DocLevelMonitorQueries, - private val settings: Settings, - private val sdkClient: SdkClient + private val settings: Settings ) : HandledTransportAction ( ExecuteMonitorAction.NAME, transportService, actionFilters, ::ExecuteMonitorRequest ) { diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetAlertsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetAlertsAction.kt index 6b37ba9a4..1fc3ef83a 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetAlertsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetAlertsAction.kt @@ -44,7 +44,6 @@ import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.index.query.BoolQueryBuilder import org.opensearch.index.query.Operator import org.opensearch.index.query.QueryBuilders -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.search.sort.SortBuilders import org.opensearch.search.sort.SortOrder @@ -63,8 +62,7 @@ class TransportGetAlertsAction @Inject constructor( actionFilters: ActionFilters, val settings: Settings, val xContentRegistry: NamedXContentRegistry, - val namedWriteableRegistry: NamedWriteableRegistry, - val sdkClient: SdkClient + val namedWriteableRegistry: NamedWriteableRegistry ) : HandledTransportAction( AlertingActions.GET_ALERTS_ACTION_NAME, transportService, diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetDestinationsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetDestinationsAction.kt index df3c12ce4..60e5edb9d 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetDestinationsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetDestinationsAction.kt @@ -33,7 +33,6 @@ import org.opensearch.core.xcontent.XContentParser import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.index.query.Operator import org.opensearch.index.query.QueryBuilders -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.search.fetch.subphase.FetchSourceContext import org.opensearch.search.sort.SortBuilders @@ -51,8 +50,7 @@ class TransportGetDestinationsAction @Inject constructor( clusterService: ClusterService, actionFilters: ActionFilters, val settings: Settings, - val xContentRegistry: NamedXContentRegistry, - val sdkClient: SdkClient + val xContentRegistry: NamedXContentRegistry ) : HandledTransportAction ( GetDestinationsAction.NAME, transportService, actionFilters, ::GetDestinationsRequest ), diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetMonitorAction.kt index aabf0d2af..97e65ec50 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetMonitorAction.kt @@ -43,7 +43,6 @@ import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.index.IndexNotFoundException import org.opensearch.index.query.QueryBuilders -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.tasks.Task import org.opensearch.transport.RemoteTransportException @@ -60,7 +59,6 @@ class TransportGetMonitorAction @Inject constructor( val xContentRegistry: NamedXContentRegistry, val clusterService: ClusterService, settings: Settings, - val sdkClient: SdkClient, ) : HandledTransportAction( AlertingActions.GET_MONITOR_ACTION_NAME, transportService, diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetWorkflowAlertsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetWorkflowAlertsAction.kt index 8d8d9f917..dd26bf032 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetWorkflowAlertsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetWorkflowAlertsAction.kt @@ -40,7 +40,6 @@ import org.opensearch.core.xcontent.XContentParser import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.index.query.Operator import org.opensearch.index.query.QueryBuilders -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.search.sort.SortBuilders import org.opensearch.search.sort.SortOrder @@ -59,7 +58,6 @@ class TransportGetWorkflowAlertsAction @Inject constructor( actionFilters: ActionFilters, val settings: Settings, val xContentRegistry: NamedXContentRegistry, - val sdkClient: SdkClient, ) : HandledTransportAction( AlertingActions.GET_WORKFLOW_ALERTS_ACTION_NAME, transportService, diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexAlertingCommentAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexAlertingCommentAction.kt index 367e118bb..8592c505c 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexAlertingCommentAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexAlertingCommentAction.kt @@ -50,7 +50,6 @@ import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.core.xcontent.XContentParser import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.index.query.QueryBuilders -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.rest.RestRequest import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.tasks.Task @@ -73,7 +72,6 @@ constructor( val settings: Settings, val xContentRegistry: NamedXContentRegistry, val namedWriteableRegistry: NamedWriteableRegistry, - val sdkClient: SdkClient, ) : HandledTransportAction( AlertingActions.INDEX_COMMENT_ACTION_NAME, transportService, diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt index 9d914d676..bbce5b2ac 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt @@ -79,7 +79,6 @@ import org.opensearch.index.query.QueryBuilders import org.opensearch.index.reindex.BulkByScrollResponse import org.opensearch.index.reindex.DeleteByQueryAction import org.opensearch.index.reindex.DeleteByQueryRequestBuilder -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.rest.RestRequest import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.tasks.Task @@ -102,7 +101,6 @@ class TransportIndexMonitorAction @Inject constructor( val settings: Settings, val xContentRegistry: NamedXContentRegistry, val namedWriteableRegistry: NamedWriteableRegistry, - val sdkClient: SdkClient, ) : HandledTransportAction( AlertingActions.INDEX_MONITOR_ACTION_NAME, transportService, actionFilters, ::IndexMonitorRequest ), diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportSearchAlertingCommentAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportSearchAlertingCommentAction.kt index fd30e9bf4..9e8c3d153 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportSearchAlertingCommentAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportSearchAlertingCommentAction.kt @@ -40,7 +40,6 @@ import org.opensearch.core.xcontent.XContentParser import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.index.query.BoolQueryBuilder import org.opensearch.index.query.QueryBuilders -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.tasks.Task import org.opensearch.transport.TransportService @@ -56,8 +55,7 @@ class TransportSearchAlertingCommentAction @Inject constructor( val client: Client, clusterService: ClusterService, actionFilters: ActionFilters, - val namedWriteableRegistry: NamedWriteableRegistry, - val sdkClient: SdkClient + val namedWriteableRegistry: NamedWriteableRegistry ) : HandledTransportAction( AlertingActions.SEARCH_COMMENTS_ACTION_NAME, transportService, actionFilters, ::SearchRequest ), diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportSearchMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportSearchMonitorAction.kt index 307f9eb7e..21c633553 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportSearchMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportSearchMonitorAction.kt @@ -36,7 +36,6 @@ import org.opensearch.index.query.BoolQueryBuilder import org.opensearch.index.query.ExistsQueryBuilder import org.opensearch.index.query.MatchQueryBuilder import org.opensearch.index.query.QueryBuilders -import org.opensearch.remote.metadata.client.SdkClient import org.opensearch.search.SearchHits import org.opensearch.search.aggregations.InternalAggregations import org.opensearch.search.internal.InternalSearchResponse @@ -56,8 +55,7 @@ class TransportSearchMonitorAction @Inject constructor( val client: Client, clusterService: ClusterService, actionFilters: ActionFilters, - val namedWriteableRegistry: NamedWriteableRegistry, - val sdkClient: SdkClient + val namedWriteableRegistry: NamedWriteableRegistry ) : HandledTransportAction( AlertingActions.SEARCH_MONITORS_ACTION_NAME, transportService, actionFilters, ::SearchMonitorRequest ), diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/MonitorTests.kt b/alerting/src/test/kotlin/org/opensearch/alerting/MonitorTests.kt index 64f007a91..f6ed78541 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/MonitorTests.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/MonitorTests.kt @@ -31,18 +31,17 @@ class MonitorTests : OpenSearchTestCase() { } fun `test max triggers`() { - // Monitor no longer validates trigger count at construction time. - // Trigger count validation is now handled at the transport action level - // via the configurable MAX_TRIGGERS_PER_MONITOR setting. val monitor = randomQueryLevelMonitor() - val manyTriggers = mutableListOf() + val tooManyTriggers = mutableListOf() for (i in 0..10) { - manyTriggers.add(randomQueryLevelTrigger()) + tooManyTriggers.add(randomQueryLevelTrigger()) } - // Should not throw — validation moved to transport layer - val monitorWithManyTriggers = monitor.copy(triggers = manyTriggers) - assertEquals(11, monitorWithManyTriggers.triggers.size) + try { + monitor.copy(triggers = tooManyTriggers) + fail("Monitor with too many triggers should be rejected.") + } catch (e: IllegalArgumentException) { + } } } diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/util/IndexUtilsTests.kt b/alerting/src/test/kotlin/org/opensearch/alerting/util/IndexUtilsTests.kt index a800a40d9..03f03abeb 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/util/IndexUtilsTests.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/util/IndexUtilsTests.kt @@ -53,7 +53,7 @@ class IndexUtilsTests : OpenSearchTestCase() { fun `test should update index without original version`() { val indexContent = "{\"testIndex\":{\"settings\":{\"index\":{\"creation_date\":\"1558407515699\"," + "\"number_of_shards\":\"1\",\"number_of_replicas\":\"1\",\"uuid\":\"t-VBBW6aR6KpJ3XP5iISOA\"," + - "\"version\":{\"created\":\"136317827\"},\"provided_name\":\"data_test\"}},\"mapping_version\":123," + + "\"version\":{\"created\":\"6040399\"},\"provided_name\":\"data_test\"}},\"mapping_version\":123," + "\"settings_version\":123,\"aliases_version\":1,\"mappings\":{\"_doc\":{\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}}" val newMapping = "{\"_meta\":{\"schema_version\":10},\"properties\":{\"name\":{\"type\":\"keyword\"}}}" val index: IndexMetadata = IndexMetadata.fromXContent(parser(indexContent)) @@ -65,7 +65,7 @@ class IndexUtilsTests : OpenSearchTestCase() { fun `test should update index with lagged version`() { val indexContent = "{\"testIndex\":{\"settings\":{\"index\":{\"creation_date\":\"1558407515699\"," + "\"number_of_shards\":\"1\",\"number_of_replicas\":\"1\",\"uuid\":\"t-VBBW6aR6KpJ3XP5iISOA\"," + - "\"version\":{\"created\":\"136317827\"},\"provided_name\":\"data_test\"}},\"mapping_version\":123," + + "\"version\":{\"created\":\"6040399\"},\"provided_name\":\"data_test\"}},\"mapping_version\":123," + "\"settings_version\":123,\"aliases_version\":1,\"mappings\":{\"_doc\":{\"_meta\":{\"schema_version\":1},\"properties\":" + "{\"name\":{\"type\":\"keyword\"}}}}}}" val newMapping = "{\"_meta\":{\"schema_version\":10},\"properties\":{\"name\":{\"type\":\"keyword\"}}}" @@ -78,7 +78,7 @@ class IndexUtilsTests : OpenSearchTestCase() { fun `test should update index with same version`() { val indexContent = "{\"testIndex\":{\"settings\":{\"index\":{\"creation_date\":\"1558407515699\"," + "\"number_of_shards\":\"1\",\"number_of_replicas\":\"1\",\"uuid\":\"t-VBBW6aR6KpJ3XP5iISOA\"," + - "\"version\":{\"created\":\"136317827\"},\"provided_name\":\"data_test\"}},\"mapping_version\":\"1\"," + + "\"version\":{\"created\":\"6040399\"},\"provided_name\":\"data_test\"}},\"mapping_version\":\"1\"," + "\"settings_version\":\"1\",\"aliases_version\":\"1\",\"mappings\":" + "{\"_doc\":{\"_meta\":{\"schema_version\":1},\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}}" val newMapping = "{\"_meta\":{\"schema_version\":1},\"properties\":{\"name\":{\"type\":\"keyword\"}}}" From 52eee82313c9f4738f0e0f707266e6895365a3c2 Mon Sep 17 00:00:00 2001 From: Manaswini Ragamouni Date: Wed, 25 Mar 2026 21:17:51 +0000 Subject: [PATCH 2/2] Revert "feat: Integrate remote metadata SDK client with alerting plugin (#2046) (#2047)" This reverts commit 7fae8166beae7e6c5f1001918b3c2188811ba918. Signed-off-by: Manaswini Ragamouni --- alerting/build.gradle | 2 -- .../org/opensearch/alerting/AlertingPlugin.kt | 35 ++---------------- .../alerting/settings/AlertingSettings.kt | 36 ------------------- .../settings/AlertingSettingsTests.kt | 22 +----------- 4 files changed, 3 insertions(+), 92 deletions(-) diff --git a/alerting/build.gradle b/alerting/build.gradle index bb44c8e62..07f96a7f3 100644 --- a/alerting/build.gradle +++ b/alerting/build.gradle @@ -172,8 +172,6 @@ dependencies { implementation "com.github.seancfoley:ipaddress:5.4.1" implementation project(path: ":alerting-spi", configuration: 'shadow') - implementation "org.opensearch:opensearch-remote-metadata-sdk:${opensearch_build}" - testImplementation "org.antlr:antlr4-runtime:${versions.antlr4}" testImplementation "org.jetbrains.kotlin:kotlin-test:${kotlin_version}" testImplementation "org.mockito:mockito-core:${versions.mockito}" diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/AlertingPlugin.kt b/alerting/src/main/kotlin/org/opensearch/alerting/AlertingPlugin.kt index 169e718e5..a2a01e645 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/AlertingPlugin.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/AlertingPlugin.kt @@ -55,11 +55,6 @@ import org.opensearch.alerting.script.TriggerScript import org.opensearch.alerting.service.DeleteMonitorService import org.opensearch.alerting.settings.AlertingSettings import org.opensearch.alerting.settings.AlertingSettings.Companion.DOC_LEVEL_MONITOR_SHARD_FETCH_SIZE -import org.opensearch.alerting.settings.AlertingSettings.Companion.MULTI_TENANCY_ENABLED -import org.opensearch.alerting.settings.AlertingSettings.Companion.REMOTE_METADATA_ENDPOINT -import org.opensearch.alerting.settings.AlertingSettings.Companion.REMOTE_METADATA_REGION -import org.opensearch.alerting.settings.AlertingSettings.Companion.REMOTE_METADATA_SERVICE_NAME -import org.opensearch.alerting.settings.AlertingSettings.Companion.REMOTE_METADATA_STORE_TYPE import org.opensearch.alerting.settings.DestinationSettings import org.opensearch.alerting.settings.LegacyOpenDistroAlertingSettings import org.opensearch.alerting.settings.LegacyOpenDistroDestinationSettings @@ -134,13 +129,6 @@ import org.opensearch.plugins.ReloadablePlugin import org.opensearch.plugins.ScriptPlugin import org.opensearch.plugins.SearchPlugin import org.opensearch.plugins.SystemIndexPlugin -import org.opensearch.remote.metadata.client.SdkClient -import org.opensearch.remote.metadata.client.impl.SdkClientFactory -import org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_ENDPOINT_KEY -import org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_REGION_KEY -import org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_SERVICE_NAME_KEY -import org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_TYPE_KEY -import org.opensearch.remote.metadata.common.CommonValue.TENANT_AWARE_KEY import org.opensearch.repositories.RepositoriesService import org.opensearch.rest.RestController import org.opensearch.rest.RestHandler @@ -337,19 +325,6 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R this.threadPool = threadPool this.clusterService = clusterService - val sdkClient: SdkClient = SdkClientFactory.createSdkClient( - client, - xContentRegistry, - mapOf( - REMOTE_METADATA_TYPE_KEY to REMOTE_METADATA_STORE_TYPE.get(settings), - REMOTE_METADATA_ENDPOINT_KEY to REMOTE_METADATA_ENDPOINT.get(settings), - REMOTE_METADATA_REGION_KEY to REMOTE_METADATA_REGION.get(settings), - REMOTE_METADATA_SERVICE_NAME_KEY to REMOTE_METADATA_SERVICE_NAME.get(settings), - TENANT_AWARE_KEY to MULTI_TENANCY_ENABLED.get(settings).toString() - ), - client.threadPool().executor(ThreadPool.Names.GENERIC) - ) - MonitorMetadataService.initialize( client, clusterService, @@ -376,8 +351,7 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R destinationMigrationCoordinator, lockService, alertService, - triggerService, - sdkClient + triggerService ) } @@ -459,12 +433,7 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R AlertingSettings.COMMENTS_MAX_CONTENT_SIZE, AlertingSettings.MAX_COMMENTS_PER_ALERT, AlertingSettings.MAX_COMMENTS_PER_NOTIFICATION, - AlertingSettings.NOTIFICATION_CONTEXT_RESULTS_ALLOWED_ROLES, - AlertingSettings.MULTI_TENANCY_ENABLED, - AlertingSettings.REMOTE_METADATA_STORE_TYPE, - AlertingSettings.REMOTE_METADATA_ENDPOINT, - AlertingSettings.REMOTE_METADATA_REGION, - AlertingSettings.REMOTE_METADATA_SERVICE_NAME + AlertingSettings.NOTIFICATION_CONTEXT_RESULTS_ALLOWED_ROLES ) } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/settings/AlertingSettings.kt b/alerting/src/main/kotlin/org/opensearch/alerting/settings/AlertingSettings.kt index edaa0d904..2659ae74c 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/settings/AlertingSettings.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/settings/AlertingSettings.kt @@ -8,10 +8,6 @@ package org.opensearch.alerting.settings import org.opensearch.alerting.AlertingPlugin import org.opensearch.common.settings.Setting import org.opensearch.common.unit.TimeValue -import org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_ENDPOINT_KEY -import org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_REGION_KEY -import org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_SERVICE_NAME_KEY -import org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_TYPE_KEY import java.util.concurrent.TimeUnit import java.util.function.Function @@ -23,7 +19,6 @@ class AlertingSettings { companion object { const val DEFAULT_MAX_ACTIONABLE_ALERT_COUNT = 50L const val DEFAULT_FINDINGS_INDEXING_BATCH_SIZE = 1000 - private const val REMOTE_METADATA_KEY_PREFIX = "plugins.alerting" const val DEFAULT_PERCOLATE_QUERY_NUM_DOCS_IN_MEMORY = 50000 const val DEFAULT_PERCOLATE_QUERY_DOCS_SIZE_MEMORY_PERCENTAGE_LIMIT = 10 const val DEFAULT_DOC_LEVEL_MONITOR_SHARD_FETCH_SIZE = 10000 @@ -316,36 +311,5 @@ class AlertingSettings { Setting.Property.NodeScope, Setting.Property.Dynamic ) - - val MULTI_TENANCY_ENABLED: Setting = Setting.boolSetting( - "$REMOTE_METADATA_KEY_PREFIX.multi_tenancy_enabled", - false, - Setting.Property.NodeScope, - Setting.Property.Final - ) - - val REMOTE_METADATA_STORE_TYPE: Setting = Setting.simpleString( - "$REMOTE_METADATA_KEY_PREFIX.$REMOTE_METADATA_TYPE_KEY", - Setting.Property.NodeScope, - Setting.Property.Final - ) - - val REMOTE_METADATA_ENDPOINT: Setting = Setting.simpleString( - "$REMOTE_METADATA_KEY_PREFIX.$REMOTE_METADATA_ENDPOINT_KEY", - Setting.Property.NodeScope, - Setting.Property.Final - ) - - val REMOTE_METADATA_REGION: Setting = Setting.simpleString( - "$REMOTE_METADATA_KEY_PREFIX.$REMOTE_METADATA_REGION_KEY", - Setting.Property.NodeScope, - Setting.Property.Final - ) - - val REMOTE_METADATA_SERVICE_NAME: Setting = Setting.simpleString( - "$REMOTE_METADATA_KEY_PREFIX.$REMOTE_METADATA_SERVICE_NAME_KEY", - Setting.Property.NodeScope, - Setting.Property.Final - ) } } diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/settings/AlertingSettingsTests.kt b/alerting/src/test/kotlin/org/opensearch/alerting/settings/AlertingSettingsTests.kt index 20b7ee566..6ee8c4997 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/settings/AlertingSettingsTests.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/settings/AlertingSettingsTests.kt @@ -85,12 +85,7 @@ class AlertingSettingsTests : OpenSearchTestCase() { ScheduledJobSettings.SWEEP_BACKOFF_RETRY_COUNT, ScheduledJobSettings.SWEEP_BACKOFF_MILLIS, ScheduledJobSettings.SWEEPER_ENABLED, - ScheduledJobSettings.REQUEST_TIMEOUT, - AlertingSettings.MULTI_TENANCY_ENABLED, - AlertingSettings.REMOTE_METADATA_STORE_TYPE, - AlertingSettings.REMOTE_METADATA_ENDPOINT, - AlertingSettings.REMOTE_METADATA_REGION, - AlertingSettings.REMOTE_METADATA_SERVICE_NAME + ScheduledJobSettings.REQUEST_TIMEOUT ) ) ) @@ -191,19 +186,4 @@ class AlertingSettingsTests : OpenSearchTestCase() { ) ) } - - fun `test remote metadata settings defaults`() { - assertEquals(false, AlertingSettings.MULTI_TENANCY_ENABLED.getDefault(Settings.EMPTY)) - assertEquals("", AlertingSettings.REMOTE_METADATA_STORE_TYPE.getDefault(Settings.EMPTY)) - assertEquals("", AlertingSettings.REMOTE_METADATA_ENDPOINT.getDefault(Settings.EMPTY)) - assertEquals("", AlertingSettings.REMOTE_METADATA_REGION.getDefault(Settings.EMPTY)) - assertEquals("", AlertingSettings.REMOTE_METADATA_SERVICE_NAME.getDefault(Settings.EMPTY)) - } - - fun `test multi_tenancy_enabled setting reads from config`() { - val settings = Settings.builder() - .put("plugins.alerting.multi_tenancy_enabled", true) - .build() - assertEquals(true, AlertingSettings.MULTI_TENANCY_ENABLED.get(settings)) - } }