mirror of
https://github.com/prometheus/alertmanager
synced 2024-12-24 15:12:37 +00:00
Allow routes to reference time intervals
Signed-off-by: Ben Ridley <benridley29@gmail.com>
This commit is contained in:
parent
5df661653c
commit
cbfbf07188
@ -34,6 +34,7 @@ var DefaultRouteOpts = RouteOpts{
|
||||
RepeatInterval: 4 * time.Hour,
|
||||
GroupBy: map[model.LabelName]struct{}{},
|
||||
GroupByAll: false,
|
||||
MuteTimes: []string{},
|
||||
}
|
||||
|
||||
// A Route is a node that contains definitions of how to handle alerts.
|
||||
@ -65,6 +66,7 @@ func NewRoute(cr *config.Route, parent *Route) *Route {
|
||||
if cr.Receiver != "" {
|
||||
opts.Receiver = cr.Receiver
|
||||
}
|
||||
|
||||
if cr.GroupBy != nil {
|
||||
opts.GroupBy = map[model.LabelName]struct{}{}
|
||||
for _, ln := range cr.GroupBy {
|
||||
@ -115,6 +117,8 @@ func NewRoute(cr *config.Route, parent *Route) *Route {
|
||||
|
||||
sort.Sort(matchers)
|
||||
|
||||
opts.MuteTimes = cr.MuteTimes
|
||||
|
||||
route := &Route{
|
||||
parent: parent,
|
||||
RouteOpts: opts,
|
||||
@ -203,6 +207,9 @@ type RouteOpts struct {
|
||||
GroupWait time.Duration
|
||||
GroupInterval time.Duration
|
||||
RepeatInterval time.Duration
|
||||
|
||||
// A list of time intervals for which the route is muted
|
||||
MuteTimes []string
|
||||
}
|
||||
|
||||
func (ro *RouteOpts) String() string {
|
||||
|
Loading…
Reference in New Issue
Block a user