Skip to content

Commit

Permalink
fix ktlint errors in cluster metrics helper classes
Browse files Browse the repository at this point in the history
Signed-off-by: Surya Sashank Nistala <[email protected]>
  • Loading branch information
eirsep committed Jul 12, 2023
1 parent 2f79d67 commit ef660d7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ class CatIndicesRequestWrapper(val pathParams: String = "") : ActionRequest() {
if (pathParams.isNotBlank()) {
indicesList = pathParams.split(",").toTypedArray()

require(validate() == null) { "The path parameters do not form a valid, comma-separated list of data streams, indices, or index aliases." }
require(validate() == null) {
"The path parameters do not form a valid, comma-separated list of data streams, indices, or index aliases."
}

clusterHealthRequest = clusterHealthRequest.indices(*indicesList)
clusterStateRequest = clusterStateRequest.indices(*indicesList)
Expand All @@ -77,7 +79,7 @@ class CatIndicesResponseWrapper(
clusterHealthResponse: ClusterHealthResponse,
clusterStateResponse: ClusterStateResponse,
indexSettingsResponse: GetSettingsResponse,
indicesStatsResponse: IndicesStatsResponse
indicesStatsResponse: IndicesStatsResponse,
) : ActionResponse(), ToXContentObject {
var indexInfoList: List<IndexInfo> = listOf()

Expand Down Expand Up @@ -110,7 +112,7 @@ class CatIndicesResponseWrapper(
clusterHealthResponse: ClusterHealthResponse,
clusterStateResponse: ClusterStateResponse,
indexSettingsResponse: GetSettingsResponse,
indicesStatsResponse: IndicesStatsResponse
indicesStatsResponse: IndicesStatsResponse,
): List<IndexInfo> {
val list = mutableListOf<IndexInfo>()

Expand Down Expand Up @@ -430,7 +432,7 @@ class CatIndicesResponseWrapper(
val priSuggestTotal: String?,
val memoryTotal: String?,
val priMemoryTotal: String?,
val searchThrottled: String?
val searchThrottled: String?,
) : ToXContentObject, Writeable {
companion object {
const val HEALTH_FIELD = "health"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ class CatShardsRequestWrapper(val pathParams: String = "") : ActionRequest() {
if (pathParams.isNotBlank()) {
indicesList = pathParams.split(",").toTypedArray()

require(validate() == null) { "The path parameters do not form a valid, comma-separated list of data streams, indices, or index aliases." }
require(validate() == null) {
"The path parameters do not form a valid, comma-separated list of data streams, indices, or index aliases."
}

clusterStateRequest = clusterStateRequest.indices(*indicesList)
indicesStatsRequest = indicesStatsRequest.indices(*indicesList)
Expand All @@ -72,7 +74,7 @@ class CatShardsRequestWrapper(val pathParams: String = "") : ActionRequest() {

class CatShardsResponseWrapper(
stateResp: ClusterStateResponse,
indicesResp: IndicesStatsResponse
indicesResp: IndicesStatsResponse,
) : ActionResponse(), ToXContentObject {
var shardInfoList: List<ShardInfo> = listOf()

Expand Down Expand Up @@ -108,7 +110,7 @@ class CatShardsResponseWrapper(

private fun compileShardInfo(
stateResp: ClusterStateResponse,
indicesResp: IndicesStatsResponse
indicesResp: IndicesStatsResponse,
): List<ShardInfo> {
val list = mutableListOf<ShardInfo>()

Expand Down Expand Up @@ -173,7 +175,11 @@ class CatShardsResponseWrapper(
searchScrollTotal = getOrNull(commonStats, CommonStats::getSearch, { it.total.scrollCount })?.toString(),
segmentsCount = getOrNull(commonStats, CommonStats::getSegments, SegmentsStats::getCount)?.toString(),
segmentsMemory = getOrNull(commonStats, CommonStats::getSegments, SegmentsStats::getZeroMemory)?.toString(),
segmentsIndexWriterMemory = getOrNull(commonStats, CommonStats::getSegments, SegmentsStats::getIndexWriterMemory)?.toString(),
segmentsIndexWriterMemory = getOrNull(
commonStats,
CommonStats::getSegments,
SegmentsStats::getIndexWriterMemory
)?.toString(),
segmentsVersionMapMemory = getOrNull(commonStats, CommonStats::getSegments, SegmentsStats::getVersionMapMemory)?.toString(),
fixedBitsetMemory = getOrNull(commonStats, CommonStats::getSegments, SegmentsStats::getBitsetMemory)?.toString(),
globalCheckpoint = getOrNull(shardStats, ShardStats::getSeqNoStats, SeqNoStats::getGlobalCheckpoint)?.toString(),
Expand Down Expand Up @@ -211,7 +217,9 @@ class CatShardsResponseWrapper(
shardInfo = shardInfo.copy(
unassignedReason = shard.unassignedInfo().reason.name,
unassignedAt = UnassignedInfo.DATE_TIME_FORMATTER.format(unassignedTime),
unassignedFor = TimeValue.timeValueMillis(System.currentTimeMillis() - shard.unassignedInfo().unassignedTimeInMillis).stringRep,
unassignedFor = TimeValue.timeValueMillis(
System.currentTimeMillis() - shard.unassignedInfo().unassignedTimeInMillis
).stringRep,
unassignedDetails = shard.unassignedInfo().details
)
}
Expand Down Expand Up @@ -289,7 +297,7 @@ class CatShardsResponseWrapper(
val unassignedAt: String?,
val unassignedDetails: String?,
val unassignedFor: String?,
val unassignedReason: String?
val unassignedReason: String?,
) : ToXContentObject, Writeable {
companion object {
const val INDEX_FIELD = "index"
Expand Down

0 comments on commit ef660d7

Please sign in to comment.