Skip to content

Commit

Permalink
Register system index descriptors through SystemIndexPlugin.getSystem…
Browse files Browse the repository at this point in the history
…IndexDescriptors (opensearch-project#1837)

* Register system index descriptors through SystemIndexPlugin.getSystemIndexDescriptors

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add notebooks index as well

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Update baseVersion

Signed-off-by: Craig Perkins <cwperx@amazon.com>

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
  • Loading branch information
cwperks authored Jun 27, 2024
1 parent 65fadc5 commit 01ba080
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.opensearch.core.common.io.stream.NamedWriteableRegistry
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.env.Environment
import org.opensearch.env.NodeEnvironment
import org.opensearch.indices.SystemIndexDescriptor
import org.opensearch.observability.action.CreateObservabilityObjectAction
import org.opensearch.observability.action.DeleteObservabilityObjectAction
import org.opensearch.observability.action.GetObservabilityObjectAction
Expand All @@ -29,6 +30,7 @@ import org.opensearch.observability.resthandler.ObservabilityStatsRestHandler
import org.opensearch.observability.settings.PluginSettings
import org.opensearch.plugins.ActionPlugin
import org.opensearch.plugins.Plugin
import org.opensearch.plugins.SystemIndexPlugin
import org.opensearch.repositories.RepositoriesService
import org.opensearch.rest.RestController
import org.opensearch.rest.RestHandler
Expand All @@ -41,7 +43,7 @@ import java.util.function.Supplier
* Entry point of the OpenSearch Observability plugin.
* This class initializes the rest handlers.
*/
class ObservabilityPlugin : Plugin(), ActionPlugin {
class ObservabilityPlugin : Plugin(), ActionPlugin, SystemIndexPlugin {

companion object {
const val PLUGIN_NAME = "opensearch-observability"
Expand All @@ -57,6 +59,16 @@ class ObservabilityPlugin : Plugin(), ActionPlugin {
return PluginSettings.getAllSettings()
}

/**
* {@inheritDoc}
*/
override fun getSystemIndexDescriptors(settings: Settings): Collection<SystemIndexDescriptor> {
return listOf(
SystemIndexDescriptor(ObservabilityIndex.INDEX_NAME, "Observability Plugin Configuration index"),
SystemIndexDescriptor(ObservabilityIndex.NOTEBOOKS_INDEX_NAME, "Observability Plugin Notebooks index")
)
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ import java.util.concurrent.TimeUnit
@Suppress("TooManyFunctions")
internal object ObservabilityIndex {
private val log by logger(ObservabilityIndex::class.java)
private const val INDEX_NAME = ".opensearch-observability"
private const val NOTEBOOKS_INDEX_NAME = ".opensearch-notebooks"
const val INDEX_NAME = ".opensearch-observability"
const val NOTEBOOKS_INDEX_NAME = ".opensearch-notebooks"
private const val OBSERVABILITY_MAPPING_FILE_NAME = "observability-mapping.yml"
private const val OBSERVABILITY_SETTINGS_FILE_NAME = "observability-settings.yml"

Expand Down

0 comments on commit 01ba080

Please sign in to comment.