Skip to content

Commit

Permalink
Register system index descriptors through SystemIndexPlugin.getSystem…
Browse files Browse the repository at this point in the history
…IndexDescriptors

Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Jun 21, 2024
1 parent f762ede commit 7207934
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 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,15 @@ class ObservabilityPlugin : Plugin(), ActionPlugin {
return PluginSettings.getAllSettings()
}

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

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ 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"
const val INDEX_NAME = ".opensearch-observability"
private 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 7207934

Please sign in to comment.