From 1c702882f6a1ee0ae09890726633f9b9377596f0 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Thu, 29 Jun 2023 10:14:51 -0400 Subject: [PATCH 1/7] remove job scheduler (#1560) * remove job scheduler Signed-off-by: Derek Ho * remove job scheduler files and build.gradle Signed-off-by: Derek Ho * ktlint Signed-off-by: Derek Ho * add back job scheduler to fix bwc Signed-off-by: Derek Ho * remove job scheduler and add it back for older version Signed-off-by: Derek Ho * remove job scheduler in prepare Bwc Tests Signed-off-by: Derek Ho * bump bwc version Signed-off-by: Derek Ho * add todo of removing job scheduler things after 2.9 release Signed-off-by: Derek Ho --------- Signed-off-by: Derek Ho (cherry picked from commit 4e0ca5ab59747d84c14441db0973fbc2a0dc5574) Signed-off-by: Derek Ho --- build.gradle | 27 --- .../observability/ObservabilityPlugin.kt | 25 +-- .../opensearch/observability/model/RestTag.kt | 4 - .../observability/model/ScheduledJobDoc.kt | 171 ------------------ .../resthandler/SchedulerRestHandler.kt | 155 ---------------- .../scheduler/ObservabilityJobParser.kt | 22 --- .../scheduler/ObservabilityJobRunner.kt | 37 ---- .../observability/ObservabilityPluginIT.kt | 4 - 8 files changed, 1 insertion(+), 444 deletions(-) delete mode 100644 src/main/kotlin/org/opensearch/observability/model/ScheduledJobDoc.kt delete mode 100644 src/main/kotlin/org/opensearch/observability/resthandler/SchedulerRestHandler.kt delete mode 100644 src/main/kotlin/org/opensearch/observability/scheduler/ObservabilityJobParser.kt delete mode 100644 src/main/kotlin/org/opensearch/observability/scheduler/ObservabilityJobRunner.kt diff --git a/build.gradle b/build.gradle index f4f92c45f..9e2ce3d6d 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,6 @@ buildscript { } common_utils_version = System.getProperty("common_utils.version", opensearch_build) kotlin_version = System.getProperty("kotlin.version", "1.6.0") - job_scheduler_version = System.getProperty("job_scheduler.version", opensearch_build) jackson_version = "2.14.1" } @@ -67,7 +66,6 @@ opensearchplugin { name 'opensearch-observability' description 'OpenSearch Plugin for OpenSearch Dashboards Observability' classname "org.opensearch.observability.ObservabilityPlugin" - extendedPlugins = ['opensearch-job-scheduler'] } publishing { @@ -188,7 +186,6 @@ allprojects { } dependencies { - zipArchive group: 'org.opensearch.plugin', name:'opensearch-job-scheduler', version: "${opensearch_build}" implementation "org.opensearch:opensearch:${opensearch_version}" implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}" implementation "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}" @@ -202,7 +199,6 @@ dependencies { implementation group: 'com.github.wnameless.json', name: 'json-base', version: '2.2.1' implementation "com.fasterxml.jackson.core:jackson-databind:${jackson_version}" implementation "com.fasterxml.jackson.core:jackson-annotations:${jackson_version}" - compileOnly "${group}:opensearch-job-scheduler-spi:${job_scheduler_version}" testImplementation( 'org.assertj:assertj-core:3.16.1', 'org.junit.jupiter:junit-jupiter-api:5.6.2' @@ -317,18 +313,6 @@ integTest.getClusters().forEach { c -> c.plugin(project.getObjects().filePropert testClusters.integTest { testDistribution = "INTEG_TEST" - // need to install job-scheduler first, need to assemble job-scheduler first - plugin(provider(new Callable(){ - @Override - RegularFile call() throws Exception { - return new RegularFile() { - @Override - File getAsFile() { - return configurations.zipArchive.asFileTree.getSingleFile() - } - } - } - })) // Cluster shrink exception thrown if we try to set numberOfNodes to 1, so only apply if > 1 if (_numNodes > 1) numberOfNodes = _numNodes @@ -422,17 +406,6 @@ task prepareBwcTests { dependsOn bundle doLast { plugins = [ - provider(new Callable(){ - @Override - RegularFile call() throws Exception { - return new RegularFile() { - @Override - File getAsFile() { - return configurations.zipArchive.asFileTree.getSingleFile() - } - } - } - }), project.getObjects().fileProperty().value(bundle.getArchiveFile()) ] } diff --git a/src/main/kotlin/org/opensearch/observability/ObservabilityPlugin.kt b/src/main/kotlin/org/opensearch/observability/ObservabilityPlugin.kt index d4137c1ba..0e18117e1 100644 --- a/src/main/kotlin/org/opensearch/observability/ObservabilityPlugin.kt +++ b/src/main/kotlin/org/opensearch/observability/ObservabilityPlugin.kt @@ -19,9 +19,6 @@ import org.opensearch.common.settings.SettingsFilter import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.env.Environment import org.opensearch.env.NodeEnvironment -import org.opensearch.jobscheduler.spi.JobSchedulerExtension -import org.opensearch.jobscheduler.spi.ScheduledJobParser -import org.opensearch.jobscheduler.spi.ScheduledJobRunner import org.opensearch.observability.action.CreateObservabilityObjectAction import org.opensearch.observability.action.DeleteObservabilityObjectAction import org.opensearch.observability.action.GetObservabilityObjectAction @@ -31,9 +28,6 @@ import org.opensearch.observability.index.ObservabilityMetricsIndex import org.opensearch.observability.index.ObservabilityTracesIndex import org.opensearch.observability.resthandler.ObservabilityRestHandler import org.opensearch.observability.resthandler.ObservabilityStatsRestHandler -import org.opensearch.observability.resthandler.SchedulerRestHandler -import org.opensearch.observability.scheduler.ObservabilityJobParser -import org.opensearch.observability.scheduler.ObservabilityJobRunner import org.opensearch.observability.settings.PluginSettings import org.opensearch.plugins.ActionPlugin import org.opensearch.plugins.ClusterPlugin @@ -51,7 +45,7 @@ import java.util.function.Supplier * This class initializes the rest handlers. */ @Suppress("TooManyFunctions") -class ObservabilityPlugin : Plugin(), ActionPlugin, ClusterPlugin, JobSchedulerExtension { +class ObservabilityPlugin : Plugin(), ActionPlugin, ClusterPlugin { companion object { const val PLUGIN_NAME = "opensearch-observability" @@ -111,7 +105,6 @@ class ObservabilityPlugin : Plugin(), ActionPlugin, ClusterPlugin, JobSchedulerE return listOf( ObservabilityRestHandler(), ObservabilityStatsRestHandler(), - SchedulerRestHandler() // TODO: tmp rest handler only for POC purpose ) } @@ -138,20 +131,4 @@ class ObservabilityPlugin : Plugin(), ActionPlugin, ClusterPlugin, JobSchedulerE ) ) } - - override fun getJobType(): String { - return "observability" - } - - override fun getJobIndex(): String { - return SchedulerRestHandler.SCHEDULED_JOB_INDEX - } - - override fun getJobRunner(): ScheduledJobRunner { - return ObservabilityJobRunner - } - - override fun getJobParser(): ScheduledJobParser { - return ObservabilityJobParser - } } diff --git a/src/main/kotlin/org/opensearch/observability/model/RestTag.kt b/src/main/kotlin/org/opensearch/observability/model/RestTag.kt index c8a168a1e..20b04f2b3 100644 --- a/src/main/kotlin/org/opensearch/observability/model/RestTag.kt +++ b/src/main/kotlin/org/opensearch/observability/model/RestTag.kt @@ -33,10 +33,6 @@ internal object RestTag { const val OPERATIONAL_PANEL_FIELD = "operationalPanel" const val APPLICATION_FIELD = "application" const val TIMESTAMP_FIELD = "timestamp" - const val SCHEDULE_INFO_TAG = "schedule" - const val SCHEDULED_JOB_TYPE_TAG = "jobType" - const val ID_FIELD = "id" - const val IS_ENABLED_TAG = "isEnabled" private val INCLUDE_ID = Pair(OBJECT_ID_FIELD, "true") private val EXCLUDE_ACCESS = Pair(ACCESS_LIST_FIELD, "false") val REST_OUTPUT_PARAMS: Params = ToXContent.MapParams(mapOf(INCLUDE_ID)) diff --git a/src/main/kotlin/org/opensearch/observability/model/ScheduledJobDoc.kt b/src/main/kotlin/org/opensearch/observability/model/ScheduledJobDoc.kt deleted file mode 100644 index aa2cfad01..000000000 --- a/src/main/kotlin/org/opensearch/observability/model/ScheduledJobDoc.kt +++ /dev/null @@ -1,171 +0,0 @@ -package org.opensearch.observability.model - -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.common.xcontent.XContentParserUtils -import org.opensearch.core.xcontent.ToXContent -import org.opensearch.core.xcontent.XContentBuilder -import org.opensearch.core.xcontent.XContentParser -import org.opensearch.jobscheduler.spi.ScheduledJobParameter -import org.opensearch.jobscheduler.spi.schedule.Schedule -import org.opensearch.jobscheduler.spi.schedule.ScheduleParser -import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX -import org.opensearch.observability.model.RestTag.ACCESS_LIST_FIELD -import org.opensearch.observability.model.RestTag.CREATED_TIME_FIELD -import org.opensearch.observability.model.RestTag.ID_FIELD -import org.opensearch.observability.model.RestTag.IS_ENABLED_TAG -import org.opensearch.observability.model.RestTag.OBJECT_ID_FIELD -import org.opensearch.observability.model.RestTag.SCHEDULED_JOB_TYPE_TAG -import org.opensearch.observability.model.RestTag.SCHEDULE_INFO_TAG -import org.opensearch.observability.model.RestTag.TENANT_FIELD -import org.opensearch.observability.model.RestTag.UPDATED_TIME_FIELD -import org.opensearch.observability.security.UserAccessManager.DEFAULT_TENANT -import org.opensearch.observability.util.logger -import org.opensearch.observability.util.stringList -import java.io.IOException -import java.time.Instant - -/** - * TODO: this whole class is for poc purpose. As for actual implementation, it depends on the data model of Metric. - */ -internal data class ScheduledJobDoc( - val id: String, - val updatedTime: Instant, - val createdTime: Instant, - val tenant: String, - val access: List, - val jobType: JobType, - val scheduleInfo: Schedule, - val enabled: Boolean -) : ScheduledJobParameter, BaseModel { - - internal enum class JobType { Metrics, Uptime } - - internal companion object { - private val log by logger(ScheduledJobDoc::class.java) - - /** - * Parse the data from parser and create ScheduledJobDoc object - * @param parser data referenced at parser - * @param userId use this id if not available in the json - * @return created ScheduledJobDoc object - */ - @JvmStatic - @Throws(IOException::class) - @Suppress("ComplexMethod") - fun parse(parser: XContentParser, userId: String? = null): ScheduledJobDoc { - var id: String? = userId - var updatedTime: Instant? = null - var createdTime: Instant? = null - var tenant: String? = null - var access: List = listOf() - var jobType: JobType? = null - var scheduleInfo: Schedule? = null - var enabled = false - - XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser) - while (XContentParser.Token.END_OBJECT != parser.nextToken()) { - val fieldName = parser.currentName() - parser.nextToken() - when (fieldName) { - OBJECT_ID_FIELD -> id = parser.text() - UPDATED_TIME_FIELD -> updatedTime = Instant.ofEpochMilli(parser.longValue()) - CREATED_TIME_FIELD -> createdTime = Instant.ofEpochMilli(parser.longValue()) - TENANT_FIELD -> tenant = parser.text() - ACCESS_LIST_FIELD -> access = parser.stringList() - SCHEDULED_JOB_TYPE_TAG -> jobType = JobType.valueOf(parser.text()) - SCHEDULE_INFO_TAG -> scheduleInfo = ScheduleParser.parse(parser) - IS_ENABLED_TAG -> enabled = parser.booleanValue() - else -> { - parser.skipChildren() - log.info("$LOG_PREFIX:ScheduledJobDoc Skipping Unknown field $fieldName") - } - } - } - - id ?: throw IllegalArgumentException("$ID_FIELD field absent") - updatedTime ?: throw IllegalArgumentException("$UPDATED_TIME_FIELD field absent") - createdTime ?: throw IllegalArgumentException("$CREATED_TIME_FIELD field absent") - tenant = tenant ?: DEFAULT_TENANT - jobType ?: throw IllegalArgumentException("$SCHEDULED_JOB_TYPE_TAG field absent") - scheduleInfo ?: throw IllegalArgumentException("$SCHEDULE_INFO_TAG field absent") - - return ScheduledJobDoc( - id, - updatedTime, - createdTime, - tenant, - access, - jobType, - scheduleInfo, - enabled - ) - } - } - - /** - * create XContentBuilder from this object using [XContentFactory.jsonBuilder()] - * @param params XContent parameters - * @return created XContentBuilder object - */ - fun toXContent(params: ToXContent.Params = ToXContent.EMPTY_PARAMS): XContentBuilder? { - return toXContent(XContentFactory.jsonBuilder(), params) - } - - override fun writeTo(output: StreamOutput) { - output.writeString(id) - output.writeInstant(updatedTime) - output.writeInstant(createdTime) - output.writeString(tenant) - output.writeStringCollection(access) - output.writeEnum(jobType) - output.writeEnum(jobType) // jobType is read twice in constructor - output.writeOptionalWriteable(scheduleInfo) - output.writeBoolean(enabled) - } - - /** - * {ref toXContent} - */ - override fun toXContent(builder: XContentBuilder?, params: ToXContent.Params?): XContentBuilder { - builder!! - builder.startObject() - if (params?.paramAsBoolean(ID_FIELD, false) == true) { - builder.field(ID_FIELD, id) - } - builder.field(UPDATED_TIME_FIELD, updatedTime.toEpochMilli()) - .field(CREATED_TIME_FIELD, createdTime.toEpochMilli()) - .field(TENANT_FIELD, tenant) - if (params?.paramAsBoolean(ACCESS_LIST_FIELD, true) == true && access.isNotEmpty()) { - builder.field(ACCESS_LIST_FIELD, access) - } - - builder.field(SCHEDULE_INFO_TAG) - schedule.toXContent(builder, ToXContent.EMPTY_PARAMS) - - builder.field(SCHEDULED_JOB_TYPE_TAG, jobType) - .field(IS_ENABLED_TAG, enabled) - builder.endObject() - return builder - } - - override fun getName(): String { - return "poc name" // TODO: placeholder e.g. metric.name - } - - override fun getLastUpdateTime(): Instant { - return updatedTime - } - - override fun getEnabledTime(): Instant { - return createdTime - } - - override fun getSchedule(): Schedule { - return scheduleInfo - } - - override fun isEnabled(): Boolean { - return enabled - } -} diff --git a/src/main/kotlin/org/opensearch/observability/resthandler/SchedulerRestHandler.kt b/src/main/kotlin/org/opensearch/observability/resthandler/SchedulerRestHandler.kt deleted file mode 100644 index 28f3082d8..000000000 --- a/src/main/kotlin/org/opensearch/observability/resthandler/SchedulerRestHandler.kt +++ /dev/null @@ -1,155 +0,0 @@ -package org.opensearch.observability.resthandler - -import org.opensearch.action.ActionListener -import org.opensearch.action.index.IndexRequest -import org.opensearch.action.index.IndexResponse -import org.opensearch.client.node.NodeClient -import org.opensearch.common.xcontent.json.JsonXContent -import org.opensearch.jobscheduler.spi.schedule.IntervalSchedule -import org.opensearch.observability.model.RestTag -import org.opensearch.observability.model.ScheduledJobDoc -import org.opensearch.rest.BaseRestHandler -import org.opensearch.rest.BaseRestHandler.RestChannelConsumer -import org.opensearch.rest.BytesRestResponse -import org.opensearch.rest.RestChannel -import org.opensearch.rest.RestHandler -import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestResponse -import org.opensearch.rest.RestStatus -import java.io.IOException -import java.time.Instant -import java.time.temporal.ChronoUnit - -/** - * TODO: This REST handler is for POC to verify that job-scheduler workflow can run in Observability. - * In the future this will be removed. Scheduling won't have it's own REST API. It always comes with create Metic API - */ -internal class SchedulerRestHandler : BaseRestHandler() { - companion object { - private const val SCHEDULE_ACTION = "observability_jobs_actions" - const val SCHEDULED_JOB_INDEX = ".opensearch-observability-job" - private const val OBSERVABILITY_SCHEDULE_URL = "_plugins/poc/_schedule" - private const val CONSTANT = 10 - } - - /** - * {@inheritDoc} - */ - override fun getName(): String { - return SCHEDULE_ACTION - } - - /** - * {@inheritDoc} - */ - override fun routes(): List { - return listOf( - /** - * Create a new object - * Request URL: POST OBSERVABILITY_URL - * Request body: Ref [org.opensearch.observability.model.CreateObservabilityObjectRequest] - * Response body: Ref [org.opensearch.observability.model.CreateObservabilityObjectResponse] - */ - RestHandler.Route(RestRequest.Method.POST, OBSERVABILITY_SCHEDULE_URL) - ) - } - - /** - * {@inheritDoc} - */ - override fun responseParams(): Set { - return setOf( - RestTag.OBJECT_ID_FIELD, - RestTag.OBJECT_ID_LIST_FIELD, - RestTag.OBJECT_TYPE_FIELD, - RestTag.SORT_FIELD_FIELD, - RestTag.SORT_ORDER_FIELD, - RestTag.FROM_INDEX_FIELD, - RestTag.MAX_ITEMS_FIELD - ) - } - - private fun executePostRequest(request: RestRequest, client: NodeClient): RestChannelConsumer { - // TODO: Indexing a scheduled job will happen within the workflow of creating a metric. Below is for POC only. - - if (request.method() == RestRequest.Method.POST) { - val sampleId = "id" + Math.random() * CONSTANT - val scheduledJob = ScheduledJobDoc( - sampleId, - Instant.now(), - Instant.now(), - "__user__", - listOf(), - ScheduledJobDoc.JobType.Metrics, - IntervalSchedule( - Instant.now(), - 1, - ChronoUnit.MINUTES - ), - true, - ) - val indexRequest: IndexRequest = IndexRequest() - .index(SCHEDULED_JOB_INDEX) - .id(sampleId) - .source(scheduledJob.toXContent()) - - return RestChannelConsumer { restChannel: RestChannel -> - // index the job parameter - - client.index( - indexRequest, - object : ActionListener { - override fun onResponse(indexResponse: IndexResponse) { - try { - val restResponse: RestResponse = BytesRestResponse( - RestStatus.OK, - indexResponse.toXContent(JsonXContent.contentBuilder(), null) - ) - restChannel.sendResponse(restResponse) - } catch (e: IOException) { - restChannel.sendResponse( - BytesRestResponse( - RestStatus.INTERNAL_SERVER_ERROR, - e.message - ) - ) - } - } - - override fun onFailure(e: Exception) { - restChannel.sendResponse( - BytesRestResponse( - RestStatus.INTERNAL_SERVER_ERROR, - e.message - ) - ) - } - } - ) - } - } else { - return RestChannelConsumer { restChannel: RestChannel -> - restChannel.sendResponse( - BytesRestResponse( - RestStatus.METHOD_NOT_ALLOWED, - request.method().toString() + " is not allowed." - ) - ) - } - } - } - - override fun prepareRequest(request: RestRequest, client: NodeClient): RestChannelConsumer { - return when (request.method()) { - RestRequest.Method.POST -> executePostRequest(request, client) - else -> RestChannelConsumer { - it.sendResponse( - BytesRestResponse( - RestStatus.METHOD_NOT_ALLOWED, - "${request.method()} is not allowed" - ) - ) - } - } - } -} diff --git a/src/main/kotlin/org/opensearch/observability/scheduler/ObservabilityJobParser.kt b/src/main/kotlin/org/opensearch/observability/scheduler/ObservabilityJobParser.kt deleted file mode 100644 index b0dd7b70b..000000000 --- a/src/main/kotlin/org/opensearch/observability/scheduler/ObservabilityJobParser.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.opensearch.observability.scheduler - -import org.opensearch.core.xcontent.XContentParser -import org.opensearch.jobscheduler.spi.JobDocVersion -import org.opensearch.jobscheduler.spi.ScheduledJobParameter -import org.opensearch.jobscheduler.spi.ScheduledJobParser -import org.opensearch.observability.model.ScheduledJobDoc - -internal object ObservabilityJobParser : ScheduledJobParser { - /** - * {@inheritDoc} - */ - override fun parse(xContentParser: XContentParser, id: String, jobDocVersion: JobDocVersion): ScheduledJobParameter { - xContentParser.nextToken() - return ScheduledJobDoc.parse(xContentParser, id) - } -} diff --git a/src/main/kotlin/org/opensearch/observability/scheduler/ObservabilityJobRunner.kt b/src/main/kotlin/org/opensearch/observability/scheduler/ObservabilityJobRunner.kt deleted file mode 100644 index 9f52113c3..000000000 --- a/src/main/kotlin/org/opensearch/observability/scheduler/ObservabilityJobRunner.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.opensearch.observability.scheduler - -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch -import org.opensearch.jobscheduler.spi.JobExecutionContext -import org.opensearch.jobscheduler.spi.ScheduledJobParameter -import org.opensearch.jobscheduler.spi.ScheduledJobRunner -import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX -import org.opensearch.observability.model.ScheduledJobDoc -import org.opensearch.observability.util.logger - -internal object ObservabilityJobRunner : ScheduledJobRunner { - private val log by logger(ObservabilityJobRunner::class.java) - private val scope: CoroutineScope = CoroutineScope(Dispatchers.IO) - - override fun runJob(job: ScheduledJobParameter, context: JobExecutionContext) { - if (job !is ScheduledJobDoc) { - log.warn("$LOG_PREFIX:job is not of type ScheduledJobDoc:${job.javaClass.name}") - throw IllegalArgumentException("job is not of type ScheduledJobDoc:${job.javaClass.name}") - } - - scope.launch { - val scheduledJob: ScheduledJobDoc = job - val jobType = scheduledJob.jobType - // TODO: Add logic to retrieve metric and update metric index. E,g. run PPL/SQL query via transport API - // and write to metric index after some processing. - - log.info("POC: Running job type: ${jobType.name}") - } - } -} diff --git a/src/test/kotlin/org/opensearch/observability/ObservabilityPluginIT.kt b/src/test/kotlin/org/opensearch/observability/ObservabilityPluginIT.kt index 442bfc37a..60fd5d455 100644 --- a/src/test/kotlin/org/opensearch/observability/ObservabilityPluginIT.kt +++ b/src/test/kotlin/org/opensearch/observability/ObservabilityPluginIT.kt @@ -21,10 +21,6 @@ class ObservabilityPluginIT : OpenSearchIntegTestCase() { nodesInfoRequest.addMetric(NodesInfoRequest.Metric.PLUGINS.metricName()) val nodesInfoResponse = client().admin().cluster().nodesInfo(nodesInfoRequest).actionGet() val pluginInfos = nodesInfoResponse.nodes[0].getInfo(PluginsAndModules::class.java).pluginInfos - assertTrue( - pluginInfos.stream() - .anyMatch { pluginInfo: PluginInfo -> pluginInfo.name == "opensearch-job-scheduler" } - ) assertTrue( pluginInfos.stream() .anyMatch { pluginInfo: PluginInfo -> pluginInfo.name == "opensearch-observability" } From 5a7dded090390b895cd5c19d08f9a92656afc112 Mon Sep 17 00:00:00 2001 From: Eric Wei Date: Tue, 18 Jul 2023 08:37:12 -0700 Subject: [PATCH 2/7] Resolve build issue (#1572) * resolve dependency issues Signed-off-by: Eric * resolve jacocoagent missing issue Signed-off-by: Eric * bump up build.gradle Signed-off-by: Derek Ho --------- Signed-off-by: Eric Signed-off-by: Derek Ho Co-authored-by: Derek Ho (cherry picked from commit 4345041ed16ba89082c481c9e8e326ffa1f73739) Signed-off-by: Derek Ho --- build.gradle | 4 ++-- .../opensearch/observability/ObservabilityPlugin.kt | 2 +- .../action/CreateObservabilityObjectRequest.kt | 8 ++++---- .../action/CreateObservabilityObjectResponse.kt | 8 ++++---- .../action/DeleteObservabilityObjectRequest.kt | 8 ++++---- .../action/DeleteObservabilityObjectResponse.kt | 10 +++++----- .../action/GetObservabilityObjectRequest.kt | 8 ++++---- .../action/GetObservabilityObjectResponse.kt | 6 +++--- .../observability/action/ObservabilityActions.kt | 2 +- .../observability/action/PluginBaseAction.kt | 4 ++-- .../action/UpdateObservabilityObjectRequest.kt | 12 +++++------- .../action/UpdateObservabilityObjectResponse.kt | 6 +++--- .../observability/index/ObservabilityIndex.kt | 2 +- .../observability/index/ObservabilityQueryHelper.kt | 2 +- .../observability/metrics/RollingCounter.kt | 2 +- .../opensearch/observability/model/Application.kt | 8 ++++---- .../org/opensearch/observability/model/BaseModel.kt | 2 +- .../opensearch/observability/model/BaseResponse.kt | 4 ++-- .../org/opensearch/observability/model/Notebook.kt | 8 ++++---- .../model/ObservabilityObjectDataProperties.kt | 2 +- .../observability/model/ObservabilityObjectDoc.kt | 8 ++++---- .../model/ObservabilityObjectSearchResult.kt | 2 +- .../observability/model/OperationalPanel.kt | 8 ++++---- .../org/opensearch/observability/model/SavedQuery.kt | 8 ++++---- .../observability/model/SavedVisualization.kt | 8 ++++---- .../opensearch/observability/model/SearchResults.kt | 8 ++++---- .../org/opensearch/observability/model/Timestamp.kt | 8 ++++---- .../resthandler/ObservabilityRestHandler.kt | 2 +- .../resthandler/ObservabilityStatsRestHandler.kt | 2 +- .../resthandler/RestResponseToXContentListener.kt | 2 +- .../observability/security/UserAccessManager.kt | 2 +- .../org/opensearch/observability/util/Helpers.kt | 4 ++-- .../action/DeleteObservabilityObjectResponseTests.kt | 2 +- .../observability/bwc/TABackwardCompatibilityIT.kt | 2 +- .../opensearch/observability/rest/CreateObjectIT.kt | 2 +- .../opensearch/observability/rest/DeleteObjectIT.kt | 2 +- .../org/opensearch/observability/rest/GetObjectIT.kt | 2 +- .../opensearch/observability/rest/UpdateObjectIT.kt | 2 +- 38 files changed, 90 insertions(+), 92 deletions(-) diff --git a/build.gradle b/build.gradle index 9e2ce3d6d..ce68d25d0 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ buildscript { opensearch_build += "-SNAPSHOT" } common_utils_version = System.getProperty("common_utils.version", opensearch_build) - kotlin_version = System.getProperty("kotlin.version", "1.6.0") + kotlin_version = System.getProperty("kotlin.version", "1.8.21") jackson_version = "2.14.1" } @@ -37,7 +37,7 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}" classpath "org.jetbrains.kotlin:kotlin-allopen:${kotlin_version}" classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.22.0" - classpath "org.jacoco:org.jacoco.agent:0.8.5" + classpath "org.jacoco:org.jacoco.agent:0.8.8" } } diff --git a/src/main/kotlin/org/opensearch/observability/ObservabilityPlugin.kt b/src/main/kotlin/org/opensearch/observability/ObservabilityPlugin.kt index 0e18117e1..8b6f3270f 100644 --- a/src/main/kotlin/org/opensearch/observability/ObservabilityPlugin.kt +++ b/src/main/kotlin/org/opensearch/observability/ObservabilityPlugin.kt @@ -10,12 +10,12 @@ import org.opensearch.client.Client import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.node.DiscoveryNodes import org.opensearch.cluster.service.ClusterService -import org.opensearch.common.io.stream.NamedWriteableRegistry import org.opensearch.common.settings.ClusterSettings import org.opensearch.common.settings.IndexScopedSettings import org.opensearch.common.settings.Setting import org.opensearch.common.settings.Settings import org.opensearch.common.settings.SettingsFilter +import org.opensearch.core.common.io.stream.NamedWriteableRegistry import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.env.Environment import org.opensearch.env.NodeEnvironment diff --git a/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequest.kt b/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequest.kt index 8615aac21..5dac93172 100644 --- a/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequest.kt +++ b/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequest.kt @@ -7,17 +7,17 @@ package org.opensearch.observability.action import org.opensearch.action.ActionRequest import org.opensearch.action.ActionRequestValidationException -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.commons.utils.fieldIfNotNull import org.opensearch.commons.utils.logger +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser import org.opensearch.observability.metrics.Metrics +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.model.BaseObjectData import org.opensearch.observability.model.ObservabilityObjectDataProperties import org.opensearch.observability.model.ObservabilityObjectType diff --git a/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectResponse.kt b/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectResponse.kt index 021b0baa4..0846d8b71 100644 --- a/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectResponse.kt +++ b/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectResponse.kt @@ -5,15 +5,15 @@ package org.opensearch.observability.action -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.commons.utils.logger +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser import org.opensearch.observability.metrics.Metrics +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.model.BaseResponse import org.opensearch.observability.model.RestTag.OBJECT_ID_FIELD import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectRequest.kt b/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectRequest.kt index d4b9ba3a1..c4e242749 100644 --- a/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectRequest.kt +++ b/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectRequest.kt @@ -8,16 +8,16 @@ package org.opensearch.observability.action import org.opensearch.action.ActionRequest import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.ValidateActions -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.commons.utils.logger import org.opensearch.commons.utils.stringList +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.metrics.Metrics import org.opensearch.observability.model.RestTag.OBJECT_ID_FIELD diff --git a/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponse.kt b/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponse.kt index dbe4f4b19..64a503f9a 100644 --- a/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponse.kt +++ b/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponse.kt @@ -5,22 +5,22 @@ package org.opensearch.observability.action -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.commons.utils.STRING_READER import org.opensearch.commons.utils.STRING_WRITER import org.opensearch.commons.utils.enumReader import org.opensearch.commons.utils.enumWriter import org.opensearch.commons.utils.logger +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable +import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser import org.opensearch.observability.metrics.Metrics +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.model.BaseResponse import org.opensearch.observability.model.RestTag.DELETE_RESPONSE_LIST_TAG -import org.opensearch.rest.RestStatus import java.io.IOException /** diff --git a/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectRequest.kt b/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectRequest.kt index 4e524613c..6bd6b86ee 100644 --- a/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectRequest.kt +++ b/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectRequest.kt @@ -8,10 +8,6 @@ package org.opensearch.observability.action import org.opensearch.action.ActionRequest import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.ValidateActions -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.commons.utils.STRING_READER import org.opensearch.commons.utils.STRING_WRITER import org.opensearch.commons.utils.enumReader @@ -19,11 +15,15 @@ import org.opensearch.commons.utils.enumSet import org.opensearch.commons.utils.fieldIfNotNull import org.opensearch.commons.utils.logger import org.opensearch.commons.utils.stringList +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser import org.opensearch.observability.metrics.Metrics +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.model.ObservabilityObjectType import org.opensearch.observability.model.RestTag.FILTER_PARAM_LIST_FIELD import org.opensearch.observability.model.RestTag.FROM_INDEX_FIELD diff --git a/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectResponse.kt b/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectResponse.kt index 655318ffa..14180d2d1 100644 --- a/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectResponse.kt +++ b/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectResponse.kt @@ -5,9 +5,9 @@ package org.opensearch.observability.action -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser diff --git a/src/main/kotlin/org/opensearch/observability/action/ObservabilityActions.kt b/src/main/kotlin/org/opensearch/observability/action/ObservabilityActions.kt index 12a0a81c2..a3c12fcb0 100644 --- a/src/main/kotlin/org/opensearch/observability/action/ObservabilityActions.kt +++ b/src/main/kotlin/org/opensearch/observability/action/ObservabilityActions.kt @@ -7,6 +7,7 @@ package org.opensearch.observability.action import org.opensearch.OpenSearchStatusException import org.opensearch.commons.authuser.User +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.index.ObservabilityIndex import org.opensearch.observability.metrics.Metrics @@ -14,7 +15,6 @@ import org.opensearch.observability.model.ObservabilityObjectDoc import org.opensearch.observability.model.ObservabilityObjectSearchResult import org.opensearch.observability.security.UserAccessManager import org.opensearch.observability.util.logger -import org.opensearch.rest.RestStatus import java.time.Instant /** diff --git a/src/main/kotlin/org/opensearch/observability/action/PluginBaseAction.kt b/src/main/kotlin/org/opensearch/observability/action/PluginBaseAction.kt index 52ce8f16e..b7694c174 100644 --- a/src/main/kotlin/org/opensearch/observability/action/PluginBaseAction.kt +++ b/src/main/kotlin/org/opensearch/observability/action/PluginBaseAction.kt @@ -16,16 +16,16 @@ import org.opensearch.action.ActionResponse import org.opensearch.action.support.ActionFilters import org.opensearch.action.support.HandledTransportAction import org.opensearch.client.Client -import org.opensearch.common.io.stream.Writeable import org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT import org.opensearch.commons.authuser.User +import org.opensearch.core.common.io.stream.Writeable +import org.opensearch.core.rest.RestStatus import org.opensearch.index.IndexNotFoundException import org.opensearch.index.engine.VersionConflictEngineException import org.opensearch.indices.InvalidIndexNameException import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.metrics.Metrics import org.opensearch.observability.util.logger -import org.opensearch.rest.RestStatus import org.opensearch.tasks.Task import org.opensearch.transport.TransportService import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectRequest.kt b/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectRequest.kt index 0c2ed6f78..10ff668d8 100644 --- a/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectRequest.kt +++ b/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectRequest.kt @@ -8,18 +8,16 @@ package org.opensearch.observability.action import org.opensearch.action.ActionRequest import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.ValidateActions -import org.opensearch.common.Strings -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.common.xcontent.XContentParserUtils -import org.opensearch.commons.utils.fieldIfNotNull -import org.opensearch.commons.utils.logger +import org.opensearch.core.common.Strings +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser import org.opensearch.observability.metrics.Metrics +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.model.BaseObjectData import org.opensearch.observability.model.ObservabilityObjectDataProperties import org.opensearch.observability.model.ObservabilityObjectType diff --git a/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectResponse.kt b/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectResponse.kt index d3685db31..8cfe0fc96 100644 --- a/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectResponse.kt +++ b/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectResponse.kt @@ -5,13 +5,13 @@ package org.opensearch.observability.action -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.xcontent.XContentParserUtils +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser import org.opensearch.core.xcontent.XContentParser.Token +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.metrics.Metrics import org.opensearch.observability.model.BaseResponse diff --git a/src/main/kotlin/org/opensearch/observability/index/ObservabilityIndex.kt b/src/main/kotlin/org/opensearch/observability/index/ObservabilityIndex.kt index b06c30154..c7d207b75 100644 --- a/src/main/kotlin/org/opensearch/observability/index/ObservabilityIndex.kt +++ b/src/main/kotlin/org/opensearch/observability/index/ObservabilityIndex.kt @@ -24,6 +24,7 @@ import org.opensearch.common.component.LifecycleListener import org.opensearch.common.unit.TimeValue import org.opensearch.common.xcontent.LoggingDeprecationHandler import org.opensearch.common.xcontent.XContentType +import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.index.IndexNotFoundException import org.opensearch.index.query.QueryBuilders @@ -40,7 +41,6 @@ import org.opensearch.observability.model.SearchResults import org.opensearch.observability.settings.PluginSettings import org.opensearch.observability.util.SecureIndexClient import org.opensearch.observability.util.logger -import org.opensearch.rest.RestStatus import org.opensearch.search.SearchHit import org.opensearch.search.builder.SearchSourceBuilder import java.util.concurrent.TimeUnit diff --git a/src/main/kotlin/org/opensearch/observability/index/ObservabilityQueryHelper.kt b/src/main/kotlin/org/opensearch/observability/index/ObservabilityQueryHelper.kt index db7b16a13..b2f4155b2 100644 --- a/src/main/kotlin/org/opensearch/observability/index/ObservabilityQueryHelper.kt +++ b/src/main/kotlin/org/opensearch/observability/index/ObservabilityQueryHelper.kt @@ -6,6 +6,7 @@ package org.opensearch.observability.index import org.opensearch.OpenSearchStatusException +import org.opensearch.core.rest.RestStatus import org.opensearch.index.query.BoolQueryBuilder import org.opensearch.index.query.Operator import org.opensearch.index.query.QueryBuilder @@ -15,7 +16,6 @@ import org.opensearch.observability.model.RestTag.CREATED_TIME_FIELD import org.opensearch.observability.model.RestTag.NAME_FIELD import org.opensearch.observability.model.RestTag.QUERY_FIELD import org.opensearch.observability.model.RestTag.UPDATED_TIME_FIELD -import org.opensearch.rest.RestStatus import org.opensearch.search.builder.SearchSourceBuilder import org.opensearch.search.sort.SortOrder import java.util.EnumSet diff --git a/src/main/kotlin/org/opensearch/observability/metrics/RollingCounter.kt b/src/main/kotlin/org/opensearch/observability/metrics/RollingCounter.kt index 5132dff71..2db88acf4 100644 --- a/src/main/kotlin/org/opensearch/observability/metrics/RollingCounter.kt +++ b/src/main/kotlin/org/opensearch/observability/metrics/RollingCounter.kt @@ -33,7 +33,7 @@ internal class RollingCounter( trim() timeToCountMap.compute( getKey(clock.millis()) - ) { k: Long?, v: Long? -> if (v == null) n else v + n } + ) { _: Long?, v: Long? -> if (v == null) n else v + n } } /** diff --git a/src/main/kotlin/org/opensearch/observability/model/Application.kt b/src/main/kotlin/org/opensearch/observability/model/Application.kt index 7fdf615ed..7a32b2e7f 100644 --- a/src/main/kotlin/org/opensearch/observability/model/Application.kt +++ b/src/main/kotlin/org/opensearch/observability/model/Application.kt @@ -5,15 +5,15 @@ package org.opensearch.observability.model -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.commons.utils.stringList +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.util.fieldIfNotNull import org.opensearch.observability.util.logger diff --git a/src/main/kotlin/org/opensearch/observability/model/BaseModel.kt b/src/main/kotlin/org/opensearch/observability/model/BaseModel.kt index 976d4c530..f50baee8e 100644 --- a/src/main/kotlin/org/opensearch/observability/model/BaseModel.kt +++ b/src/main/kotlin/org/opensearch/observability/model/BaseModel.kt @@ -5,7 +5,7 @@ package org.opensearch.observability.model -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent /** diff --git a/src/main/kotlin/org/opensearch/observability/model/BaseResponse.kt b/src/main/kotlin/org/opensearch/observability/model/BaseResponse.kt index 8844772ec..af0ccc8d6 100644 --- a/src/main/kotlin/org/opensearch/observability/model/BaseResponse.kt +++ b/src/main/kotlin/org/opensearch/observability/model/BaseResponse.kt @@ -6,12 +6,12 @@ package org.opensearch.observability.model import org.opensearch.action.ActionResponse -import org.opensearch.common.io.stream.StreamInput import org.opensearch.common.xcontent.XContentFactory +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder -import org.opensearch.rest.RestStatus import java.io.IOException /** diff --git a/src/main/kotlin/org/opensearch/observability/model/Notebook.kt b/src/main/kotlin/org/opensearch/observability/model/Notebook.kt index 23daf4cab..f8a2f8253 100644 --- a/src/main/kotlin/org/opensearch/observability/model/Notebook.kt +++ b/src/main/kotlin/org/opensearch/observability/model/Notebook.kt @@ -5,14 +5,14 @@ package org.opensearch.observability.model -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.common.xcontent.XContentParserUtils +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.util.fieldIfNotNull import org.opensearch.observability.util.logger diff --git a/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectDataProperties.kt b/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectDataProperties.kt index 9b46c3b65..2a0703b5b 100644 --- a/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectDataProperties.kt +++ b/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectDataProperties.kt @@ -5,7 +5,7 @@ package org.opensearch.observability.model -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.XContentParser internal object ObservabilityObjectDataProperties { diff --git a/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectDoc.kt b/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectDoc.kt index 50766416d..1849ec4ed 100644 --- a/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectDoc.kt +++ b/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectDoc.kt @@ -5,16 +5,16 @@ package org.opensearch.observability.model -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.commons.utils.logger import org.opensearch.commons.utils.stringList +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.model.ObservabilityObjectDataProperties.getReaderForObjectType import org.opensearch.observability.model.RestTag.ACCESS_LIST_FIELD import org.opensearch.observability.model.RestTag.CREATED_TIME_FIELD diff --git a/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectSearchResult.kt b/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectSearchResult.kt index c312e9eb0..460039f7f 100644 --- a/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectSearchResult.kt +++ b/src/main/kotlin/org/opensearch/observability/model/ObservabilityObjectSearchResult.kt @@ -7,7 +7,7 @@ package org.opensearch.observability.model import org.apache.lucene.search.TotalHits import org.opensearch.action.search.SearchResponse -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.core.xcontent.XContentParser import org.opensearch.observability.model.RestTag.OBJECT_LIST_FIELD diff --git a/src/main/kotlin/org/opensearch/observability/model/OperationalPanel.kt b/src/main/kotlin/org/opensearch/observability/model/OperationalPanel.kt index 735f33154..214fbb65c 100644 --- a/src/main/kotlin/org/opensearch/observability/model/OperationalPanel.kt +++ b/src/main/kotlin/org/opensearch/observability/model/OperationalPanel.kt @@ -5,14 +5,14 @@ package org.opensearch.observability.model -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.common.xcontent.XContentParserUtils +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.util.fieldIfNotNull import org.opensearch.observability.util.logger diff --git a/src/main/kotlin/org/opensearch/observability/model/SavedQuery.kt b/src/main/kotlin/org/opensearch/observability/model/SavedQuery.kt index 14fdedfec..37a7b00e2 100644 --- a/src/main/kotlin/org/opensearch/observability/model/SavedQuery.kt +++ b/src/main/kotlin/org/opensearch/observability/model/SavedQuery.kt @@ -5,14 +5,14 @@ package org.opensearch.observability.model -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.common.xcontent.XContentParserUtils +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.util.fieldIfNotNull import org.opensearch.observability.util.logger diff --git a/src/main/kotlin/org/opensearch/observability/model/SavedVisualization.kt b/src/main/kotlin/org/opensearch/observability/model/SavedVisualization.kt index f71dd0e7b..f934af864 100644 --- a/src/main/kotlin/org/opensearch/observability/model/SavedVisualization.kt +++ b/src/main/kotlin/org/opensearch/observability/model/SavedVisualization.kt @@ -5,14 +5,14 @@ package org.opensearch.observability.model -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.common.xcontent.XContentParserUtils +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.util.fieldIfNotNull import org.opensearch.observability.util.logger diff --git a/src/main/kotlin/org/opensearch/observability/model/SearchResults.kt b/src/main/kotlin/org/opensearch/observability/model/SearchResults.kt index f8652fcf6..1255d48e0 100644 --- a/src/main/kotlin/org/opensearch/observability/model/SearchResults.kt +++ b/src/main/kotlin/org/opensearch/observability/model/SearchResults.kt @@ -9,14 +9,14 @@ import org.apache.lucene.search.TotalHits.Relation import org.apache.lucene.search.TotalHits.Relation.EQUAL_TO import org.apache.lucene.search.TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO import org.opensearch.action.search.SearchResponse -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.common.xcontent.XContentParserUtils +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent.Params import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser import org.opensearch.observability.metrics.Metrics +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.search.SearchHit internal abstract class SearchResults : BaseModel { diff --git a/src/main/kotlin/org/opensearch/observability/model/Timestamp.kt b/src/main/kotlin/org/opensearch/observability/model/Timestamp.kt index 1f923b850..c5c5cd7f5 100644 --- a/src/main/kotlin/org/opensearch/observability/model/Timestamp.kt +++ b/src/main/kotlin/org/opensearch/observability/model/Timestamp.kt @@ -5,14 +5,14 @@ package org.opensearch.observability.model -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.common.xcontent.XContentParserUtils +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.util.fieldIfNotNull import org.opensearch.observability.util.logger diff --git a/src/main/kotlin/org/opensearch/observability/resthandler/ObservabilityRestHandler.kt b/src/main/kotlin/org/opensearch/observability/resthandler/ObservabilityRestHandler.kt index add6077a2..ba7de18e4 100644 --- a/src/main/kotlin/org/opensearch/observability/resthandler/ObservabilityRestHandler.kt +++ b/src/main/kotlin/org/opensearch/observability/resthandler/ObservabilityRestHandler.kt @@ -6,6 +6,7 @@ package org.opensearch.observability.resthandler import org.opensearch.client.node.NodeClient import org.opensearch.commons.utils.logger +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.ObservabilityPlugin.Companion.BASE_OBSERVABILITY_URI import org.opensearch.observability.ObservabilityPlugin.Companion.LOG_PREFIX import org.opensearch.observability.action.CreateObservabilityObjectAction @@ -38,7 +39,6 @@ import org.opensearch.rest.RestRequest.Method.DELETE import org.opensearch.rest.RestRequest.Method.GET import org.opensearch.rest.RestRequest.Method.POST import org.opensearch.rest.RestRequest.Method.PUT -import org.opensearch.rest.RestStatus import org.opensearch.search.sort.SortOrder import java.util.EnumSet diff --git a/src/main/kotlin/org/opensearch/observability/resthandler/ObservabilityStatsRestHandler.kt b/src/main/kotlin/org/opensearch/observability/resthandler/ObservabilityStatsRestHandler.kt index 2895afb81..04a5ee277 100644 --- a/src/main/kotlin/org/opensearch/observability/resthandler/ObservabilityStatsRestHandler.kt +++ b/src/main/kotlin/org/opensearch/observability/resthandler/ObservabilityStatsRestHandler.kt @@ -1,6 +1,7 @@ package org.opensearch.observability.resthandler import org.opensearch.client.node.NodeClient +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.ObservabilityPlugin.Companion.BASE_OBSERVABILITY_URI import org.opensearch.observability.metrics.Metrics import org.opensearch.rest.BaseRestHandler @@ -9,7 +10,6 @@ import org.opensearch.rest.BytesRestResponse import org.opensearch.rest.RestHandler.Route import org.opensearch.rest.RestRequest import org.opensearch.rest.RestRequest.Method.GET -import org.opensearch.rest.RestStatus /** * Rest handler for getting observability backend stats diff --git a/src/main/kotlin/org/opensearch/observability/resthandler/RestResponseToXContentListener.kt b/src/main/kotlin/org/opensearch/observability/resthandler/RestResponseToXContentListener.kt index e90b69c7a..4d4527c2b 100644 --- a/src/main/kotlin/org/opensearch/observability/resthandler/RestResponseToXContentListener.kt +++ b/src/main/kotlin/org/opensearch/observability/resthandler/RestResponseToXContentListener.kt @@ -5,13 +5,13 @@ package org.opensearch.observability.resthandler +import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.observability.metrics.Metrics import org.opensearch.observability.model.BaseResponse import org.opensearch.rest.BytesRestResponse import org.opensearch.rest.RestChannel import org.opensearch.rest.RestResponse -import org.opensearch.rest.RestStatus import org.opensearch.rest.action.RestToXContentListener /** diff --git a/src/main/kotlin/org/opensearch/observability/security/UserAccessManager.kt b/src/main/kotlin/org/opensearch/observability/security/UserAccessManager.kt index a49983d89..4437053aa 100644 --- a/src/main/kotlin/org/opensearch/observability/security/UserAccessManager.kt +++ b/src/main/kotlin/org/opensearch/observability/security/UserAccessManager.kt @@ -7,9 +7,9 @@ package org.opensearch.observability.security import org.opensearch.OpenSearchStatusException import org.opensearch.commons.authuser.User +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.settings.PluginSettings import org.opensearch.observability.settings.PluginSettings.FilterBy -import org.opensearch.rest.RestStatus import java.util.stream.Collectors /** diff --git a/src/main/kotlin/org/opensearch/observability/util/Helpers.kt b/src/main/kotlin/org/opensearch/observability/util/Helpers.kt index 738b3fa8a..448d3d651 100644 --- a/src/main/kotlin/org/opensearch/observability/util/Helpers.kt +++ b/src/main/kotlin/org/opensearch/observability/util/Helpers.kt @@ -7,9 +7,8 @@ package org.opensearch.observability.util import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.Logger -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.common.xcontent.XContentType +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.core.xcontent.DeprecationHandler import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.core.xcontent.ToXContent @@ -17,6 +16,7 @@ import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser import org.opensearch.core.xcontent.XContentParser.Token +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.rest.RestRequest internal fun StreamInput.createJsonParser(): XContentParser { diff --git a/src/test/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponseTests.kt b/src/test/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponseTests.kt index 13d28d57a..03800069d 100644 --- a/src/test/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponseTests.kt +++ b/src/test/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponseTests.kt @@ -10,9 +10,9 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.opensearch.commons.utils.recreateObject +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.createObjectFromJsonString import org.opensearch.observability.getJsonString -import org.opensearch.rest.RestStatus internal class DeleteObservabilityObjectResponseTests { @Test diff --git a/src/test/kotlin/org/opensearch/observability/bwc/TABackwardCompatibilityIT.kt b/src/test/kotlin/org/opensearch/observability/bwc/TABackwardCompatibilityIT.kt index c06dffd69..c53021030 100644 --- a/src/test/kotlin/org/opensearch/observability/bwc/TABackwardCompatibilityIT.kt +++ b/src/test/kotlin/org/opensearch/observability/bwc/TABackwardCompatibilityIT.kt @@ -7,6 +7,7 @@ package org.opensearch.observability.bwc import org.junit.Assert import org.opensearch.common.settings.Settings +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.ObservabilityPlugin.Companion.BASE_OBSERVABILITY_URI import org.opensearch.observability.PluginRestTestCase import org.opensearch.observability.constructNotebookRequest @@ -15,7 +16,6 @@ import org.opensearch.observability.constructSavedQueryRequest import org.opensearch.observability.constructSavedVisualizationRequest import org.opensearch.observability.jsonify import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus import java.util.List import java.util.Map diff --git a/src/test/kotlin/org/opensearch/observability/rest/CreateObjectIT.kt b/src/test/kotlin/org/opensearch/observability/rest/CreateObjectIT.kt index 28630ba61..cf8e8fd46 100644 --- a/src/test/kotlin/org/opensearch/observability/rest/CreateObjectIT.kt +++ b/src/test/kotlin/org/opensearch/observability/rest/CreateObjectIT.kt @@ -6,6 +6,7 @@ package org.opensearch.observability.rest import org.junit.Assert +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.ObservabilityPlugin.Companion.BASE_OBSERVABILITY_URI import org.opensearch.observability.PluginRestTestCase import org.opensearch.observability.constructNotebookRequest @@ -16,7 +17,6 @@ import org.opensearch.observability.constructTimestampRequest import org.opensearch.observability.jsonify import org.opensearch.observability.validateErrorResponse import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class CreateObjectIT : PluginRestTestCase() { diff --git a/src/test/kotlin/org/opensearch/observability/rest/DeleteObjectIT.kt b/src/test/kotlin/org/opensearch/observability/rest/DeleteObjectIT.kt index ba6f7bdcb..1e29e85cd 100644 --- a/src/test/kotlin/org/opensearch/observability/rest/DeleteObjectIT.kt +++ b/src/test/kotlin/org/opensearch/observability/rest/DeleteObjectIT.kt @@ -6,12 +6,12 @@ package org.opensearch.observability.rest import org.junit.Assert +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.ObservabilityPlugin.Companion.BASE_OBSERVABILITY_URI import org.opensearch.observability.PluginRestTestCase import org.opensearch.observability.constructNotebookRequest import org.opensearch.observability.validateErrorResponse import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class DeleteObjectIT : PluginRestTestCase() { private fun createNotebook(name: String = "test"): String { diff --git a/src/test/kotlin/org/opensearch/observability/rest/GetObjectIT.kt b/src/test/kotlin/org/opensearch/observability/rest/GetObjectIT.kt index be6019cf7..6d054ab0a 100644 --- a/src/test/kotlin/org/opensearch/observability/rest/GetObjectIT.kt +++ b/src/test/kotlin/org/opensearch/observability/rest/GetObjectIT.kt @@ -6,6 +6,7 @@ package org.opensearch.observability.rest import org.junit.Assert +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.ObservabilityPlugin.Companion.BASE_OBSERVABILITY_URI import org.opensearch.observability.PluginRestTestCase import org.opensearch.observability.constructNotebookRequest @@ -17,7 +18,6 @@ import org.opensearch.observability.jsonify import org.opensearch.observability.validateErrorResponse import org.opensearch.observability.validateTimeRecency import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus import java.time.Instant class GetObjectIT : PluginRestTestCase() { diff --git a/src/test/kotlin/org/opensearch/observability/rest/UpdateObjectIT.kt b/src/test/kotlin/org/opensearch/observability/rest/UpdateObjectIT.kt index 694ac639c..96bc78b90 100644 --- a/src/test/kotlin/org/opensearch/observability/rest/UpdateObjectIT.kt +++ b/src/test/kotlin/org/opensearch/observability/rest/UpdateObjectIT.kt @@ -6,12 +6,12 @@ package org.opensearch.observability.rest import org.junit.Assert +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.ObservabilityPlugin.Companion.BASE_OBSERVABILITY_URI import org.opensearch.observability.PluginRestTestCase import org.opensearch.observability.constructNotebookRequest import org.opensearch.observability.validateErrorResponse import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class UpdateObjectIT : PluginRestTestCase() { private fun createNotebook(name: String = "test"): String { From e1389080005a289fb9bf4f77517ae8ef1cf5dd74 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 1 Aug 2023 00:18:45 -0400 Subject: [PATCH 3/7] try get older common utils Signed-off-by: Derek Ho --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index fe9c34619..d619b0161 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask buildscript { ext { isSnapshot = "true" == System.getProperty("build.snapshot", "true") - opensearch_version = System.getProperty("opensearch.version", "2.10.0-SNAPSHOT") + opensearch_version = System.getProperty("opensearch.version", "2.9.0-SNAPSHOT") buildVersionQualifier = System.getProperty("build.version_qualifier", "") version_tokens = opensearch_version.tokenize('-') opensearch_build = version_tokens[0] + '.0' From aa8c63da3006b3591fc2ec234df5709b54693dcd Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 1 Aug 2023 00:21:13 -0400 Subject: [PATCH 4/7] revert back Signed-off-by: Derek Ho --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d619b0161..fe9c34619 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask buildscript { ext { isSnapshot = "true" == System.getProperty("build.snapshot", "true") - opensearch_version = System.getProperty("opensearch.version", "2.9.0-SNAPSHOT") + opensearch_version = System.getProperty("opensearch.version", "2.10.0-SNAPSHOT") buildVersionQualifier = System.getProperty("build.version_qualifier", "") version_tokens = opensearch_version.tokenize('-') opensearch_build = version_tokens[0] + '.0' From 6b6e1e4b5d54878b33cdecc3bb48b7297b19027a Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 1 Aug 2023 00:24:38 -0400 Subject: [PATCH 5/7] revert kotlin version change Signed-off-by: Derek Ho --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index fe9c34619..e9676b9f3 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ buildscript { opensearch_build += "-SNAPSHOT" } common_utils_version = System.getProperty("common_utils.version", opensearch_build) - kotlin_version = System.getProperty("kotlin.version", "1.6.0") + kotlin_version = System.getProperty("kotlin.version", "1.8.21") jackson_version = "2.14.1" } From 194cf91110ee76ad7647a4f98e5e663676b94a9a Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 1 Aug 2023 00:28:05 -0400 Subject: [PATCH 6/7] additional core changes Signed-off-by: Derek Ho --- .../kotlin/org/opensearch/observability/PluginRestTestCase.kt | 2 +- .../org/opensearch/observability/rest/AssemblyValidationIT.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/org/opensearch/observability/PluginRestTestCase.kt b/src/test/kotlin/org/opensearch/observability/PluginRestTestCase.kt index 9e4432566..35fd9ae3c 100644 --- a/src/test/kotlin/org/opensearch/observability/PluginRestTestCase.kt +++ b/src/test/kotlin/org/opensearch/observability/PluginRestTestCase.kt @@ -25,7 +25,7 @@ import org.opensearch.commons.rest.SecureRestClientBuilder import org.opensearch.core.xcontent.DeprecationHandler import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.test.rest.OpenSearchRestTestCase import java.io.BufferedReader import java.io.IOException diff --git a/src/test/kotlin/org/opensearch/observability/rest/AssemblyValidationIT.kt b/src/test/kotlin/org/opensearch/observability/rest/AssemblyValidationIT.kt index ce3720cc4..cfe0921f2 100644 --- a/src/test/kotlin/org/opensearch/observability/rest/AssemblyValidationIT.kt +++ b/src/test/kotlin/org/opensearch/observability/rest/AssemblyValidationIT.kt @@ -8,7 +8,7 @@ package org.opensearch.observability.rest import org.junit.Assert import org.opensearch.observability.PluginRestTestCase import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus class AssemblyValidationIT : PluginRestTestCase() { companion object { From c610774df51066d7499b904f05c984132729732a Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 1 Aug 2023 08:20:10 -0400 Subject: [PATCH 7/7] update import orderings Signed-off-by: Derek Ho --- .../observability/action/CreateObservabilityObjectRequest.kt | 2 +- .../observability/action/CreateObservabilityObjectResponse.kt | 2 +- .../observability/action/DeleteObservabilityObjectResponse.kt | 2 +- .../observability/action/GetObservabilityObjectRequest.kt | 2 +- .../observability/action/UpdateObservabilityObjectRequest.kt | 2 +- .../kotlin/org/opensearch/observability/model/SearchResults.kt | 2 +- .../kotlin/org/opensearch/observability/PluginRestTestCase.kt | 2 +- .../org/opensearch/observability/rest/AssemblyValidationIT.kt | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequest.kt b/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequest.kt index 5dac93172..f6e21207b 100644 --- a/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequest.kt +++ b/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequest.kt @@ -16,8 +16,8 @@ import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser -import org.opensearch.observability.metrics.Metrics import org.opensearch.core.xcontent.XContentParserUtils +import org.opensearch.observability.metrics.Metrics import org.opensearch.observability.model.BaseObjectData import org.opensearch.observability.model.ObservabilityObjectDataProperties import org.opensearch.observability.model.ObservabilityObjectType diff --git a/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectResponse.kt b/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectResponse.kt index 0846d8b71..93dc14df5 100644 --- a/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectResponse.kt +++ b/src/main/kotlin/org/opensearch/observability/action/CreateObservabilityObjectResponse.kt @@ -12,8 +12,8 @@ import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser -import org.opensearch.observability.metrics.Metrics import org.opensearch.core.xcontent.XContentParserUtils +import org.opensearch.observability.metrics.Metrics import org.opensearch.observability.model.BaseResponse import org.opensearch.observability.model.RestTag.OBJECT_ID_FIELD import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponse.kt b/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponse.kt index 64a503f9a..b5ebb4e9b 100644 --- a/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponse.kt +++ b/src/main/kotlin/org/opensearch/observability/action/DeleteObservabilityObjectResponse.kt @@ -17,8 +17,8 @@ import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser -import org.opensearch.observability.metrics.Metrics import org.opensearch.core.xcontent.XContentParserUtils +import org.opensearch.observability.metrics.Metrics import org.opensearch.observability.model.BaseResponse import org.opensearch.observability.model.RestTag.DELETE_RESPONSE_LIST_TAG import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectRequest.kt b/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectRequest.kt index 6bd6b86ee..755ec0efd 100644 --- a/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectRequest.kt +++ b/src/main/kotlin/org/opensearch/observability/action/GetObservabilityObjectRequest.kt @@ -22,8 +22,8 @@ import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser -import org.opensearch.observability.metrics.Metrics import org.opensearch.core.xcontent.XContentParserUtils +import org.opensearch.observability.metrics.Metrics import org.opensearch.observability.model.ObservabilityObjectType import org.opensearch.observability.model.RestTag.FILTER_PARAM_LIST_FIELD import org.opensearch.observability.model.RestTag.FROM_INDEX_FIELD diff --git a/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectRequest.kt b/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectRequest.kt index d7aa54da2..12bf7cc8c 100644 --- a/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectRequest.kt +++ b/src/main/kotlin/org/opensearch/observability/action/UpdateObservabilityObjectRequest.kt @@ -16,8 +16,8 @@ import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser -import org.opensearch.observability.metrics.Metrics import org.opensearch.core.xcontent.XContentParserUtils +import org.opensearch.observability.metrics.Metrics import org.opensearch.observability.model.BaseObjectData import org.opensearch.observability.model.ObservabilityObjectDataProperties import org.opensearch.observability.model.ObservabilityObjectType diff --git a/src/main/kotlin/org/opensearch/observability/model/SearchResults.kt b/src/main/kotlin/org/opensearch/observability/model/SearchResults.kt index 1255d48e0..9ca1b8883 100644 --- a/src/main/kotlin/org/opensearch/observability/model/SearchResults.kt +++ b/src/main/kotlin/org/opensearch/observability/model/SearchResults.kt @@ -15,8 +15,8 @@ import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent.Params import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser -import org.opensearch.observability.metrics.Metrics import org.opensearch.core.xcontent.XContentParserUtils +import org.opensearch.observability.metrics.Metrics import org.opensearch.search.SearchHit internal abstract class SearchResults : BaseModel { diff --git a/src/test/kotlin/org/opensearch/observability/PluginRestTestCase.kt b/src/test/kotlin/org/opensearch/observability/PluginRestTestCase.kt index 35fd9ae3c..f97e36b24 100644 --- a/src/test/kotlin/org/opensearch/observability/PluginRestTestCase.kt +++ b/src/test/kotlin/org/opensearch/observability/PluginRestTestCase.kt @@ -22,10 +22,10 @@ import org.opensearch.common.settings.Settings import org.opensearch.common.xcontent.XContentType import org.opensearch.commons.ConfigConstants import org.opensearch.commons.rest.SecureRestClientBuilder +import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.DeprecationHandler import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.rest.RestRequest -import org.opensearch.core.rest.RestStatus import org.opensearch.test.rest.OpenSearchRestTestCase import java.io.BufferedReader import java.io.IOException diff --git a/src/test/kotlin/org/opensearch/observability/rest/AssemblyValidationIT.kt b/src/test/kotlin/org/opensearch/observability/rest/AssemblyValidationIT.kt index cfe0921f2..8a7d1bec0 100644 --- a/src/test/kotlin/org/opensearch/observability/rest/AssemblyValidationIT.kt +++ b/src/test/kotlin/org/opensearch/observability/rest/AssemblyValidationIT.kt @@ -6,9 +6,9 @@ package org.opensearch.observability.rest import org.junit.Assert +import org.opensearch.core.rest.RestStatus import org.opensearch.observability.PluginRestTestCase import org.opensearch.rest.RestRequest -import org.opensearch.core.rest.RestStatus class AssemblyValidationIT : PluginRestTestCase() { companion object {