mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08: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)
|
l.offsets = append(l.offsets, l.i)
|
||||||
|
|
||||||
<lstateLabels>[ \t]+
|
<lstateLabels>[ \t]+
|
||||||
<lstateLabels>\} s = lstateValue
|
<lstateLabels>,?\} s = lstateValue
|
||||||
l.mend = l.i
|
l.mend = l.i
|
||||||
<lstateLabels>,? s = lstateLName
|
<lstateLabels>,? s = lstateLName
|
||||||
l.offsets = append(l.offsets, l.i)
|
l.offsets = append(l.offsets, l.i)
|
||||||
|
|
|
@ -264,7 +264,12 @@ yystate20:
|
||||||
|
|
||||||
yystate21:
|
yystate21:
|
||||||
c = l.next()
|
c = l.next()
|
||||||
|
switch {
|
||||||
|
default:
|
||||||
goto yyrule8
|
goto yyrule8
|
||||||
|
case c == '}':
|
||||||
|
goto yystate22
|
||||||
|
}
|
||||||
|
|
||||||
yystate22:
|
yystate22:
|
||||||
c = l.next()
|
c = l.next()
|
||||||
|
@ -391,7 +396,7 @@ yyrule5: // {S}({M}|{D})*
|
||||||
yyrule6: // [ \t]+
|
yyrule6: // [ \t]+
|
||||||
|
|
||||||
goto yystate0
|
goto yystate0
|
||||||
yyrule7: // \}
|
yyrule7: // ,?\}
|
||||||
{
|
{
|
||||||
s = lstateValue
|
s = lstateValue
|
||||||
l.mend = l.i
|
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.
|
input := `# HELP go_gc_duration_seconds A summary of the GC invocation durations.
|
||||||
# TYPE go_gc_duration_seconds summary
|
# TYPE go_gc_duration_seconds summary
|
||||||
go_gc_duration_seconds{quantile="0"} 4.9351e-05
|
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{quantile="0.5",a="b"} 8.3835e-05
|
||||||
go_gc_duration_seconds_count 99
|
go_gc_duration_seconds_count 99
|
||||||
some:aggregate:rate5m{a_b="c"} 1
|
some:aggregate:rate5m{a_b="c"} 1
|
||||||
|
@ -52,7 +52,7 @@ go_goroutines 33 123123`
|
||||||
v: 4.9351e-05,
|
v: 4.9351e-05,
|
||||||
lset: labels.FromStrings("__name__", "go_gc_duration_seconds", "quantile", "0"),
|
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,
|
v: 7.424100000000001e-05,
|
||||||
lset: labels.FromStrings("__name__", "go_gc_duration_seconds", "quantile", "0.25"),
|
lset: labels.FromStrings("__name__", "go_gc_duration_seconds", "quantile", "0.25"),
|
||||||
}, {
|
}, {
|
||||||
|
|
Loading…
Reference in a new issue