Skip to content

Commit bb04134

Browse files
authored
bumping ktlint and resolving conflicts (#1792) (#1793)
Signed-off-by: Sean Li <[email protected]> (cherry picked from commit 34f6490)
1 parent f28ebc0 commit bb04134

File tree

9 files changed

+45
-27
lines changed

9 files changed

+45
-27
lines changed

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ configurations.all {
154154
force "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${jackson_version}"
155155
force "org.mockito:mockito-core:4.6.1"
156156
force "org.yaml:snakeyaml:2.0"
157+
force "org.slf4j:slf4j-api:2.0.0"
157158
}
158159
}
159160

@@ -212,7 +213,7 @@ dependencies {
212213
testImplementation "org.mockito:mockito-junit-jupiter:4.3.1"
213214
testImplementation "com.google.code.gson:gson:2.8.9"
214215

215-
ktlint "com.pinterest:ktlint:0.45.0"
216+
ktlint "com.pinterest:ktlint:0.47.1"
216217
}
217218

218219
javadoc.enabled = false // turn off javadoc as it barfs on Kotlin code

src/main/kotlin/org/opensearch/observability/ObservabilityPlugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class ObservabilityPlugin : Plugin(), ActionPlugin, ClusterPlugin {
9898
): List<RestHandler> {
9999
return listOf(
100100
ObservabilityRestHandler(),
101-
ObservabilityStatsRestHandler(),
101+
ObservabilityStatsRestHandler()
102102
)
103103
}
104104

src/main/kotlin/org/opensearch/observability/metrics/Metrics.kt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,24 @@ enum class Metrics(val metricName: String, val counter: Counter<*>) {
3030
OBSERVABILITY_EXCEPTIONS_VERSION_CONFLICT_ENGINE_EXCEPTION("exception.version_conflict_engine", RollingCounter()),
3131
OBSERVABILITY_EXCEPTIONS_INDEX_NOT_FOUND_EXCEPTION("exception.index_not_found", RollingCounter()),
3232
OBSERVABILITY_EXCEPTIONS_INVALID_INDEX_NAME_EXCEPTION(
33-
"exception.invalid_index_name", RollingCounter()
33+
"exception.invalid_index_name",
34+
RollingCounter()
3435
),
3536
OBSERVABILITY_EXCEPTIONS_ILLEGAL_ARGUMENT_EXCEPTION(
36-
"exception.illegal_argument", RollingCounter()
37+
"exception.illegal_argument",
38+
RollingCounter()
3739
),
3840
OBSERVABILITY_EXCEPTIONS_ILLEGAL_STATE_EXCEPTION(
39-
"exception.illegal_state", RollingCounter()
41+
"exception.illegal_state",
42+
RollingCounter()
4043
),
4144
OBSERVABILITY_EXCEPTIONS_IO_EXCEPTION(
42-
"exception.io", RollingCounter()
45+
"exception.io",
46+
RollingCounter()
4347
),
4448
OBSERVABILITY_EXCEPTIONS_INTERNAL_SERVER_ERROR(
45-
"exception.internal_server_error", RollingCounter()
49+
"exception.internal_server_error",
50+
RollingCounter()
4651
),
4752

4853
// ==== REST endpoint metrics ==== //
@@ -155,6 +160,6 @@ enum class Metrics(val metricName: String, val counter: Counter<*>) {
155160
*/
156161
enum class Action {
157162
CREATE,
158-
UPDATE,
163+
UPDATE
159164
}
160165
}

src/main/kotlin/org/opensearch/observability/model/SavedQuery.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ internal data class SavedQuery(
241241

242242
internal data class Token(
243243
val name: String,
244-
val type: String,
244+
val type: String
245245
) : BaseModel {
246246
internal companion object {
247247
private const val NAME_TAG = "name"
@@ -291,7 +291,7 @@ internal data class SavedQuery(
291291
*/
292292
constructor(input: StreamInput) : this(
293293
name = input.readString(),
294-
type = input.readString(),
294+
type = input.readString()
295295
)
296296

297297
/**

src/main/kotlin/org/opensearch/observability/model/SavedVisualization.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ internal data class SavedVisualization(
6969
val subType: String?,
7070
val metricType: String? = null,
7171
val unitsOfMeasure: String? = null,
72-
val selectedLabels: SelectedLabels? = null,
72+
val selectedLabels: SelectedLabels? = null
7373
) : BaseObjectData {
7474

7575
internal companion object {
@@ -155,7 +155,7 @@ internal data class SavedVisualization(
155155
subType,
156156
metricType,
157157
unitsOfMeasure,
158-
selectedLabels,
158+
selectedLabels
159159
)
160160
}
161161
}
@@ -186,7 +186,7 @@ internal data class SavedVisualization(
186186
subType = input.readString(),
187187
metricType = input.readOptionalString(),
188188
unitsOfMeasure = input.readOptionalString(),
189-
selectedLabels = input.readOptionalWriteable(SelectedLabels.reader),
189+
selectedLabels = input.readOptionalWriteable(SelectedLabels.reader)
190190
)
191191

192192
/**
@@ -231,7 +231,7 @@ internal data class SavedVisualization(
231231
}
232232

233233
internal data class Token(
234-
val label: String,
234+
val label: String
235235
) : BaseModel {
236236
internal companion object {
237237
private const val LABEL_TAG = "label"
@@ -276,7 +276,7 @@ internal data class SavedVisualization(
276276
* @param input StreamInput stream to deserialize data from.
277277
*/
278278
constructor(input: StreamInput) : this(
279-
label = input.readString(),
279+
label = input.readString()
280280
)
281281

282282
/**
@@ -299,7 +299,7 @@ internal data class SavedVisualization(
299299
}
300300

301301
internal data class SelectedLabels(
302-
val labels: List<Token>?,
302+
val labels: List<Token>?
303303
) : BaseModel {
304304
internal companion object {
305305
private const val LABELS_TAG = "labels"

src/main/kotlin/org/opensearch/observability/model/Timestamp.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal data class Timestamp(
3434
val name: String?,
3535
val index: String?,
3636
val type: String?,
37-
val dslType: String?,
37+
val dslType: String?
3838
) : BaseObjectData {
3939

4040
internal companion object {

src/main/kotlin/org/opensearch/observability/settings/PluginSettings.kt

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -283,61 +283,70 @@ internal object PluginSettings {
283283
OPERATION_TIMEOUT_MS_KEY,
284284
defaultSettings[OPERATION_TIMEOUT_MS_KEY]!!.toLong(),
285285
MINIMUM_OPERATION_TIMEOUT_MS,
286-
NodeScope, Dynamic
286+
NodeScope,
287+
Dynamic
287288
)
288289

289290
private val JOB_LOCK_DURATION_S: Setting<Int> = Setting.intSetting(
290291
JOB_LOCK_DURATION_S_KEY,
291292
defaultSettings[JOB_LOCK_DURATION_S_KEY]!!.toInt(),
292293
MINIMUM_JOB_LOCK_DURATION_S,
293-
NodeScope, Dynamic
294+
NodeScope,
295+
Dynamic
294296
)
295297

296298
private val MIN_POLLING_DURATION_S: Setting<Int> = Setting.intSetting(
297299
MIN_POLLING_DURATION_S_KEY,
298300
defaultSettings[MIN_POLLING_DURATION_S_KEY]!!.toInt(),
299301
MINIMUM_MIN_POLLING_DURATION_S,
300-
NodeScope, Dynamic
302+
NodeScope,
303+
Dynamic
301304
)
302305

303306
private val MAX_POLLING_DURATION_S: Setting<Int> = Setting.intSetting(
304307
MAX_POLLING_DURATION_S_KEY,
305308
defaultSettings[MAX_POLLING_DURATION_S_KEY]!!.toInt(),
306309
MINIMUM_MAX_POLLING_DURATION_S,
307-
NodeScope, Dynamic
310+
NodeScope,
311+
Dynamic
308312
)
309313

310314
private val MAX_LOCK_RETRIES: Setting<Int> = Setting.intSetting(
311315
MAX_LOCK_RETRIES_KEY,
312316
defaultSettings[MAX_LOCK_RETRIES_KEY]!!.toInt(),
313317
MINIMUM_LOCK_RETRIES,
314-
NodeScope, Dynamic
318+
NodeScope,
319+
Dynamic
315320
)
316321

317322
private val DEFAULT_ITEMS_QUERY_COUNT: Setting<Int> = Setting.intSetting(
318323
DEFAULT_ITEMS_QUERY_COUNT_KEY,
319324
defaultSettings[DEFAULT_ITEMS_QUERY_COUNT_KEY]!!.toInt(),
320325
MINIMUM_ITEMS_QUERY_COUNT,
321-
NodeScope, Dynamic
326+
NodeScope,
327+
Dynamic
322328
)
323329

324330
private val ADMIN_ACCESS: Setting<String> = Setting.simpleString(
325331
ADMIN_ACCESS_KEY,
326332
defaultSettings[ADMIN_ACCESS_KEY]!!,
327-
NodeScope, Dynamic
333+
NodeScope,
334+
Dynamic
328335
)
329336

330337
private val FILTER_BY: Setting<String> = Setting.simpleString(
331338
FILTER_BY_KEY,
332339
defaultSettings[FILTER_BY_KEY]!!,
333-
NodeScope, Dynamic
340+
NodeScope,
341+
Dynamic
334342
)
335343

336344
private val IGNORED_ROLES: Setting<List<String>> = Setting.listSetting(
337345
IGNORE_ROLE_KEY,
338346
DEFAULT_IGNORED_ROLES,
339347
{ it },
340-
NodeScope, Dynamic
348+
NodeScope,
349+
Dynamic
341350
)
342351

343352
/**

src/test/kotlin/org/opensearch/observability/PluginRestTestCase.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ abstract class PluginRestTestCase : OpenSearchRestTestCase() {
7878
val response = client().performRequest(Request("GET", "/_cat/indices?format=json&expand_wildcards=all"))
7979
val xContentType = MediaType.fromMediaType(response.entity.contentType.value)
8080
xContentType.xContent().createParser(
81-
NamedXContentRegistry.EMPTY, DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
81+
NamedXContentRegistry.EMPTY,
82+
DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
8283
response.entity.content
8384
).use { parser ->
8485
for (index in parser.list()) {

src/test/kotlin/org/opensearch/observability/TestHelpers.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ fun constructNotebookRequest(name: String = "test notebook"): String {
7373
}
7474
""".trimIndent()
7575
}
76+
7677
@Suppress("MaxLineLength")
7778
fun constructSavedQueryRequest(name: String = "test saved query"): String {
7879
return """
@@ -101,6 +102,7 @@ fun constructSavedQueryRequest(name: String = "test saved query"): String {
101102
}
102103
""".trimIndent()
103104
}
105+
104106
@Suppress("MaxLineLength")
105107
fun constructSavedVisualizationRequest(name: String = "test saved visualization"): String {
106108
return """

0 commit comments

Comments
 (0)