diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/AlertingPlugin.kt b/alerting/src/main/kotlin/org/opensearch/alerting/AlertingPlugin.kt index 4ca201f60..1f64d4305 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/AlertingPlugin.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/AlertingPlugin.kt @@ -15,6 +15,8 @@ import org.opensearch.alerting.action.GetRemoteIndexesAction import org.opensearch.alerting.action.SearchEmailAccountAction import org.opensearch.alerting.action.SearchEmailGroupAction import org.opensearch.alerting.alerts.AlertIndices +import org.opensearch.alerting.alerts.AlertIndices.Companion.ALERT_CONFIG_INDEX +import org.opensearch.alerting.alerts.AlertIndices.Companion.ALL_ALERT_INDEX_PATTERN import org.opensearch.alerting.comments.CommentsIndices import org.opensearch.alerting.core.JobSweeper import org.opensearch.alerting.core.ScheduledJobIndices @@ -114,16 +116,13 @@ import org.opensearch.core.xcontent.XContentParser import org.opensearch.env.Environment import org.opensearch.env.NodeEnvironment import org.opensearch.index.IndexModule +import org.opensearch.indices.SystemIndexDescriptor import org.opensearch.monitor.jvm.JvmStats import org.opensearch.painless.spi.Allowlist import org.opensearch.painless.spi.AllowlistLoader import org.opensearch.painless.spi.PainlessExtension import org.opensearch.percolator.PercolatorPluginExt -import org.opensearch.plugins.ActionPlugin -import org.opensearch.plugins.ExtensiblePlugin -import org.opensearch.plugins.ReloadablePlugin -import org.opensearch.plugins.ScriptPlugin -import org.opensearch.plugins.SearchPlugin +import org.opensearch.plugins.* import org.opensearch.repositories.RepositoriesService import org.opensearch.rest.RestController import org.opensearch.rest.RestHandler @@ -139,7 +138,7 @@ import java.util.function.Supplier * It also adds [Monitor.XCONTENT_REGISTRY], [SearchInput.XCONTENT_REGISTRY], [QueryLevelTrigger.XCONTENT_REGISTRY], * [BucketLevelTrigger.XCONTENT_REGISTRY], [ClusterMetricsInput.XCONTENT_REGISTRY] to the [NamedXContentRegistry] so that we are able to deserialize the custom named objects. */ -internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, ReloadablePlugin, SearchPlugin, PercolatorPluginExt() { +internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, ReloadablePlugin, SearchPlugin, SystemIndexPlugin, PercolatorPluginExt() { override fun getContextAllowlists(): Map, List> { val whitelist = AllowlistLoader.loadFromResourceFiles(javaClass, "org.opensearch.alerting.txt") @@ -426,6 +425,13 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R return listOf(TriggerScript.CONTEXT) } + override fun getSystemIndexDescriptors(settings : Settings): Collection { + return listOf( + SystemIndexDescriptor(ALL_ALERT_INDEX_PATTERN, "Alerting Plugin system index pattern"), + SystemIndexDescriptor(ALERT_CONFIG_INDEX, "Alerting Plugin Configuration index") + ) + } + override fun reload(settings: Settings) { runner.reloadDestinationSettings(settings) } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/alerts/AlertIndices.kt b/alerting/src/main/kotlin/org/opensearch/alerting/alerts/AlertIndices.kt index 64c62f926..12d57c439 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/alerts/AlertIndices.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/alerts/AlertIndices.kt @@ -117,6 +117,8 @@ class AlertIndices( /** The in progress alert history index. */ const val ALERT_INDEX = ".opendistro-alerting-alerts" + const val ALERT_CONFIG_INDEX = ".opendistro-alerting-config" + /** The alias of the index in which to write alert history */ const val ALERT_HISTORY_WRITE_INDEX = ".opendistro-alerting-alert-history-write"