mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
Merge pull request #1344 from prometheus/consistent-error-message
Rename matrix to range selector in external error messages
This commit is contained in:
commit
4dc8c4f94c
|
@ -609,19 +609,20 @@ func (p *parser) unaryExpr() Expr {
|
|||
case *MatrixSelector:
|
||||
s.Offset = offset
|
||||
default:
|
||||
p.errorf("offset modifier must be preceded by a metric or range selector, but follows a %T instead", e)
|
||||
p.errorf("offset modifier must be preceded by an instant or range selector, but follows a %T instead", e)
|
||||
}
|
||||
}
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
// rangeSelector parses a matrix selector based on a given vector selector.
|
||||
// rangeSelector parses a matrix (a.k.a. range) selector based on a given
|
||||
// vector selector.
|
||||
//
|
||||
// <vector_selector> '[' <duration> ']'
|
||||
//
|
||||
func (p *parser) rangeSelector(vs *VectorSelector) *MatrixSelector {
|
||||
const ctx = "matrix selector"
|
||||
const ctx = "range selector"
|
||||
p.next()
|
||||
|
||||
var erange time.Duration
|
||||
|
@ -948,7 +949,7 @@ func (p *parser) offset() time.Duration {
|
|||
return offset
|
||||
}
|
||||
|
||||
// vectorSelector parses a new vector selector.
|
||||
// vectorSelector parses a new (instant) vector selector.
|
||||
//
|
||||
// <metric_identifier> [<label_matchers>]
|
||||
// [<metric_identifier>] <label_matchers>
|
||||
|
|
|
@ -228,6 +228,10 @@ var testExpr = []struct {
|
|||
input: `*test`,
|
||||
fail: true,
|
||||
errMsg: "no valid expression found",
|
||||
}, {
|
||||
input: "1 offset 1d",
|
||||
fail: true,
|
||||
errMsg: "offset modifier must be preceded by an instant or range selector",
|
||||
},
|
||||
// Vector binary operations.
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue