From df54b4bacf3f3bd3fa7612394bd28d10d1e69a2d Mon Sep 17 00:00:00 2001 From: Ben Ridley Date: Tue, 16 Feb 2021 21:45:21 +1100 Subject: [PATCH] Improve documentation wording and formatting in response to maintainer feedback Signed-off-by: Ben Ridley --- config/config.go | 2 +- docs/configuration.md | 21 +++++++++++++-------- notify/notify_test.go | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/config/config.go b/config/config.go index f83dc835..440b505f 100644 --- a/config/config.go +++ b/config/config.go @@ -26,12 +26,12 @@ import ( "time" "github.com/pkg/errors" - "github.com/prometheus/alertmanager/timeinterval" commoncfg "github.com/prometheus/common/config" "github.com/prometheus/common/model" "gopkg.in/yaml.v2" "github.com/prometheus/alertmanager/pkg/labels" + "github.com/prometheus/alertmanager/timeinterval" ) const secretToken = "" diff --git a/docs/configuration.md b/docs/configuration.md index 046affc4..96cac652 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -175,6 +175,9 @@ match_re: # Times when the route should be muted. These must match the name of a # mute time interval defined in the mute_time_intervals section. # Additionally, the root node cannot have any mute times. +# When a route is muted it will not send any notifications, but +# otherwise acts normally (including ending the route-matching process +# if the `continue` option is not set.) mute_time_intervals: [ - ...] @@ -239,36 +242,38 @@ supports the following fields: [ - ...] ``` -All these fields are optional and if left unspecified allow any value to match the interval. +All fields are lists. Within each non-empty list, at least one element must be satisfied to match +the field. If a field is left unspecified, any value will match the field. For an instant of time +to match a complete time interval, all fields must match. Some fields support ranges and negative indices, and are detailed below. All definitions are taken to be in UTC, no other timezones are currently supported. -`times`: A list of time-ranges. They are inclusive of the starting time and exclusive -of the ending time to make it easy to represent times that start/end on hour boundaries. +`time_range` Ranges inclusive of the starting time and exclusive of the end time to +make it easy to represent times that start/end on hour boundaries. For example, start_time: '17:00' and end_time: '24:00' will begin at 17:00 and finish -immediately after 23:59. They are specified like so: +immediately before 24:00. They are specified like so: times: - start_time: HH:MM end_time: HH:MM -`weekdays`: A list of days of the week, where the week begins on Sunday and ends on Saturday. +`weeekday_range`: A list of days of the week, where the week begins on Sunday and ends on Saturday. Days should be specified by name (e.g. ‘Sunday’). For convenience, ranges are also accepted of the form : and are inclusive on both ends. For example: `[‘monday:wednesday','saturday', 'sunday']` -`days_of_month`: A list of numerical days in the month. Days begin at 1. +`days_of_month_ramge`: A list of numerical days in the month. Days begin at 1. Negative values are also accepted which begin at the end of the month, e.g. -1 during January would represent January 31. For example: `['1:5', '-3:-1']`. Extending past the start or end of the month will cause it to be clamped. E.g. specifying `['1:31']` during February will clamp the actual end date to 28 or 29 depending on leap years. Inclusive on both ends. -`months`: A list of calendar months identified by a case-insentive name (e.g. ‘January’) or by number, +`month_range`: A list of calendar months identified by a case-insentive name (e.g. ‘January’) or by number, where January = 1. Ranges are also accepted. For example, `['1:3', 'may:august', 'december']`. Inclusive on both ends. -`years`: A numerical list of years. Ranges are accepted. For example, `['2020:2022', '2030']`. +`year_range`: A numerical list of years. Ranges are accepted. For example, `['2020:2022', '2030']`. Inclusive on both ends. ## `` diff --git a/notify/notify_test.go b/notify/notify_test.go index 660c3709..94e1a140 100644 --- a/notify/notify_test.go +++ b/notify/notify_test.go @@ -723,7 +723,7 @@ func TestMuteStageWithSilences(t *testing.T) { } func TestTimeMuteStage(t *testing.T) { - // Route mutes alerts outside business hours + // Route mutes alerts outside business hours. muteIn := ` --- - weekdays: ['monday:friday']