Skip to content

Commit 40a1c4b

Browse files
committed
Merge conflicts
Signed-off-by: Megha Goyal <[email protected]>
1 parent 65c5f51 commit 40a1c4b

File tree

2 files changed

+31
-35
lines changed

2 files changed

+31
-35
lines changed

alerting/src/main/kotlin/org/opensearch/alerting/DocumentLevelMonitorRunner.kt

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -140,32 +140,29 @@ object DocumentLevelMonitorRunner : MonitorRunner() {
140140
}
141141
}
142142

143-
indices.forEach { indexName ->
144-
// Prepare lastRunContext for each index
145-
val indexLastRunContext = lastRunContext.getOrPut(indexName) {
146-
val isIndexCreatedRecently = createdRecently(
147-
monitor,
148-
periodStart,
149-
periodEnd,
150-
monitorCtx.clusterService!!.state().metadata.index(indexName)
151-
)
152-
val updatedIndexName = indexName.replace("*", "_")
153-
val conflictingFields = monitorCtx.docLevelMonitorQueries!!.getAllConflictingFields(
154-
monitorCtx.clusterService!!.state(),
155-
concreteIndices
156-
)
143+
docLevelMonitorInput.indices.forEach { indexName ->
144+
val concreteIndices = IndexUtils.resolveAllIndices(
145+
listOf(indexName),
146+
monitorCtx.clusterService!!,
147+
monitorCtx.indexNameExpressionResolver!!
148+
)
149+
val updatedIndexName = indexName.replace("*", "_")
150+
val conflictingFields = monitorCtx.docLevelMonitorQueries!!.getAllConflictingFields(
151+
monitorCtx.clusterService!!.state(),
152+
concreteIndices
153+
)
157154

158-
concreteIndices.forEach { concreteIndexName ->
159-
// Prepare lastRunContext for each index
160-
val indexLastRunContext = lastRunContext.getOrPut(concreteIndexName) {
161-
val isIndexCreatedRecently = createdRecently(
162-
monitor,
163-
periodStart,
164-
periodEnd,
165-
monitorCtx.clusterService!!.state().metadata.index(concreteIndexName)
166-
)
167-
MonitorMetadataService.createRunContextForIndex(concreteIndexName, isIndexCreatedRecently)
168-
}
155+
concreteIndices.forEach { concreteIndexName ->
156+
// Prepare lastRunContext for each index
157+
val indexLastRunContext = lastRunContext.getOrPut(concreteIndexName) {
158+
val isIndexCreatedRecently = createdRecently(
159+
monitor,
160+
periodStart,
161+
periodEnd,
162+
monitorCtx.clusterService!!.state().metadata.index(concreteIndexName)
163+
)
164+
MonitorMetadataService.createRunContextForIndex(concreteIndexName, isIndexCreatedRecently)
165+
}
169166

170167
// Prepare updatedLastRunContext for each index
171168
val indexUpdatedRunContext = updateLastRunContext(
@@ -189,15 +186,14 @@ object DocumentLevelMonitorRunner : MonitorRunner() {
189186
// Prepare DocumentExecutionContext for each index
190187
val docExecutionContext = DocumentExecutionContext(queries, indexLastRunContext, indexUpdatedRunContext)
191188

192-
val matchingDocs = getMatchingDocs(
193-
monitor,
194-
monitorCtx,
195-
docExecutionContext,
196-
indexName,
197-
updatedIndexName,
198-
concreteIndexName,
199-
conflictingFields.toList()
200-
)
189+
val matchingDocs = getMatchingDocs(
190+
monitor,
191+
monitorCtx,
192+
docExecutionContext,
193+
updatedIndexName,
194+
concreteIndexName,
195+
conflictingFields.toList()
196+
)
201197

202198
if (matchingDocs.isNotEmpty()) {
203199
val matchedQueriesForDocs = getMatchedQueries(

alerting/src/test/kotlin/org/opensearch/alerting/DocumentMonitorRunnerIT.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import org.opensearch.commons.alerting.model.action.ActionExecutionPolicy
2121
import org.opensearch.commons.alerting.model.action.AlertCategory
2222
import org.opensearch.commons.alerting.model.action.PerAlertActionScope
2323
import org.opensearch.commons.alerting.model.action.PerExecutionActionScope
24-
import org.opensearch.core.rest.RestStatus
24+
import org.opensearch.rest.RestStatus
2525
import org.opensearch.script.Script
2626
import java.time.ZonedDateTime
2727
import java.time.format.DateTimeFormatter

0 commit comments

Comments
 (0)