mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-21 03:16:00 -08:00
Change WITH keyword to LABELS
This commit is contained in:
parent
92c851f322
commit
4209ec6864
|
@ -153,7 +153,7 @@ const (
|
||||||
itemAlert
|
itemAlert
|
||||||
itemIf
|
itemIf
|
||||||
itemFor
|
itemFor
|
||||||
itemWith
|
itemLabels
|
||||||
itemAnnotations
|
itemAnnotations
|
||||||
itemKeepCommon
|
itemKeepCommon
|
||||||
itemOffset
|
itemOffset
|
||||||
|
@ -183,7 +183,7 @@ var key = map[string]itemType{
|
||||||
"alert": itemAlert,
|
"alert": itemAlert,
|
||||||
"if": itemIf,
|
"if": itemIf,
|
||||||
"for": itemFor,
|
"for": itemFor,
|
||||||
"with": itemWith,
|
"labels": itemLabels,
|
||||||
"annotations": itemAnnotations,
|
"annotations": itemAnnotations,
|
||||||
"offset": itemOffset,
|
"offset": itemOffset,
|
||||||
"by": itemBy,
|
"by": itemBy,
|
||||||
|
|
|
@ -238,8 +238,8 @@ var tests = []struct {
|
||||||
input: "for",
|
input: "for",
|
||||||
expected: []item{{itemFor, 0, "for"}},
|
expected: []item{{itemFor, 0, "for"}},
|
||||||
}, {
|
}, {
|
||||||
input: "with",
|
input: "labels",
|
||||||
expected: []item{{itemWith, 0, "with"}},
|
expected: []item{{itemLabels, 0, "labels"}},
|
||||||
}, {
|
}, {
|
||||||
input: "annotations",
|
input: "annotations",
|
||||||
expected: []item{{itemAnnotations, 0, "annotations"}},
|
expected: []item{{itemAnnotations, 0, "annotations"}},
|
||||||
|
|
|
@ -358,7 +358,7 @@ func (p *parser) stmt() Statement {
|
||||||
// alertStmt parses an alert rule.
|
// alertStmt parses an alert rule.
|
||||||
//
|
//
|
||||||
// ALERT name IF expr [FOR duration]
|
// ALERT name IF expr [FOR duration]
|
||||||
// [WITH label_set]
|
// [LABELS label_set]
|
||||||
// [ANNOTATIONS label_set]
|
// [ANNOTATIONS label_set]
|
||||||
//
|
//
|
||||||
func (p *parser) alertStmt() *AlertStmt {
|
func (p *parser) alertStmt() *AlertStmt {
|
||||||
|
@ -384,8 +384,8 @@ func (p *parser) alertStmt() *AlertStmt {
|
||||||
}
|
}
|
||||||
|
|
||||||
lset := model.LabelSet{}
|
lset := model.LabelSet{}
|
||||||
if p.peek().typ == itemWith {
|
if p.peek().typ == itemLabels {
|
||||||
p.expect(itemWith, ctx)
|
p.expect(itemLabels, ctx)
|
||||||
lset = p.labelSet()
|
lset = p.labelSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1149,7 +1149,8 @@ var testStatement = []struct {
|
||||||
dc:http_request:rate5m = sum(rate(http_request_count[5m])) by (dc)
|
dc:http_request:rate5m = sum(rate(http_request_count[5m])) by (dc)
|
||||||
|
|
||||||
# A simple test alerting rule.
|
# A simple test alerting rule.
|
||||||
ALERT GlobalRequestRateLow IF(dc:http_request:rate5m < 10000) FOR 5m WITH {
|
ALERT GlobalRequestRateLow IF(dc:http_request:rate5m < 10000) FOR 5m
|
||||||
|
LABELS {
|
||||||
service = "testservice"
|
service = "testservice"
|
||||||
# ... more fields here ...
|
# ... more fields here ...
|
||||||
}
|
}
|
||||||
|
@ -1284,7 +1285,8 @@ var testStatement = []struct {
|
||||||
}, {
|
}, {
|
||||||
input: `
|
input: `
|
||||||
# A simple test alerting rule.
|
# A simple test alerting rule.
|
||||||
ALERT GlobalRequestRateLow IF(dc:http_request:rate5m < 10000) FOR 5 WITH {
|
ALERT GlobalRequestRateLow IF(dc:http_request:rate5m < 10000) FOR 5
|
||||||
|
LABELS {
|
||||||
service = "testservice"
|
service = "testservice"
|
||||||
# ... more fields here ...
|
# ... more fields here ...
|
||||||
}
|
}
|
||||||
|
@ -1332,7 +1334,7 @@ var testStatement = []struct {
|
||||||
input: `foo{a!~"b"} = bar`,
|
input: `foo{a!~"b"} = bar`,
|
||||||
fail: true,
|
fail: true,
|
||||||
}, {
|
}, {
|
||||||
input: `ALERT SomeName IF time() WITH {}
|
input: `ALERT SomeName IF time() LABELS {}
|
||||||
SUMMARY "Global request rate low"
|
SUMMARY "Global request rate low"
|
||||||
DESCRIPTION "The global request rate is low"
|
DESCRIPTION "The global request rate is low"
|
||||||
`,
|
`,
|
||||||
|
|
Loading…
Reference in a new issue