Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty set depends #2027

Merged
merged 2 commits into from Mar 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/bosun/conf/rule/rule.go
Expand Up @@ -630,7 +630,7 @@ func (c *Conf) loadAlert(s *parse.SectionNode) {
if err != nil {
c.error(err)
}
if len(depTags.Intersection(tags)) < 1 {
if len(depTags) != 0 && len(depTags.Intersection(tags)) < 1 {
c.errorf("Depends and crit/warn must share at least one tag.")
}
}
Expand Down
19 changes: 18 additions & 1 deletion cmd/bosun/expr/funcs.go
Expand Up @@ -44,6 +44,23 @@ func tagRemove(args []parse.Node) (parse.Tags, error) {
return tags, nil
}

func seriesFuncTags(args []parse.Node) (parse.Tags, error) {
t := make(parse.Tags)
text := args[0].(*parse.StringNode).Text
if text == "" {
return t, nil
}
ts, err := opentsdb.ParseTags(text)
if err != nil {
return nil, err
}

for k := range ts {
t[k] = struct{}{}
}
return t, nil
}

func tagTranspose(args []parse.Node) (parse.Tags, error) {
tags := make(parse.Tags)
sp := strings.Split(args[1].(*parse.StringNode).Text, ",")
Expand Down Expand Up @@ -309,7 +326,7 @@ var builtins = map[string]parse.Func{
VArgsPos: 1,
VArgsOmit: true,
Return: models.TypeSeriesSet,
Tags: tagFirst,
Tags: seriesFuncTags,
F: SeriesFunc,
},
"sort": {
Expand Down
2 changes: 1 addition & 1 deletion cmd/bosun/sched/check.go
Expand Up @@ -614,7 +614,7 @@ func markDependenciesUnevaluated(events map[models.AlertKey]*models.Event, deps
continue
}
for _, dep := range deps {
if dep.Group.Overlaps(ak.Group()) {
if len(dep.Group) == 0 || dep.Group.Overlaps(ak.Group()) {
ev.Unevaluated = true
unevalCount++
}
Expand Down