Skip to content

Commit 41f6905

Browse files
Revert "now publishes a list of findings instead of an individual one (#1860)" (#1881)
This reverts commit 381a82e. Signed-off-by: Dennis Toepker <[email protected]> Co-authored-by: Dennis Toepker <[email protected]>
1 parent 15abcfa commit 41f6905

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDocLevelMonitorFanOutAction.kt

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ import org.opensearch.commons.alerting.AlertingPluginInterface
7474
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutAction
7575
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutRequest
7676
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutResponse
77-
import org.opensearch.commons.alerting.action.PublishBatchFindingsRequest
7877
import org.opensearch.commons.alerting.action.PublishFindingsRequest
7978
import org.opensearch.commons.alerting.action.SubscribeFindingsResponse
8079
import 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

Comments
 (0)