@@ -74,7 +74,6 @@ import org.opensearch.commons.alerting.AlertingPluginInterface
7474import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutAction
7575import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutRequest
7676import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutResponse
77- import org.opensearch.commons.alerting.action.PublishBatchFindingsRequest
7877import org.opensearch.commons.alerting.action.PublishFindingsRequest
7978import org.opensearch.commons.alerting.action.SubscribeFindingsResponse
8079import org.opensearch.commons.alerting.model.ActionExecutionResult
@@ -615,7 +614,9 @@ class TransportDocLevelMonitorFanOutAction
615614
616615 if (monitor.shouldCreateSingleAlertForFindings == null || monitor.shouldCreateSingleAlertForFindings == false ) {
617616 try {
618- publishBatchFindings(monitor, findings)
617+ findings.forEach { finding ->
618+ publishFinding(monitor, finding)
619+ }
619620 } catch (e: Exception ) {
620621 // suppress exception
621622 log.error(" Optional finding callback failed" , e)
@@ -663,27 +664,6 @@ class TransportDocLevelMonitorFanOutAction
663664 )
664665 }
665666
666- private fun publishBatchFindings (
667- monitor : Monitor ,
668- findings : List <Finding >
669- ) {
670- val publishBatchFindingsRequest = PublishBatchFindingsRequest (monitor.id, findings)
671- log.debug(" publishing {} findings from node {}" , findings.size, clusterService.localNode().id)
672- AlertingPluginInterface .publishBatchFindings(
673- client as NodeClient ,
674- publishBatchFindingsRequest,
675- object : ActionListener <SubscribeFindingsResponse > {
676- override fun onResponse (response : SubscribeFindingsResponse ) {
677- log.debug(" findings published successfully" )
678- }
679-
680- override fun onFailure (e : Exception ) {
681- log.error(" publishing findings failed" , e)
682- }
683- }
684- )
685- }
686-
687667 suspend fun runAction (
688668 action : Action ,
689669 ctx : TriggerExecutionContext ,
0 commit comments