>>>>>> 6b15239 (Add data test subj to app analytics (#704))
>
1.0.0.0, and 1.0.0-SNAPSHOT -> 1.0.0.0-SNAPSHOT
opensearch_build = opensearch_version.replaceAll(/(\.\d)([^\d]*)$/, '$1.0$2')
common_utils_version = System.getProperty("common_utils.version", opensearch_build)
@@ -27,7 +27,7 @@ buildscript {
classpath "org.opensearch.gradle:build-tools:${opensearch_version}"
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.12.0"
+ classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.21.0"
classpath "org.jacoco:org.jacoco.agent:0.8.7"
}
}
@@ -80,7 +80,8 @@ configurations.all {
resolutionStrategy {
force "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
force "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
- force "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.11.4"
+ force "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.13.4"
+ force "org.yaml:snakeyaml:1.32"
}
}
diff --git a/opensearch-observability/detekt.yml b/opensearch-observability/detekt.yml
index b758f5d1f..2a22a8314 100644
--- a/opensearch-observability/detekt.yml
+++ b/opensearch-observability/detekt.yml
@@ -15,3 +15,8 @@ style:
ReturnCount:
active: true
max: 10
+complexity:
+ LongMethod:
+ threshold: 120
+ NestedBlockDepth:
+ threshold: 5
diff --git a/opensearch-observability/src/main/kotlin/org/opensearch/observability/index/ObservabilityIndex.kt b/opensearch-observability/src/main/kotlin/org/opensearch/observability/index/ObservabilityIndex.kt
index 26f92dda2..0a510d1de 100644
--- a/opensearch-observability/src/main/kotlin/org/opensearch/observability/index/ObservabilityIndex.kt
+++ b/opensearch-observability/src/main/kotlin/org/opensearch/observability/index/ObservabilityIndex.kt
@@ -102,10 +102,12 @@ internal object ObservabilityIndex {
log.info("$LOG_PREFIX:Index $INDEX_NAME creation Acknowledged")
reindexNotebooks()
} else {
- throw IllegalStateException("$LOG_PREFIX:Index $INDEX_NAME creation not Acknowledged")
+ error("$LOG_PREFIX:Index $INDEX_NAME creation not Acknowledged")
}
+ } catch (exception: ResourceAlreadyExistsException) {
+ log.warn("message: ${exception.message}")
} catch (exception: Exception) {
- if (exception !is ResourceAlreadyExistsException && exception.cause !is ResourceAlreadyExistsException) {
+ if (exception.cause !is ResourceAlreadyExistsException) {
throw exception
}
}
@@ -130,7 +132,7 @@ internal object ObservabilityIndex {
if (response.isAcknowledged) {
log.info("$LOG_PREFIX:Index $INDEX_NAME update mapping Acknowledged")
} else {
- throw IllegalStateException("$LOG_PREFIX:Index $INDEX_NAME update mapping not Acknowledged")
+ error("$LOG_PREFIX:Index $INDEX_NAME update mapping not Acknowledged")
}
this.mappingsUpdated = true
} catch (exception: IndexNotFoundException) {
@@ -153,11 +155,11 @@ internal object ObservabilityIndex {
.refresh(true)
.get()
if (reindexResponse.isTimedOut) {
- throw IllegalStateException("$LOG_PREFIX:Index - reindex $NOTEBOOKS_INDEX_NAME timed out")
+ error("$LOG_PREFIX:Index - reindex $NOTEBOOKS_INDEX_NAME timed out")
} else if (reindexResponse.searchFailures.isNotEmpty()) {
- throw IllegalStateException("$LOG_PREFIX:Index - reindex $NOTEBOOKS_INDEX_NAME failed with searchFailures")
+ error("$LOG_PREFIX:Index - reindex $NOTEBOOKS_INDEX_NAME failed with searchFailures")
} else if (reindexResponse.bulkFailures.isNotEmpty()) {
- throw IllegalStateException("$LOG_PREFIX:Index - reindex $NOTEBOOKS_INDEX_NAME failed with bulkFailures")
+ error("$LOG_PREFIX:Index - reindex $NOTEBOOKS_INDEX_NAME failed with bulkFailures")
} else if (reindexResponse.total != reindexResponse.created + reindexResponse.updated) {
throw IllegalStateException(
"$LOG_PREFIX:Index - reindex number of docs created:${reindexResponse.created} + " +
@@ -168,8 +170,10 @@ internal object ObservabilityIndex {
"$LOG_PREFIX:Index - reindex ${reindexResponse.created} docs created " +
"and ${reindexResponse.updated} docs updated in $INDEX_NAME"
)
+ } catch (exception: ResourceNotFoundException) {
+ log.warn("message: ${exception.message}")
} catch (exception: Exception) {
- if (exception !is ResourceNotFoundException && exception.cause !is ResourceNotFoundException) {
+ if (exception.cause !is ResourceNotFoundException) {
throw exception
}
}
diff --git a/opensearch-observability/src/main/kotlin/org/opensearch/observability/index/ObservabilityQueryHelper.kt b/opensearch-observability/src/main/kotlin/org/opensearch/observability/index/ObservabilityQueryHelper.kt
index 73ae47bd8..db7b16a13 100644
--- a/opensearch-observability/src/main/kotlin/org/opensearch/observability/index/ObservabilityQueryHelper.kt
+++ b/opensearch-observability/src/main/kotlin/org/opensearch/observability/index/ObservabilityQueryHelper.kt
@@ -113,10 +113,6 @@ internal class ObservabilityQueryHelper(private val types: EnumSet(headers.size)
diff --git a/opensearch-observability/src/test/kotlin/org/opensearch/observability/TestHelpers.kt b/opensearch-observability/src/test/kotlin/org/opensearch/observability/TestHelpers.kt
index bfebe5c0f..5c65483d0 100644
--- a/opensearch-observability/src/test/kotlin/org/opensearch/observability/TestHelpers.kt
+++ b/opensearch-observability/src/test/kotlin/org/opensearch/observability/TestHelpers.kt
@@ -73,7 +73,7 @@ fun constructNotebookRequest(name: String = "test notebook"): String {
}
""".trimIndent()
}
-
+@Suppress("MaxLineLength")
fun constructSavedQueryRequest(name: String = "test saved query"): String {
return """
{
@@ -101,7 +101,7 @@ fun constructSavedQueryRequest(name: String = "test saved query"): String {
}
""".trimIndent()
}
-
+@Suppress("MaxLineLength")
fun constructSavedVisualizationRequest(name: String = "test saved visualization"): String {
return """
{
diff --git a/opensearch-observability/src/test/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequestTests.kt b/opensearch-observability/src/test/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequestTests.kt
index 2a7edb23b..a3f84d0e3 100644
--- a/opensearch-observability/src/test/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequestTests.kt
+++ b/opensearch-observability/src/test/kotlin/org/opensearch/observability/action/CreateObservabilityObjectRequestTests.kt
@@ -43,7 +43,8 @@ internal class CreateObservabilityObjectRequestTests {
@Test
fun `Create object should deserialize json object using parser`() {
val jsonString =
- "{\"timestamp\":{\"name\":\"test-timestamp\",\"index\":\"opensearch_dashboards_sample_data_logs\",\"type\":\"timestamp\",\"dsl_type\":\"date\"}}"
+ "{\"timestamp\":{\"name\":\"test-timestamp\",\"index\":\"opensearch_dashboards_sample_data_logs\"," +
+ "\"type\":\"timestamp\",\"dsl_type\":\"date\"}}"
val recreatedObject = createObjectFromJsonString(jsonString) { CreateObservabilityObjectRequest.parse(it) }
assertEquals(sampleTimestamp, recreatedObject.objectData)
}
@@ -59,7 +60,8 @@ internal class CreateObservabilityObjectRequestTests {
@Test
fun `Create object should safely ignore extra field in json object`() {
val jsonString =
- "{\"timestamp\":{\"name\":\"test-timestamp\",\"index\":\"opensearch_dashboards_sample_data_logs\",\"type\":\"timestamp\",\"dsl_type\":\"date\",\"another\":\"field\"}}"
+ "{\"timestamp\":{\"name\":\"test-timestamp\",\"index\":\"opensearch_dashboards_sample_data_logs\"," +
+ "\"type\":\"timestamp\",\"dsl_type\":\"date\",\"another\":\"field\"}}"
val recreatedObject = createObjectFromJsonString(jsonString) { CreateObservabilityObjectRequest.parse(it) }
assertEquals(sampleTimestamp, recreatedObject.objectData)
}
diff --git a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/NotebookTests.kt b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/NotebookTests.kt
index 13a41d71d..f077ce211 100644
--- a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/NotebookTests.kt
+++ b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/NotebookTests.kt
@@ -46,7 +46,11 @@ internal class NotebookTests {
@Test
fun `Notebook should deserialize json object using parser`() {
val jsonString =
- "{\"name\":\"test-notebook\",\"dateCreated\":\"2021-12-01T18:33:40.017Z\",\"dateModified\":\"2021-12-01T18:33:40.017Z\",\"backend\":\"Default\",\"paragraphs\":[{\"output\":[{\"result\":\"sample paragraph\",\"outputType\":\"MARKDOWN\",\"execution_time\":\"0 ms\"}],\"input\":{\"inputText\":\"%md sample paragraph\",\"inputType\":\"MARKDOWN\"},\"dateCreated\":\"2021-12-01T18:33:40.017Z\",\"dateModified\":\"2021-12-01T18:33:40.017Z\",\"id\":\"paragraph_bcd3c65c-91db-489d-b667-496fd378714e\"}]}"
+ "{\"name\":\"test-notebook\",\"dateCreated\":\"2021-12-01T18:33:40.017Z\",\"dateModified\":\"2021-12-01T18:33:40.017Z\"," +
+ "\"backend\":\"Default\",\"paragraphs\":[{\"output\":[{\"result\":\"sample paragraph\",\"outputType\":\"MARKDOWN\"," +
+ "\"execution_time\":\"0 ms\"}],\"input\":{\"inputText\":\"%md sample paragraph\",\"inputType\":\"MARKDOWN\"}," +
+ "\"dateCreated\":\"2021-12-01T18:33:40.017Z\",\"dateModified\":\"2021-12-01T18:33:40.017Z\"," +
+ "\"id\":\"paragraph_bcd3c65c-91db-489d-b667-496fd378714e\"}]}"
val recreatedObject = createObjectFromJsonString(jsonString) { Notebook.parse(it) }
assertEquals(sampleNotebook, recreatedObject)
}
@@ -62,7 +66,11 @@ internal class NotebookTests {
@Test
fun `Notebook should safely ignore extra field in json object`() {
val jsonString =
- "{\"name\":\"test-notebook\",\"dateCreated\":\"2021-12-01T18:33:40.017Z\",\"dateModified\":\"2021-12-01T18:33:40.017Z\",\"backend\":\"Default\",\"paragraphs\":[{\"output\":[{\"result\":\"sample paragraph\",\"outputType\":\"MARKDOWN\",\"execution_time\":\"0 ms\"}],\"input\":{\"inputText\":\"%md sample paragraph\",\"inputType\":\"MARKDOWN\"},\"dateCreated\":\"2021-12-01T18:33:40.017Z\",\"dateModified\":\"2021-12-01T18:33:40.017Z\",\"id\":\"paragraph_bcd3c65c-91db-489d-b667-496fd378714e\"}],\"another\":\"field\"}"
+ "{\"name\":\"test-notebook\",\"dateCreated\":\"2021-12-01T18:33:40.017Z\",\"dateModified\":\"2021-12-01T18:33:40.017Z\"," +
+ "\"backend\":\"Default\",\"paragraphs\":[{\"output\":[{\"result\":\"sample paragraph\",\"outputType\":\"MARKDOWN\"," +
+ "\"execution_time\":\"0 ms\"}],\"input\":{\"inputText\":\"%md sample paragraph\",\"inputType\":\"MARKDOWN\"}," +
+ "\"dateCreated\":\"2021-12-01T18:33:40.017Z\",\"dateModified\":\"2021-12-01T18:33:40.017Z\"," +
+ "\"id\":\"paragraph_bcd3c65c-91db-489d-b667-496fd378714e\"}],\"another\":\"field\"}"
val recreatedObject = createObjectFromJsonString(jsonString) { Notebook.parse(it) }
assertEquals(sampleNotebook, recreatedObject)
}
diff --git a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/ObservabilityObjectDocTests.kt b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/ObservabilityObjectDocTests.kt
index 390c5a223..3812737c2 100644
--- a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/ObservabilityObjectDocTests.kt
+++ b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/ObservabilityObjectDocTests.kt
@@ -33,7 +33,9 @@ internal class ObservabilityObjectDocTests {
@Test
fun `ObservabilityObjectDoc should deserialize json object using parser`() {
val jsonString =
- "{\"objectId\":\"test-id\",\"lastUpdatedTimeMs\":1638482208790,\"createdTimeMs\":1638482208790,\"tenant\":\"test-tenant\",\"access\":[\"test-access\"],\"timestamp\":{\"name\":\"test object\",\"index\":\"opensearch_dashboards_sample_data_logs\",\"type\":\"timestamp\",\"dsl_type\":\"date\"}}"
+ "{\"objectId\":\"test-id\",\"lastUpdatedTimeMs\":1638482208790,\"createdTimeMs\":1638482208790,\"tenant\":" +
+ "\"test-tenant\",\"access\":[\"test-access\"],\"timestamp\":{\"name\":\"test object\"," +
+ "\"index\":\"opensearch_dashboards_sample_data_logs\",\"type\":\"timestamp\",\"dsl_type\":\"date\"}}"
val recreatedObject = createObjectFromJsonString(jsonString) { ObservabilityObjectDoc.parse(it) }
assertEquals(sampleObservabilityObjectDoc, recreatedObject)
}
@@ -49,7 +51,9 @@ internal class ObservabilityObjectDocTests {
@Test
fun `ObservabilityObjectDoc should safely ignore extra field in json object`() {
val jsonString =
- "{\"objectId\":\"test-id\",\"lastUpdatedTimeMs\":1638482208790,\"createdTimeMs\":1638482208790,\"tenant\":\"test-tenant\",\"access\":[\"test-access\"],\"timestamp\":{\"name\":\"test object\",\"index\":\"opensearch_dashboards_sample_data_logs\",\"type\":\"timestamp\",\"dsl_type\":\"date\"},\"another\":\"field\"}"
+ "{\"objectId\":\"test-id\",\"lastUpdatedTimeMs\":1638482208790,\"createdTimeMs\":1638482208790,\"tenant\":" +
+ "\"test-tenant\",\"access\":[\"test-access\"],\"timestamp\":{\"name\":\"test object\",\"index\":" +
+ "\"opensearch_dashboards_sample_data_logs\",\"type\":\"timestamp\",\"dsl_type\":\"date\"},\"another\":\"field\"}"
val recreatedObject = createObjectFromJsonString(jsonString) { ObservabilityObjectDoc.parse(it) }
assertEquals(sampleObservabilityObjectDoc, recreatedObject)
}
diff --git a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/OperationalPanelTests.kt b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/OperationalPanelTests.kt
index 6d615af17..227d2c415 100644
--- a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/OperationalPanelTests.kt
+++ b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/OperationalPanelTests.kt
@@ -46,7 +46,9 @@ internal class OperationalPanelTests {
@Test
fun `OperationalPanel should deserialize json object using parser`() {
val jsonString =
- "{\"name\":\"test-operational-panel\",\"visualizations\":[{\"id\":\"panelViz_7ba28e34-6fd8-489d-9b9f-1f83e006fb17\",\"savedVisualizationId\":\"oyuecXwBYVazWqOOde0o\",\"x\":0,\"y\":0,\"w\":10,\"h\":10}],\"timeRange\":{\"to\":\"now\",\"from\":\"now-1d\"},\"queryFilter\":{\"query\":\"| where Carrier='OpenSearch-Air'\",\"language\":\"ppl\"}}"
+ "{\"name\":\"test-operational-panel\",\"visualizations\":[{\"id\":\"panelViz_7ba28e34-6fd8-489d-9b9f-1f83e006fb17\"," +
+ "\"savedVisualizationId\":\"oyuecXwBYVazWqOOde0o\",\"x\":0,\"y\":0,\"w\":10,\"h\":10}],\"timeRange\":{\"to\":" +
+ "\"now\",\"from\":\"now-1d\"},\"queryFilter\":{\"query\":\"| where Carrier='OpenSearch-Air'\",\"language\":\"ppl\"}}"
val recreatedObject = createObjectFromJsonString(jsonString) { OperationalPanel.parse(it) }
assertEquals(sampleOperationalPanel, recreatedObject)
}
@@ -62,7 +64,9 @@ internal class OperationalPanelTests {
@Test
fun `OperationalPanel should safely ignore extra field in json object`() {
val jsonString =
- "{\"name\":\"test-operational-panel\",\"visualizations\":[{\"id\":\"panelViz_7ba28e34-6fd8-489d-9b9f-1f83e006fb17\",\"savedVisualizationId\":\"oyuecXwBYVazWqOOde0o\",\"x\":0,\"y\":0,\"w\":10,\"h\":10}],\"timeRange\":{\"to\":\"now\",\"from\":\"now-1d\"},\"queryFilter\":{\"query\":\"| where Carrier='OpenSearch-Air'\",\"language\":\"ppl\"},\"another\":\"field\"}"
+ "{\"name\":\"test-operational-panel\",\"visualizations\":[{\"id\":\"panelViz_7ba28e34-6fd8-489d-9b9f-1f83e006fb17\",\"" +
+ "savedVisualizationId\":\"oyuecXwBYVazWqOOde0o\",\"x\":0,\"y\":0,\"w\":10,\"h\":10}],\"timeRange\":{\"to\":\"now\"," +
+ "\"from\":\"now-1d\"},\"queryFilter\":{\"query\":\"| where Carrier='OpenSearch-Air'\",\"language\":\"ppl\"},\"another\":\"field\"}"
val recreatedObject = createObjectFromJsonString(jsonString) { OperationalPanel.parse(it) }
assertEquals(sampleOperationalPanel, recreatedObject)
}
diff --git a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/SavedQueryTests.kt b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/SavedQueryTests.kt
index a5999abbf..509d7927e 100644
--- a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/SavedQueryTests.kt
+++ b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/SavedQueryTests.kt
@@ -46,7 +46,12 @@ internal class SavedQueryTests {
@Test
fun `SavedQuery should deserialize json object using parser`() {
val jsonString =
- "{\"name\":\"test-saved-query\",\"description\":\"test description\",\"query\":\"source=index | where utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\",\"selected_date_range\":{\"start\":\"now/15m\",\"end\":\"now\",\"text\":\"utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"},\"selected_timestamp\":{\"name\":\"utc_time\",\"type\":\"timestamp\"},\"selected_fields\":{\"text\":\"| fields clientip, bytes, memory, host\",\"tokens\":[{\"name\":\"utc_time\",\"type\":\"timestamp\"}]}}"
+ "{\"name\":\"test-saved-query\",\"description\":\"test description\",\"query\":\"source=index | " +
+ "where utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"," +
+ "\"selected_date_range\":{\"start\":\"now/15m\",\"end\":\"now\",\"text\":\"utc_time > " +
+ "timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"}," +
+ "\"selected_timestamp\":{\"name\":\"utc_time\",\"type\":\"timestamp\"},\"selected_fields\":{\"text\":" +
+ "\"| fields clientip, bytes, memory, host\",\"tokens\":[{\"name\":\"utc_time\",\"type\":\"timestamp\"}]}}"
val recreatedObject = createObjectFromJsonString(jsonString) { SavedQuery.parse(it) }
assertEquals(sampleSavedQuery, recreatedObject)
}
@@ -62,7 +67,12 @@ internal class SavedQueryTests {
@Test
fun `SavedQuery should safely ignore extra field in json object`() {
val jsonString =
- "{\"name\":\"test-saved-query\",\"description\":\"test description\",\"query\":\"source=index | where utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\",\"selected_date_range\":{\"start\":\"now/15m\",\"end\":\"now\",\"text\":\"utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"},\"selected_timestamp\":{\"name\":\"utc_time\",\"type\":\"timestamp\"},\"selected_fields\":{\"text\":\"| fields clientip, bytes, memory, host\",\"tokens\":[{\"name\":\"utc_time\",\"type\":\"timestamp\"}]},\"another\":\"field\"}"
+ "{\"name\":\"test-saved-query\",\"description\":\"test description\",\"query\":\"source=index | where" +
+ " utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"," +
+ "\"selected_date_range\":{\"start\":\"now/15m\",\"end\":\"now\",\"text\":\"utc_time > timestamp" +
+ "('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"},\"selected_timestamp\"" +
+ ":{\"name\":\"utc_time\",\"type\":\"timestamp\"},\"selected_fields\":{\"text\":\"| fields clientip, " +
+ "bytes, memory, host\",\"tokens\":[{\"name\":\"utc_time\",\"type\":\"timestamp\"}]},\"another\":\"field\"}"
val recreatedObject = createObjectFromJsonString(jsonString) { SavedQuery.parse(it) }
assertEquals(sampleSavedQuery, recreatedObject)
}
diff --git a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/SavedVisualizationTests.kt b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/SavedVisualizationTests.kt
index 8129aad70..577239a77 100644
--- a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/SavedVisualizationTests.kt
+++ b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/SavedVisualizationTests.kt
@@ -49,7 +49,15 @@ internal class SavedVisualizationTests {
@Test
fun `SavedVisualization should deserialize json object using parser`() {
val jsonString =
- "{\"name\":\"test-saved-visualization\",\"description\":\"test description\",\"query\":\"source=index | where utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\",\"type\":\"bar\",\"selected_date_range\":{\"start\":\"now/15m\",\"end\":\"now\",\"text\":\"utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"},\"selected_timestamp\":{\"name\":\"utc_time\",\"type\":\"timestamp\"},\"selected_fields\":{\"text\":\"| fields clientip, bytes, memory, host\",\"tokens\":[{\"name\":\"utc_time\",\"type\":\"timestamp\"}]},\"application_id\":\"KE1Ie34BbsTr-CsB4G6Y\",\"user_configs\":\"{\\\"dataConfig\\\":\\\"{}\\\",\\\"layoutConfig\\\":\\\"{}\\\"}\"}"
+ "{\"name\":\"test-saved-visualization\",\"description\":\"test description\",\"query\":\"source=index | " +
+ "where utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"," +
+ "\"type\":\"bar\",\"selected_date_range\":{\"start\":\"now/15m\",\"end\":\"now\",\"text\":\"utc_time >" +
+ " timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"}," +
+ "\"selected_timestamp\":{\"name\":\"utc_time\",\"type\":\"timestamp\"},\"selected_fields\":{\"text\":\"" +
+ "| fields clientip, bytes, memory, host\",\"tokens\":[{\"name\":\"utc_time\",\"type\":\"timestamp\"}]}," +
+ "\"application_id\":\"KE1Ie34BbsTr-CsB4G6Y\",\"user_configs\":\"{\\\"dataConfig\\\":\\\"{}\\\"," +
+ "\\\"layoutConfig\\\":\\\"{}\\\"}\",\"sub_type\":\"metric\",\"units_of_measure\":\"hours (h)\"}"
+
val recreatedObject = createObjectFromJsonString(jsonString) { SavedVisualization.parse(it) }
assertEquals(sampleSavedVisualization, recreatedObject)
}
@@ -65,7 +73,15 @@ internal class SavedVisualizationTests {
@Test
fun `SavedVisualization should safely ignore extra field in json object`() {
val jsonString =
- "{\"name\":\"test-saved-visualization\",\"description\":\"test description\",\"query\":\"source=index | where utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\",\"type\":\"bar\",\"selected_date_range\":{\"start\":\"now/15m\",\"end\":\"now\",\"text\":\"utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"},\"selected_timestamp\":{\"name\":\"utc_time\",\"type\":\"timestamp\"},\"selected_fields\":{\"text\":\"| fields clientip, bytes, memory, host\",\"tokens\":[{\"name\":\"utc_time\",\"type\":\"timestamp\"}]},\"application_id\":\"KE1Ie34BbsTr-CsB4G6Y\",\"user_configs\":\"{\\\"dataConfig\\\":\\\"{}\\\",\\\"layoutConfig\\\":\\\"{}\\\"}\"}"
+ "{\"name\":\"test-saved-visualization\",\"description\":\"test description\",\"query\":\"source=index | " +
+ "where utc_time > timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"," +
+ "\"type\":\"bar\",\"selected_date_range\":{\"start\":\"now/15m\",\"end\":\"now\",\"text\":\"utc_time > " +
+ "timestamp('2021-07-01 00:00:00') and utc_time < timestamp('2021-07-02 00:00:00')\"}," +
+ "\"selected_timestamp\":{\"name\":\"utc_time\",\"type\":\"timestamp\"},\"selected_fields\":{\"text\":\"|" +
+ " fields clientip, bytes, memory, host\",\"tokens\":[{\"name\":\"utc_time\",\"type\":\"timestamp\"}]}," +
+ "\"application_id\":\"KE1Ie34BbsTr-CsB4G6Y\",\"user_configs\":\"{\\\"dataConfig\\\":\\\"{}\\\"," +
+ "\\\"layoutConfig\\\":\\\"{}\\\"}\",\"sub_type\":\"metric\",\"units_of_measure\":\"hours (h)\"}"
+
val recreatedObject = createObjectFromJsonString(jsonString) { SavedVisualization.parse(it) }
assertEquals(sampleSavedVisualization, recreatedObject)
}
diff --git a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/TimestampTests.kt b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/TimestampTests.kt
index adef69b1c..1d303921d 100644
--- a/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/TimestampTests.kt
+++ b/opensearch-observability/src/test/kotlin/org/opensearch/observability/model/TimestampTests.kt
@@ -53,7 +53,8 @@ internal class TimestampTests {
@Test
fun `Timestamp should safely ignore extra field in json object`() {
val jsonString =
- "{\"name\":\"test-timestamp\",\"index\":\"opensearch_dashboards_sample_data_logs\",\"type\":\"timestamp\",\"dsl_type\":\"date\",\"another\":\"field\"}"
+ "{\"name\":\"test-timestamp\",\"index\":\"opensearch_dashboards_sample_data_logs\"," +
+ "\"type\":\"timestamp\",\"dsl_type\":\"date\",\"another\":\"field\"}"
val recreatedObject = createObjectFromJsonString(jsonString) { Timestamp.parse(it) }
assertEquals(sampleTimestamp, recreatedObject)
}
diff --git a/release-notes/opensearch-observability.release-notes-1.3.6.0.md b/release-notes/opensearch-observability.release-notes-1.3.6.0.md
new file mode 100644
index 000000000..59ef46af6
--- /dev/null
+++ b/release-notes/opensearch-observability.release-notes-1.3.6.0.md
@@ -0,0 +1,9 @@
+## Version 1.3.6.0 Release Notes
+Compatible with OpenSearch and OpenSearch Dashboards Version 1.3.6
+
+### Bug Fix
+* Updated Kotlin to 1.6.0 ([#1052](https://github.com/opensearch-project/observability/pull/1052))
+* Update Jackson to 2.13.4 ([#1066](https://github.com/opensearch-project/observability/pull/1066))
+
+### Maintenance
+* Bump version to 1.3.6 ([#1059](https://github.com/opensearch-project/observability/pull/1059))
\ No newline at end of file