Skip to content

Commit

Permalink
fix post delete method and refactor alert mover to add class level lo…
Browse files Browse the repository at this point in the history
…gger

Signed-off-by: Surya Sashank Nistala <[email protected]>
  • Loading branch information
eirsep committed Jul 11, 2023
1 parent b2af473 commit 54b9469
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.opensearch.action.ActionListener
import org.opensearch.action.bulk.BackoffPolicy
import org.opensearch.action.support.master.AcknowledgedResponse
import org.opensearch.alerting.alerts.AlertIndices
import org.opensearch.alerting.alerts.moveAlerts
import org.opensearch.alerting.alerts.AlertMover.Companion.moveAlerts
import org.opensearch.alerting.core.JobRunner
import org.opensearch.alerting.core.ScheduledJobIndices
import org.opensearch.alerting.model.MonitorRunResult
Expand Down Expand Up @@ -232,6 +232,15 @@ object MonitorRunnerService : JobRunner, CoroutineScope, AbstractLifecycleCompon
monitorCtx.moveAlertsRetryPolicy!!.retry(logger) {
moveAlerts(monitorCtx.client!!, jobId, null, monitorCtx)
}
} catch (e: Exception) {
logger.error("Failed to move active alerts for workflow [$jobId]. Could be a monitor", e)
}
try {
monitorCtx.moveAlertsRetryPolicy!!.retry(logger) {
if (monitorCtx.alertIndices!!.isAlertInitialized()) {
moveAlerts(monitorCtx.client!!, jobId, null)
}
}
} catch (e: Exception) {
logger.error("Failed to move active alerts for monitor [$jobId].", e)
}
Expand Down
Loading

0 comments on commit 54b9469

Please sign in to comment.