Skip to content

Commit 35ee875

Browse files
authored
Feature: Add reminder notification for detector rule (#243)
* Add reminder notification for detector rule * Add documentation and units to property names
1 parent 84cc2a0 commit 35ee875

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package detector
2+
3+
// ReminderNotification struct for ReminderNotification
4+
type ReminderNotification struct {
5+
// The interval at which you want to receive the notifications, in milliseconds.
6+
IntervalMs int64 `json:"interval"`
7+
// The duration during which repeat notifications are sent, in milliseconds.
8+
TimeoutMs int64 `json:"timeout,omitempty"`
9+
// Type of reminder notification. Currently, the only supported value is TIMEOUT.
10+
Type string `json:"type"`
11+
}

detector/model_rule.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ type Rule struct {
3131
RunbookUrl string `json:"runbookUrl,omitempty"`
3232
Severity Severity `json:"severity,omitempty"`
3333
Tip string `json:"tip,omitempty"`
34+
// Reminder notification in a detector rule lets you send multiple notifications for active alerts over a defined period of time.
35+
ReminderNotification *ReminderNotification `json:"reminderNotification,omitempty"`
3436
}

detector_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ func TestValidateDetector(t *testing.T) {
254254
Description: "Maximum > 10 for 2m",
255255
DetectLabel: "Test detector validation",
256256
Severity: detector.INFO,
257+
ReminderNotification: &detector.ReminderNotification{
258+
IntervalMs: 100,
259+
TimeoutMs: 10000,
260+
Type: "TIMEOUT",
261+
},
257262
},
258263
},
259264
})

testdata/fixtures/detector/create_success.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
"parameterizedBody": "string",
3939
"parameterizedSubject": "string",
4040
"runbookUrl": "string",
41+
"reminderNotification" : {
42+
"interval" : 300000,
43+
"timeout" : 3600000,
44+
"type" : "TIMEOUT"
45+
},
4146
"severity": "Critical"
4247
}
4348
],

0 commit comments

Comments
 (0)