Skip to content

Commit 2c92a3d

Browse files
committed
removing requirement for lookback to be for cron only
1 parent 3646931 commit 2c92a3d

File tree

1 file changed

+7
-11
lines changed
  • core/src/main/kotlin/org/opensearch/alerting/core/modelv2

1 file changed

+7
-11
lines changed

core/src/main/kotlin/org/opensearch/alerting/core/modelv2/PPLMonitor.kt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ data class PPLMonitor(
140140
builder.optionalUserField(USER_FIELD, user)
141141
}
142142

143-
builder.field(MonitorV2.NAME_FIELD, name)
144-
builder.field(MonitorV2.SCHEDULE_FIELD, schedule)
145-
builder.field(MonitorV2.LOOK_BACK_WINDOW_FIELD, lookBackWindow?.toHumanReadableString(0))
146-
builder.field(MonitorV2.ENABLED_FIELD, enabled)
147-
builder.nonOptionalTimeField(MonitorV2.LAST_UPDATE_TIME_FIELD, lastUpdateTime)
148-
builder.optionalTimeField(MonitorV2.ENABLED_TIME_FIELD, enabledTime)
149-
builder.field(MonitorV2.TRIGGERS_FIELD, triggers.toTypedArray())
143+
builder.field(NAME_FIELD, name)
144+
builder.field(SCHEDULE_FIELD, schedule)
145+
builder.field(LOOK_BACK_WINDOW_FIELD, lookBackWindow?.toHumanReadableString(0))
146+
builder.field(ENABLED_FIELD, enabled)
147+
builder.nonOptionalTimeField(LAST_UPDATE_TIME_FIELD, lastUpdateTime)
148+
builder.optionalTimeField(ENABLED_TIME_FIELD, enabledTime)
149+
builder.field(TRIGGERS_FIELD, triggers.toTypedArray())
150150
builder.field(Monitor.SCHEMA_VERSION_FIELD, schemaVersion)
151151
builder.field(QUERY_LANGUAGE_FIELD, queryLanguage.value)
152152
builder.field(QUERY_FIELD, query)
@@ -331,10 +331,6 @@ data class PPLMonitor(
331331
requireNotNull(query) { "Query is null" }
332332
requireNotNull(lastUpdateTime) { "Last update time is null" }
333333

334-
if (schedule is IntervalSchedule && lookBackWindow != null) {
335-
throw IllegalArgumentException("Look back windows only supported for CRON schedules")
336-
}
337-
338334
if (queryLanguage == QueryLanguage.SQL) {
339335
throw IllegalArgumentException("SQL queries are not supported. Please use a PPL query.")
340336
}

0 commit comments

Comments
 (0)