mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-09 15:27:11 +00:00
lib/protoparser/prometheus: skip leading whitespace from tag names
This commit is contained in:
parent
e7ba18b0d9
commit
71a52f5f90
2 changed files with 27 additions and 2 deletions
|
@ -236,7 +236,7 @@ func unmarshalTags(dst []Tag, s string, noEscapes bool) (string, []Tag, error) {
|
||||||
if len(s) == 0 || s[0] != ',' {
|
if len(s) == 0 || s[0] != ',' {
|
||||||
return s, dst, fmt.Errorf("missing comma after tag %s=%q", key, value)
|
return s, dst, fmt.Errorf("missing comma after tag %s=%q", key, value)
|
||||||
}
|
}
|
||||||
s = s[1:]
|
s = skipLeadingWhitespace(s[1:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,7 @@ func TestRowsUnmarshalSuccess(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Multi lines with invalid line
|
// Multi lines with invalid line
|
||||||
f("\t foo\t {} 0.3\t 2\naaa\n bar.baz 0.34 43\n", &Rows{
|
f("\t foo\t { } 0.3\t 2\naaa\n bar.baz 0.34 43\n", &Rows{
|
||||||
Rows: []Row{
|
Rows: []Row{
|
||||||
{
|
{
|
||||||
Metric: "foo",
|
Metric: "foo",
|
||||||
|
@ -267,4 +267,29 @@ func TestRowsUnmarshalSuccess(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Spaces around tags
|
||||||
|
f(`vm_accounting { name="vminsertRows", accountID = "1" , projectID= "1" } 277779100`, &Rows{
|
||||||
|
Rows: []Row{
|
||||||
|
{
|
||||||
|
Metric: "vm_accounting",
|
||||||
|
Tags: []Tag{
|
||||||
|
{
|
||||||
|
Key: "name",
|
||||||
|
Value: "vminsertRows",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "accountID",
|
||||||
|
Value: "1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "projectID",
|
||||||
|
Value: "1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Value: 277779100,
|
||||||
|
Timestamp: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue