Merge pull request #4320 from parisholley/newengineEmpty

support events with missing tag data
pull/4308/head
Paul Dix 2015-10-04 15:58:30 -04:00
commit 851a53fd70
2 changed files with 20 additions and 1 deletions

View File

@ -1017,6 +1017,10 @@ func (p *point) Tags() Tags {
i, key = scanTo(p.key, i, '=')
i, value = scanTagValue(p.key, i+1)
if len(value) == 0 {
continue
}
tags[string(unescapeTag(key))] = string(unescapeTag(value))
i += 1
@ -1137,7 +1141,10 @@ func (t Tags) HashKey() []byte {
for k, v := range t {
ek := escapeTag([]byte(k))
ev := escapeTag([]byte(v))
escaped[string(ek)] = string(ev)
if len(string(ev)) > 0 {
escaped[string(ek)] = string(ev)
}
}
// Extract keys and determine final size.

View File

@ -599,6 +599,18 @@ func TestParsePointUnescape(t *testing.T) {
},
time.Unix(0, 0)))
// tag with no value
test(t, `cpu,regions=east value="1"`,
models.NewPoint("cpu",
models.Tags{
"regions": "east",
"foobar": "",
},
models.Fields{
"value": "1",
},
time.Unix(0, 0)))
// commas in field values
test(t, `cpu,regions=east value="1,0"`,
models.NewPoint("cpu",