Skip to content

Commit

Permalink
update change
Browse files Browse the repository at this point in the history
Signed-off-by: Subhobrata Dey <[email protected]>
  • Loading branch information
sbcd90 committed Jun 28, 2024
1 parent 60a16d1 commit 8a8875d
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import org.opensearch.cluster.routing.ShardRouting
import org.opensearch.cluster.service.ClusterService
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutResponse
import org.opensearch.commons.alerting.model.ActionRunResult
import org.opensearch.commons.alerting.model.DocLevelMonitorInput
import org.opensearch.commons.alerting.model.DocumentLevelTriggerRunResult
import org.opensearch.commons.alerting.model.InputRunResults
import org.opensearch.commons.alerting.model.Monitor
Expand Down Expand Up @@ -53,6 +52,7 @@ class RemoteDocumentLevelMonitorRunner : MonitorRunner() {
try {
validate(monitor)
} catch (e: Exception) {
e.printStackTrace()
logger.error("Failed to start Document-level-monitor. Error: ${e.message}")
monitorResult = monitorResult.copy(error = AlertingException.wrap(e))
}
Expand Down Expand Up @@ -182,6 +182,7 @@ class RemoteDocumentLevelMonitorRunner : MonitorRunner() {
}
return monitorResult.copy(triggerResults = triggerResults, inputResults = inputRunResults)
} catch (e: Exception) {
e.printStackTrace()
logger.error("Failed running Document-level-monitor ${monitor.name}", e)
val errorMessage = ExceptionsHelper.detailedMessage(e)
monitorCtx.alertService!!.upsertMonitorErrorAlert(monitor, errorMessage, executionId, workflowRunContext)
Expand All @@ -202,10 +203,6 @@ class RemoteDocumentLevelMonitorRunner : MonitorRunner() {
if (monitor.inputs[0].name() != RemoteDocLevelMonitorInput.REMOTE_DOC_LEVEL_MONITOR_INPUT_FIELD) {
throw IOException("Invalid input with remote document-level-monitor.")
}

if ((monitor.inputs[0] as DocLevelMonitorInput).indices.isEmpty()) {
throw IllegalArgumentException("DocLevelMonitorInput has no indices")
}
}

private fun getNodes(monitorCtx: MonitorRunnerExecutionContext): Map<String, DiscoveryNode> {
Expand Down

0 comments on commit 8a8875d

Please sign in to comment.