diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/action/DocLevelMonitorFanOutResponse.kt b/alerting/src/main/kotlin/org/opensearch/alerting/action/DocLevelMonitorFanOutResponse.kt index b3a983ab4..87e2361ea 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/action/DocLevelMonitorFanOutResponse.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/action/DocLevelMonitorFanOutResponse.kt @@ -1,41 +1,49 @@ package org.opensearch.alerting.action +import org.opensearch.alerting.model.DocumentLevelTriggerRunResult +import org.opensearch.alerting.model.InputRunResults +import org.opensearch.alerting.model.MonitorRunResult import org.opensearch.core.action.ActionResponse import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.core.common.io.stream.StreamOutput -import org.opensearch.core.index.shard.ShardId import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import java.io.IOException class DocLevelMonitorFanOutResponse : ActionResponse, ToXContentObject { - val nodeId: String val executionId: String val monitorId: String - val shardIdFailureMap: Map + val shardIdFailureMap: Map val findingIds: List + // for shards not delegated to nodes sequence number would be -3 (new number shard was not queried), - val lastRunContexts: Map + val lastRunContexts: Map // partial + val inputResults: InputRunResults // partial + val triggerResults: Map // partial @Throws(IOException::class) constructor(sin: StreamInput) : this( - sin.readString(), - sin.readString(), - sin.readString(), - sin.readMap() as Map, - sin.readStringList(), - sin.readMap()!! as Map, + nodeId = sin.readString(), + executionId = sin.readString(), + monitorId = sin.readString(), + shardIdFailureMap = sin.readMap() as Map, + findingIds = sin.readStringList(), + lastRunContexts = sin.readMap()!! as Map, + inputResults = InputRunResults.readFrom(sin), + triggerResults = MonitorRunResult.suppressWarning(sin.readMap()) as Map // triggerResults ) constructor( nodeId: String, executionId: String, monitorId: String, - shardIdFailureMap: Map, + shardIdFailureMap: Map, findingIds: List, lastRunContexts: Map, + inputResults: InputRunResults = InputRunResults(), // partial, + triggerResults: Map = mapOf(), ) : super() { this.nodeId = nodeId this.executionId = executionId @@ -43,11 +51,20 @@ class DocLevelMonitorFanOutResponse : ActionResponse, ToXContentObject { this.shardIdFailureMap = shardIdFailureMap this.findingIds = findingIds this.lastRunContexts = lastRunContexts + this.inputResults = inputResults + this.triggerResults = triggerResults } @Throws(IOException::class) override fun writeTo(out: StreamOutput) { + out.writeString(nodeId) + out.writeString(executionId) + out.writeString(monitorId) + out.writeMap(shardIdFailureMap) + out.writeStringCollection(findingIds) out.writeMap(lastRunContexts) + inputResults.writeTo(out) + out.writeMap(triggerResults) } @Throws(IOException::class)