parent
213082441e
commit
7490053b7a
|
@ -648,6 +648,15 @@ func scanTags(buf []byte, i int, indices []int) (int, int, []int, error) {
|
|||
case tagValueState:
|
||||
state, i, err = scanTagsValue(buf, i)
|
||||
case fieldsState:
|
||||
// Grow our indices slice if we had exactly enough tags to fill it
|
||||
if commas >= len(indices) {
|
||||
// The parser is in `fieldsState`, so there are no more
|
||||
// tags. We only need 1 more entry in the slice to store
|
||||
// the final entry.
|
||||
newIndics := make([]int, cap(indices)+1)
|
||||
copy(newIndics, indices)
|
||||
indices = newIndics
|
||||
}
|
||||
indices[commas] = i + 1
|
||||
return i, commas, indices, nil
|
||||
}
|
||||
|
|
|
@ -1243,6 +1243,17 @@ func TestParsePointWithDuplicateTags(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestParsePointWithVariousTags(t *testing.T) {
|
||||
line := "m"
|
||||
for i := 0; i < 1000; i++ {
|
||||
line += fmt.Sprintf(",t%d=x", i+1)
|
||||
_, err := models.ParsePointsString(line + " v=0")
|
||||
if err != nil {
|
||||
t.Errorf(`ParsePoints("%s") failed`, line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestParsePointWithStringField(t *testing.T) {
|
||||
test(t, `cpu,host=serverA,region=us-east value=1.0,str="foo",str2="bar" 1000000000`,
|
||||
NewTestPoint("cpu",
|
||||
|
|
Loading…
Reference in New Issue