Skip to content

Commit

Permalink
Improve documentation wording and formatting in response to maintaine…
Browse files Browse the repository at this point in the history
…r feedback

Signed-off-by: Ben Ridley <benridley29@gmail.com>
  • Loading branch information
benridley committed Feb 28, 2021
1 parent 3a5f4e5 commit df54b4b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<secret>"
Expand Down
21 changes: 13 additions & 8 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
[ - <string> ...]

Expand Down Expand Up @@ -239,36 +242,38 @@ supports the following fields:
[ - <year_range> ...]
```

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 <start_day>:<end_day> 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.

## `<inhibit_rule>`
Expand Down
2 changes: 1 addition & 1 deletion notify/notify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit df54b4b

Please sign in to comment.