diff --git a/check_in.go b/check_in.go index d41ba3d2..de6d0adb 100644 --- a/check_in.go +++ b/check_in.go @@ -87,6 +87,10 @@ type MonitorConfig struct { //nolint: maligned // prefer readability over optima // A tz database string representing the timezone which the monitor's execution schedule is in. // See: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones Timezone string `json:"timezone,omitempty"` + // The number of consecutive failed check-ins it takes before an issue is created. + FailureIssueThreshold int64 `json:"failure_issue_threshold,omitempty"` + // The number of consecutive OK check-ins it takes before an issue is resolved. + RecoveryThreshold int64 `json:"recovery_threshold,omitempty"` } type CheckIn struct { //nolint: maligned // prefer readability over optimal memory layout diff --git a/client_test.go b/client_test.go index 0e057751..662687f6 100644 --- a/client_test.go +++ b/client_test.go @@ -383,10 +383,12 @@ func TestCaptureCheckIn(t *testing.T) { Duration: time.Second * 10, }, monitorConfig: &MonitorConfig{ - Schedule: IntervalSchedule(1, MonitorScheduleUnitHour), - CheckInMargin: 10, - MaxRuntime: 5000, - Timezone: "Asia/Singapore", + Schedule: IntervalSchedule(1, MonitorScheduleUnitHour), + CheckInMargin: 10, + MaxRuntime: 5000, + Timezone: "Asia/Singapore", + FailureIssueThreshold: 5, + RecoveryThreshold: 10, }, }, { @@ -398,10 +400,12 @@ func TestCaptureCheckIn(t *testing.T) { Duration: time.Second * 10, }, monitorConfig: &MonitorConfig{ - Schedule: CrontabSchedule("40 * * * *"), - CheckInMargin: 10, - MaxRuntime: 5000, - Timezone: "Asia/Singapore", + Schedule: CrontabSchedule("40 * * * *"), + CheckInMargin: 10, + MaxRuntime: 5000, + Timezone: "Asia/Singapore", + FailureIssueThreshold: 5, + RecoveryThreshold: 10, }, }, }