mirror of
https://github.com/prometheus/prometheus
synced 2024-12-26 00:23:18 +00:00
pkg/textparse: handle trailing labels comma (#2752)
This commit is contained in:
parent
10cccd2e45
commit
ea09299ca5
@ -73,7 +73,7 @@ M [a-zA-Z_:]
|
||||
l.offsets = append(l.offsets, l.i)
|
||||
|
||||
<lstateLabels>[ \t]+
|
||||
<lstateLabels>\} s = lstateValue
|
||||
<lstateLabels>,?\} s = lstateValue
|
||||
l.mend = l.i
|
||||
<lstateLabels>,? s = lstateLName
|
||||
l.offsets = append(l.offsets, l.i)
|
||||
|
@ -264,7 +264,12 @@ yystate20:
|
||||
|
||||
yystate21:
|
||||
c = l.next()
|
||||
goto yyrule8
|
||||
switch {
|
||||
default:
|
||||
goto yyrule8
|
||||
case c == '}':
|
||||
goto yystate22
|
||||
}
|
||||
|
||||
yystate22:
|
||||
c = l.next()
|
||||
@ -391,7 +396,7 @@ yyrule5: // {S}({M}|{D})*
|
||||
yyrule6: // [ \t]+
|
||||
|
||||
goto yystate0
|
||||
yyrule7: // \}
|
||||
yyrule7: // ,?\}
|
||||
{
|
||||
s = lstateValue
|
||||
l.mend = l.i
|
||||
|
@ -31,7 +31,7 @@ func TestParse(t *testing.T) {
|
||||
input := `# HELP go_gc_duration_seconds A summary of the GC invocation durations.
|
||||
# TYPE go_gc_duration_seconds summary
|
||||
go_gc_duration_seconds{quantile="0"} 4.9351e-05
|
||||
go_gc_duration_seconds{quantile="0.25"} 7.424100000000001e-05
|
||||
go_gc_duration_seconds{quantile="0.25",} 7.424100000000001e-05
|
||||
go_gc_duration_seconds{quantile="0.5",a="b"} 8.3835e-05
|
||||
go_gc_duration_seconds_count 99
|
||||
some:aggregate:rate5m{a_b="c"} 1
|
||||
@ -52,7 +52,7 @@ go_goroutines 33 123123`
|
||||
v: 4.9351e-05,
|
||||
lset: labels.FromStrings("__name__", "go_gc_duration_seconds", "quantile", "0"),
|
||||
}, {
|
||||
m: `go_gc_duration_seconds{quantile="0.25"}`,
|
||||
m: `go_gc_duration_seconds{quantile="0.25",}`,
|
||||
v: 7.424100000000001e-05,
|
||||
lset: labels.FromStrings("__name__", "go_gc_duration_seconds", "quantile", "0.25"),
|
||||
}, {
|
||||
|
Loading…
Reference in New Issue
Block a user