Skip to content

Commit

Permalink
Build issues fixed
Browse files Browse the repository at this point in the history
Signed-off-by: harycash <[email protected]>
  • Loading branch information
harycash committed Jul 4, 2024
1 parent 20073c4 commit 4d6176f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ abstract class Step(val name: String, val isSafeToDisableOn: Boolean = true) {
): Step {
logger.info("Finished executing $name for ${context?.metadata?.index}")
val updatedStepMetaData = step.getUpdatedManagedIndexMetadata(startingManagedIndexMetaData)
emitTelemetry(indexManagementActionMetrics, updatedStepMetaData, logger)
this.context = null
return this
}

private fun emitTelemetry(
indexManagementActionMetrics: IndexManagementActionsMetrics,
updatedStepMetaData: ManagedIndexMetaData,
logger: Logger,
) {
when (context?.metadata?.actionMetaData?.name) {
IndexManagementActionsMetrics.ROLLOVER -> indexManagementActionMetrics.getActionMetrics(
IndexManagementActionsMetrics.ROLLOVER,
Expand All @@ -61,6 +71,7 @@ abstract class Step(val name: String, val isSafeToDisableOn: Boolean = true) {
IndexManagementActionsMetrics.TRANSITION,
)
?.emitMetrics(context!!, indexManagementActionMetrics, updatedStepMetaData.stepMetaData)

IndexManagementActionsMetrics.NOTIFICATION -> indexManagementActionMetrics.getActionMetrics(
IndexManagementActionsMetrics.NOTIFICATION,
)
Expand Down Expand Up @@ -110,15 +121,14 @@ abstract class Step(val name: String, val isSafeToDisableOn: Boolean = true) {
IndexManagementActionsMetrics.ALLOCATION,
)
?.emitMetrics(context!!, indexManagementActionMetrics, updatedStepMetaData.stepMetaData)

else -> {
logger.info(
"Action Metrics is not supported for this action [%s]",
context?.metadata?.actionMetaData?.name,
)
}
}
this.context = null
return this
}

abstract fun getUpdatedManagedIndexMetadata(currentMetadata: ManagedIndexMetaData): ManagedIndexMetaData
Expand All @@ -137,8 +147,7 @@ abstract class Step(val name: String, val isSafeToDisableOn: Boolean = true) {
}
}

final fun getStartingStepMetaData(metadata: ManagedIndexMetaData): StepMetaData =
StepMetaData(name, getStepStartTime(metadata).toEpochMilli(), StepStatus.STARTING)
final fun getStartingStepMetaData(metadata: ManagedIndexMetaData): StepMetaData = StepMetaData(name, getStepStartTime(metadata).toEpochMilli(), StepStatus.STARTING)

enum class StepStatus(val status: String) : Writeable {
STARTING("starting"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class ActionMetrics {
.addTag("index_name", context.metadata.index)
.addTag("policy_id", context.metadata.policyID)
.addTag("node_id", context.clusterService.nodeName ?: "")
.addTag("Index_uuid", context.metadata.indexUuid)
.addTag("index_uuid", context.metadata.indexUuid)
return tags
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,11 @@ class AttemptRolloverStep(private val action: RolloverAction) : Step(name) {
// ISM cannot auto recover from this case, so the status is COMPLETED
logger.error("$indexName rolled over but cannot find the rolledOverIndexName to copy aliases to")
stepStatus = StepStatus.COMPLETED
info = listOfNotNull(

"message" to getCopyAliasRolledOverIndexNotFoundMessage(indexName),
if (conditions != null) "conditions" to conditions else null,

).toMap()
info =
listOfNotNull(
"message" to getCopyAliasRolledOverIndexNotFoundMessage(indexName),
if (conditions != null) "conditions" to conditions else null,
).toMap()
return
}

Expand Down

0 comments on commit 4d6176f

Please sign in to comment.