build(flux): update flux to v0.140.0 (#22845)
* build(flux): update flux to v0.140.0 * chore: Reformat scripts in generated flux testspull/22858/head
parent
36dcc20320
commit
f6568a7ff6
2
go.mod
2
go.mod
|
@ -37,7 +37,7 @@ require (
|
|||
github.com/hashicorp/vault/api v1.0.2
|
||||
github.com/imdario/mergo v0.3.9 // indirect
|
||||
github.com/influxdata/cron v0.0.0-20201006132531-4bb0a200dcbe
|
||||
github.com/influxdata/flux v0.139.0
|
||||
github.com/influxdata/flux v0.140.0
|
||||
github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69
|
||||
github.com/influxdata/influxql v1.1.1-0.20211004132434-7e7d61973256
|
||||
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839
|
||||
|
|
4
go.sum
4
go.sum
|
@ -426,8 +426,8 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH
|
|||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/influxdata/cron v0.0.0-20201006132531-4bb0a200dcbe h1:7j4SdN/BvQwN6WoUq7mv0kg5U9NhnFBxPGMafYRKym0=
|
||||
github.com/influxdata/cron v0.0.0-20201006132531-4bb0a200dcbe/go.mod h1:XabtPPW2qsCg0tl+kjaPU+cFS+CjQXEXbT1VJvHT4og=
|
||||
github.com/influxdata/flux v0.139.0 h1:xCvnfaYG9ShrHqRH2BP3K/75a4zS2gTeNV81n7zM1sc=
|
||||
github.com/influxdata/flux v0.139.0/go.mod h1:Q1kyXp+qkeAkX0T8wiNKCU7lqtEep1aK7QqrXntPPD4=
|
||||
github.com/influxdata/flux v0.140.0 h1:0iwqUeJLGPN18URgpPRYSoygqJ+iXQJeMyqNXPtWIII=
|
||||
github.com/influxdata/flux v0.140.0/go.mod h1:Q1kyXp+qkeAkX0T8wiNKCU7lqtEep1aK7QqrXntPPD4=
|
||||
github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69 h1:WQsmW0fXO4ZE/lFGIE84G6rIV5SJN3P3sjIXAP1a8eU=
|
||||
github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69/go.mod h1:pwymjR6SrP3gD3pRj9RJwdl1j5s3doEEV8gS4X9qSzA=
|
||||
github.com/influxdata/influx-cli/v2 v2.1.1-0.20211007122339-c4a5a13c8ee3 h1:DJFtOP/Gji5K6iut794K1pTKPd9SqM9J+Cb7vXgsnq0=
|
||||
|
|
|
@ -3,6 +3,7 @@ package rule_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/andreyvit/diff"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/notification"
|
||||
|
@ -27,11 +28,16 @@ statuses = monitor["from"](start: -2h)
|
|||
crit = statuses |> filter(fn: (r) => r["_level"] == "crit")
|
||||
all_statuses = crit |> filter(fn: (r) => r["_time"] >= experimental["subDuration"](from: now(), d: 1h))
|
||||
|
||||
all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn: (r) => {
|
||||
body = {r with _version: 1}
|
||||
|
||||
return {headers: headers, data: json["encode"](v: body)}
|
||||
}))`
|
||||
all_statuses |> monitor["notify"](
|
||||
data: notification,
|
||||
endpoint: endpoint(
|
||||
mapFn: (r) => {
|
||||
body = {r with _version: 1}
|
||||
|
||||
return {headers: headers, data: json["encode"](v: body)}
|
||||
},
|
||||
),
|
||||
)`
|
||||
|
||||
s := &rule.HTTP{
|
||||
Base: rule.Base{
|
||||
|
@ -64,7 +70,7 @@ all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn:
|
|||
}
|
||||
|
||||
if f != want {
|
||||
t.Errorf("scripts did not match. want:\n%v\n\ngot:\n%v", want, f)
|
||||
t.Errorf("\n\nScripts did not match:\n\n%s", diff.LineDiff(f, want))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,11 +90,16 @@ statuses = monitor["from"](start: -2h)
|
|||
crit = statuses |> filter(fn: (r) => r["_level"] == "crit")
|
||||
all_statuses = crit |> filter(fn: (r) => r["_time"] >= experimental["subDuration"](from: now(), d: 1h))
|
||||
|
||||
all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn: (r) => {
|
||||
body = {r with _version: 1}
|
||||
|
||||
return {headers: headers, data: json["encode"](v: body)}
|
||||
}))`
|
||||
all_statuses |> monitor["notify"](
|
||||
data: notification,
|
||||
endpoint: endpoint(
|
||||
mapFn: (r) => {
|
||||
body = {r with _version: 1}
|
||||
|
||||
return {headers: headers, data: json["encode"](v: body)}
|
||||
},
|
||||
),
|
||||
)`
|
||||
s := &rule.HTTP{
|
||||
Base: rule.Base{
|
||||
ID: 1,
|
||||
|
@ -127,7 +138,7 @@ all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn:
|
|||
}
|
||||
|
||||
if f != want {
|
||||
t.Errorf("scripts did not match. want:\n%v\n\ngot:\n%v", want, f)
|
||||
t.Errorf("\n\nScripts did not match:\n\n%s", diff.LineDiff(f, want))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,11 +158,16 @@ statuses = monitor["from"](start: -2h)
|
|||
crit = statuses |> filter(fn: (r) => r["_level"] == "crit")
|
||||
all_statuses = crit |> filter(fn: (r) => r["_time"] >= experimental["subDuration"](from: now(), d: 1h))
|
||||
|
||||
all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn: (r) => {
|
||||
body = {r with _version: 1}
|
||||
|
||||
return {headers: headers, data: json["encode"](v: body)}
|
||||
}))`
|
||||
all_statuses |> monitor["notify"](
|
||||
data: notification,
|
||||
endpoint: endpoint(
|
||||
mapFn: (r) => {
|
||||
body = {r with _version: 1}
|
||||
|
||||
return {headers: headers, data: json["encode"](v: body)}
|
||||
},
|
||||
),
|
||||
)`
|
||||
|
||||
s := &rule.HTTP{
|
||||
Base: rule.Base{
|
||||
|
@ -188,7 +204,7 @@ all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn:
|
|||
}
|
||||
|
||||
if f != want {
|
||||
t.Errorf("scripts did not match. want:\n%v\n\ngot:\n%v", want, f)
|
||||
t.Errorf("\n\nScripts did not match:\n\n%s", diff.LineDiff(f, want))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,11 +224,16 @@ statuses = monitor["from"](start: -10s)
|
|||
crit = statuses |> filter(fn: (r) => r["_level"] == "crit")
|
||||
all_statuses = crit |> filter(fn: (r) => r["_time"] >= experimental["subDuration"](from: now(), d: 5s))
|
||||
|
||||
all_statuses |> monitor["notify"](data: notification, endpoint: endpoint(mapFn: (r) => {
|
||||
body = {r with _version: 1}
|
||||
|
||||
return {headers: headers, data: json["encode"](v: body)}
|
||||
}))`
|
||||
all_statuses |> monitor["notify"](
|
||||
data: notification,
|
||||
endpoint: endpoint(
|
||||
mapFn: (r) => {
|
||||
body = {r with _version: 1}
|
||||
|
||||
return {headers: headers, data: json["encode"](v: body)}
|
||||
},
|
||||
),
|
||||
)`
|
||||
|
||||
s := &rule.HTTP{
|
||||
Base: rule.Base{
|
||||
|
|
|
@ -73,18 +73,23 @@ statuses = monitor["from"](start: -2h, fn: (r) => r["foo"] == "bar" and r["baz"]
|
|||
crit = statuses |> filter(fn: (r) => r["_level"] == "crit")
|
||||
all_statuses = crit |> filter(fn: (r) => r["_time"] >= experimental["subDuration"](from: now(), d: 1h))
|
||||
|
||||
all_statuses |> monitor["notify"](data: notification, endpoint: pagerduty_endpoint(mapFn: (r) => ({
|
||||
routingKey: pagerduty_secret,
|
||||
client: "influxdata",
|
||||
clientURL: "http://localhost:7777/host/${r.host}",
|
||||
class: r._check_name,
|
||||
group: r["_source_measurement"],
|
||||
severity: pagerduty["severityFromLevel"](level: r["_level"]),
|
||||
eventAction: pagerduty["actionFromLevel"](level: r["_level"]),
|
||||
source: notification["_notification_rule_name"],
|
||||
summary: r["_message"],
|
||||
timestamp: time(v: r["_source_timestamp"]),
|
||||
})))`,
|
||||
all_statuses |> monitor["notify"](
|
||||
data: notification,
|
||||
endpoint: pagerduty_endpoint(
|
||||
mapFn: (r) => ({
|
||||
routingKey: pagerduty_secret,
|
||||
client: "influxdata",
|
||||
clientURL: "http://localhost:7777/host/${r.host}",
|
||||
class: r._check_name,
|
||||
group: r["_source_measurement"],
|
||||
severity: pagerduty["severityFromLevel"](level: r["_level"]),
|
||||
eventAction: pagerduty["actionFromLevel"](level: r["_level"]),
|
||||
source: notification["_notification_rule_name"],
|
||||
summary: r["_message"],
|
||||
timestamp: time(v: r["_source_timestamp"]),
|
||||
}),
|
||||
),
|
||||
)`,
|
||||
},
|
||||
{
|
||||
name: "notify on info to crit",
|
||||
|
@ -143,18 +148,23 @@ statuses = monitor["from"](start: -2h, fn: (r) => r["foo"] == "bar" and r["baz"]
|
|||
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))
|
||||
|
||||
all_statuses |> monitor["notify"](data: notification, endpoint: pagerduty_endpoint(mapFn: (r) => ({
|
||||
routingKey: pagerduty_secret,
|
||||
client: "influxdata",
|
||||
clientURL: "http://localhost:7777/host/${r.host}",
|
||||
class: r._check_name,
|
||||
group: r["_source_measurement"],
|
||||
severity: pagerduty["severityFromLevel"](level: r["_level"]),
|
||||
eventAction: pagerduty["actionFromLevel"](level: r["_level"]),
|
||||
source: notification["_notification_rule_name"],
|
||||
summary: r["_message"],
|
||||
timestamp: time(v: r["_source_timestamp"]),
|
||||
})))`,
|
||||
all_statuses |> monitor["notify"](
|
||||
data: notification,
|
||||
endpoint: pagerduty_endpoint(
|
||||
mapFn: (r) => ({
|
||||
routingKey: pagerduty_secret,
|
||||
client: "influxdata",
|
||||
clientURL: "http://localhost:7777/host/${r.host}",
|
||||
class: r._check_name,
|
||||
group: r["_source_measurement"],
|
||||
severity: pagerduty["severityFromLevel"](level: r["_level"]),
|
||||
eventAction: pagerduty["actionFromLevel"](level: r["_level"]),
|
||||
source: notification["_notification_rule_name"],
|
||||
summary: r["_message"],
|
||||
timestamp: time(v: r["_source_timestamp"]),
|
||||
}),
|
||||
),
|
||||
)`,
|
||||
},
|
||||
{
|
||||
name: "notify on crit or ok to warn",
|
||||
|
@ -217,18 +227,23 @@ crit = statuses |> filter(fn: (r) => r["_level"] == "crit")
|
|||
ok_to_warn = statuses |> monitor["stateChanges"](fromLevel: "ok", toLevel: "warn")
|
||||
all_statuses = union(tables: [crit, ok_to_warn]) |> sort(columns: ["_time"]) |> filter(fn: (r) => r["_time"] >= experimental["subDuration"](from: now(), d: 1h))
|
||||
|
||||
all_statuses |> monitor["notify"](data: notification, endpoint: pagerduty_endpoint(mapFn: (r) => ({
|
||||
routingKey: pagerduty_secret,
|
||||
client: "influxdata",
|
||||
clientURL: "http://localhost:7777/host/${r.host}",
|
||||
class: r._check_name,
|
||||
group: r["_source_measurement"],
|
||||
severity: pagerduty["severityFromLevel"](level: r["_level"]),
|
||||
eventAction: pagerduty["actionFromLevel"](level: r["_level"]),
|
||||
source: notification["_notification_rule_name"],
|
||||
summary: r["_message"],
|
||||
timestamp: time(v: r["_source_timestamp"]),
|
||||
})))`,
|
||||
all_statuses |> monitor["notify"](
|
||||
data: notification,
|
||||
endpoint: pagerduty_endpoint(
|
||||
mapFn: (r) => ({
|
||||
routingKey: pagerduty_secret,
|
||||
client: "influxdata",
|
||||
clientURL: "http://localhost:7777/host/${r.host}",
|
||||
class: r._check_name,
|
||||
group: r["_source_measurement"],
|
||||
severity: pagerduty["severityFromLevel"](level: r["_level"]),
|
||||
eventAction: pagerduty["actionFromLevel"](level: r["_level"]),
|
||||
source: notification["_notification_rule_name"],
|
||||
summary: r["_message"],
|
||||
timestamp: time(v: r["_source_timestamp"]),
|
||||
}),
|
||||
),
|
||||
)`,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue