mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
Restore previous behavior where spaces between label terms are acceptable in Promparse
Signed-off-by: Owen Williams <owen.williams@grafana.com>
This commit is contained in:
parent
ac4e978816
commit
cabfa6d274
|
@ -442,12 +442,11 @@ func (p *PromParser) parseLVals() error {
|
|||
// and last character.
|
||||
p.offsets = append(p.offsets, p.l.start+1, p.l.i-1)
|
||||
|
||||
// Free trailing commas are allowed.
|
||||
t = p.nextToken()
|
||||
if t == tComma {
|
||||
// Free trailing commas are allowed. NOTE: this allows spaces between label
|
||||
// names, unlike in OpenMetrics. It is not clear if this is intended or an
|
||||
// accidental bug.
|
||||
if t = p.nextToken(); t == tComma {
|
||||
t = p.nextToken()
|
||||
} else if t != tBraceClose {
|
||||
return p.parseError("expected comma or brace close", t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ go_gc_duration_seconds{ quantile="1.0", a="b" } 8.3835e-05
|
|||
go_gc_duration_seconds { quantile="1.0", a="b" } 8.3835e-05
|
||||
go_gc_duration_seconds { quantile= "1.0", a= "b", } 8.3835e-05
|
||||
go_gc_duration_seconds { quantile = "1.0", a = "b" } 8.3835e-05
|
||||
go_gc_duration_seconds { quantile = "2.0" a = "b" } 8.3835e-05
|
||||
go_gc_duration_seconds_count 99
|
||||
some:aggregate:rate5m{a_b="c"} 1
|
||||
# HELP go_goroutines Number of goroutines that currently exist.
|
||||
|
@ -129,6 +130,11 @@ testmetric{label="\"bar\""} 1`
|
|||
m: `go_gc_duration_seconds { quantile = "1.0", a = "b" }`,
|
||||
v: 8.3835e-05,
|
||||
lset: labels.FromStrings("__name__", "go_gc_duration_seconds", "quantile", "1.0", "a", "b"),
|
||||
}, {
|
||||
// NOTE: Unlike OpenMetrics, Promparse allows spaces between label terms. This appears to be unintended and should probably be fixed.
|
||||
m: `go_gc_duration_seconds { quantile = "2.0" a = "b" }`,
|
||||
v: 8.3835e-05,
|
||||
lset: labels.FromStrings("__name__", "go_gc_duration_seconds", "quantile", "2.0", "a", "b"),
|
||||
}, {
|
||||
m: `go_gc_duration_seconds_count`,
|
||||
v: 99,
|
||||
|
|
Loading…
Reference in a new issue