diff --git a/mission-control/docs/notifications/concepts/repeat-interval.mdx b/mission-control/docs/notifications/concepts/repeat-interval.mdx new file mode 100644 index 0000000..225eb45 --- /dev/null +++ b/mission-control/docs/notifications/concepts/repeat-interval.mdx @@ -0,0 +1,61 @@ +--- +title: Repeat Interval +--- + +The repeat interval determines the duration between subsequent notifications after an initial successful delivery. + +```yaml title="deployment-failed.yaml" +apiVersion: mission-control.flanksource.com/v1 +kind: Notification +metadata: + name: config-updates + namespace: default +spec: + events: + - config.healthy + - config.unhealthy + - config.warning + - config.unknown + filter: config.type == "Kubernetes::Deployment" + to: + email: alerts@acme.com + repeatInterval: 2h +``` + +The above notification sends at max 1 email notification in a moving 2 hour window. + +## Repeat Group + +By default, the repeat interval applies to any notification sent for the given notification. + +In the example above, if a notification is sent for a `config.healthy` event and then a new notification is to be sent +for a `config.unhealthy` event, then the notification is dropped due to the repeat interval. + +With grouping, you can apply the repeat interval per source event & per resource ID. + +- `source_event` +- `resource_id` + +```yaml title="deployment-updates.yaml" +apiVersion: mission-control.flanksource.com/v1 +kind: Notification +metadata: + name: config-updates + namespace: default +spec: + events: + - config.healthy + - config.unhealthy + - config.warning + - config.unknown + filter: config.type == "Kubernetes::Deployment" + to: + email: alerts@acme.com + repeatInterval: 2h + // highlight-start + repeatGroup: + - source_event + // highlight-end +``` + +With this change, you'll now receive at max 4 notifications for each source event. \ No newline at end of file diff --git a/mission-control/docs/reference/notifications/_notification.mdx b/mission-control/docs/reference/notifications/_notification.mdx index 997352e..2783847 100644 --- a/mission-control/docs/reference/notifications/_notification.mdx +++ b/mission-control/docs/reference/notifications/_notification.mdx @@ -35,6 +35,16 @@ description: "Properties are channel dependent special directives to modify the notification message. Example: for email, `FromAddress=admin@flanksource.com` modifies the sender of the email. [Read more](https://containrrr.dev/shoutrrr/v0.8/)", scheme: "`map[string]string`" }, + { + field: "repeatInterval", + description: "The waiting time to resend a notification after it has been succefully sent.", + scheme: "duration" + }, + { + field: "repeatGroup", + description: "RepeatGroup allows notifications to be grouped by certain set of keys and only send one per group within the specified repeat interval. Valid group keys: `resource_id` & `source_event`.", + scheme: "`[]string`" + }, { field: "title", description: "Channel dependent e.g. subject for email", @@ -57,7 +67,7 @@ }, { field: "filter", - description: "Filter narrows down the event trigger. Example: `check.type == 'http'` filter on `check.failed` event will only send notification for failing http checks.", + description: "Filter narrows down the event trigger.\n\nExample: `check.type == 'http'` filter on `check.failed` event will only send notification for failing http checks.", scheme: "CEL", templateEnv: [ {"name": "CheckEvents", "url": "/reference/notifications/template_vars#check-health-env"},