diff --git a/notification/rule/http_test.go b/notification/rule/http_test.go index f6a85a196ba..5607ba524b3 100644 --- a/notification/rule/http_test.go +++ b/notification/rule/http_test.go @@ -33,7 +33,7 @@ crit = statuses (r["_level"] == "crit")) all_statuses = crit |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn: (r) => { @@ -102,7 +102,7 @@ crit = statuses (r["_level"] == "crit")) all_statuses = crit |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn: (r) => { @@ -177,7 +177,7 @@ crit = statuses (r["_level"] == "crit")) all_statuses = crit |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn: (r) => { @@ -250,7 +250,7 @@ crit = statuses (r["_level"] == "crit")) all_statuses = crit |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 5s))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 5s))) all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn: (r) => { diff --git a/notification/rule/pagerduty_test.go b/notification/rule/pagerduty_test.go index 1515f7dae44..97d1cef34ed 100644 --- a/notification/rule/pagerduty_test.go +++ b/notification/rule/pagerduty_test.go @@ -83,7 +83,7 @@ crit = statuses (r["_level"] == "crit")) all_statuses = crit |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: pagerduty_endpoint(mapFn: (r) => @@ -166,7 +166,7 @@ info_to_crit = statuses |> monitor["stateChanges"](fromLevel: "info", toLevel: "crit") all_statuses = info_to_crit |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: pagerduty_endpoint(mapFn: (r) => @@ -256,7 +256,7 @@ ok_to_warn = statuses all_statuses = union(tables: [crit, ok_to_warn]) |> sort(columns: ["_time"]) |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: pagerduty_endpoint(mapFn: (r) => diff --git a/notification/rule/rule.go b/notification/rule/rule.go index ec875b48360..7482f3f07a8 100644 --- a/notification/rule/rule.go +++ b/notification/rule/rule.go @@ -136,16 +136,17 @@ func (b *Base) generateLevelChecks() []ast.Statement { now := flux.Call(flux.Identifier("now"), flux.Object()) timeFilter := flux.Function( flux.FunctionParams("r"), - flux.GreaterThan( - flux.Member("r", "_time"), - flux.Call( + &ast.BinaryExpression{ + Operator: ast.GreaterThanEqualOperator, + Left: flux.Member("r", "_time"), + Right: flux.Call( flux.Member("experimental", "subDuration"), flux.Object( flux.Property("from", now), flux.Property("d", (*ast.DurationLiteral)(b.Every)), ), ), - ), + }, ) var pipe *ast.PipeExpression diff --git a/notification/rule/slack_test.go b/notification/rule/slack_test.go index 995f33c8b12..88d4698edfb 100644 --- a/notification/rule/slack_test.go +++ b/notification/rule/slack_test.go @@ -61,7 +61,7 @@ any = statuses (true)) all_statuses = any |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: slack_endpoint(mapFn: (r) => @@ -133,7 +133,7 @@ info_to_warn = statuses all_statuses = union(tables: [crit, info_to_warn]) |> sort(columns: ["_time"]) |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: slack_endpoint(mapFn: (r) => @@ -210,7 +210,7 @@ info_to_warn = statuses all_statuses = union(tables: [crit, info_to_warn]) |> sort(columns: ["_time"]) |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: slack_endpoint(mapFn: (r) => @@ -289,7 +289,7 @@ info_to_warn = statuses all_statuses = union(tables: [crit, info_to_warn]) |> sort(columns: ["_time"]) |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: slack_endpoint(mapFn: (r) => diff --git a/notification/rule/telegram_test.go b/notification/rule/telegram_test.go index 8dae3b0fa98..05643bb429d 100644 --- a/notification/rule/telegram_test.go +++ b/notification/rule/telegram_test.go @@ -125,7 +125,7 @@ crit = statuses (r["_level"] == "crit")) all_statuses = crit |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: telegram_endpoint(mapFn: (r) => @@ -197,7 +197,7 @@ any = statuses (true)) all_statuses = any |> filter(fn: (r) => - (r["_time"] > experimental["subDuration"](from: now(), d: 1h))) + (r["_time"] >= experimental["subDuration"](from: now(), d: 1h))) all_statuses |> monitor["notify"](data: notification, endpoint: telegram_endpoint(mapFn: (r) =>