Skip to content

Commit 11aa3c5

Browse files
changed alertContext field name to alert (#1574)
Signed-off-by: Dennis Toepker <[email protected]> Co-authored-by: Dennis Toepker <[email protected]> (cherry picked from commit 7c65e9d) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 9d6005c commit 11aa3c5

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class AlertService(
158158
workflorwRunContext: WorkflowRunContext?
159159
): Alert? {
160160
val currentTime = Instant.now()
161-
val currentAlert = ctx.alertContext?.alert
161+
val currentAlert = ctx.alert?.alert
162162

163163
val updatedActionExecutionResults = mutableListOf<ActionExecutionResult>()
164164
val currentActionIds = mutableSetOf<String>()

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ abstract class MonitorRunner {
5555
dryrun: Boolean
5656
): ActionRunResult {
5757
return try {
58-
if (ctx is QueryLevelTriggerExecutionContext && !MonitorRunnerService.isActionActionable(action, ctx.alertContext?.alert)) {
58+
if (ctx is QueryLevelTriggerExecutionContext && !MonitorRunnerService.isActionActionable(action, ctx.alert?.alert)) {
5959
return ActionRunResult(action.id, action.name, mapOf(), true, null, null)
6060
}
6161
val actionOutput = mutableMapOf<String, String>()

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class TriggerService(val scriptService: ScriptService) {
5353
): Boolean {
5454
if (workflowRunContext?.auditDelegateMonitorAlerts == true) return false
5555
// Suppress actions if the current alert is acknowledged and there are no errors.
56-
val suppress = ctx.alertContext?.alert?.state == Alert.State.ACKNOWLEDGED && result.error == null && ctx.error == null
56+
val suppress = ctx.alert?.alert?.state == Alert.State.ACKNOWLEDGED && result.error == null && ctx.error == null
5757
return result.triggered && !suppress
5858
}
5959

alerting/src/main/kotlin/org/opensearch/alerting/script/QueryLevelTriggerExecutionContext.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ data class QueryLevelTriggerExecutionContext(
1818
override val results: List<Map<String, Any>>,
1919
override val periodStart: Instant,
2020
override val periodEnd: Instant,
21-
val alertContext: AlertContext? = null,
21+
val alert: AlertContext? = null,
2222
override val error: Exception? = null
2323
) : TriggerExecutionContext(monitor, results, periodStart, periodEnd, error) {
2424

@@ -39,7 +39,7 @@ data class QueryLevelTriggerExecutionContext(
3939
override fun asTemplateArg(): Map<String, Any?> {
4040
val tempArg = super.asTemplateArg().toMutableMap()
4141
tempArg["trigger"] = trigger.asTemplateArg()
42-
tempArg["alert"] = alertContext?.asTemplateArg() // map "alert" templateArg field to AlertContext wrapper instead of Alert object
42+
tempArg["alert"] = alert?.asTemplateArg() // map "alert" templateArg field to AlertContext wrapper instead of Alert object
4343
return tempArg
4444
}
4545
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ class TransportDocLevelMonitorFanOutAction
576576
dryrun: Boolean
577577
): ActionRunResult {
578578
return try {
579-
if (ctx is QueryLevelTriggerExecutionContext && !MonitorRunnerService.isActionActionable(action, ctx.alertContext?.alert)) {
579+
if (ctx is QueryLevelTriggerExecutionContext && !MonitorRunnerService.isActionActionable(action, ctx.alert?.alert)) {
580580
return ActionRunResult(action.id, action.name, mapOf(), true, null, null)
581581
}
582582
val actionOutput = mutableMapOf<String, String>()

alerting/src/main/resources/org/opensearch/alerting/org.opensearch.alerting.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class org.opensearch.alerting.script.QueryLevelTriggerExecutionContext {
2727
List getResults()
2828
java.time.Instant getPeriodStart()
2929
java.time.Instant getPeriodEnd()
30-
AlertContext getAlertContext()
30+
AlertContext getAlert()
3131
Exception getError()
3232
}
3333

0 commit comments

Comments
 (0)