do not include empty tags in hash
parent
d9f94bdeeb
commit
36898f9451
|
@ -1021,6 +1021,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
|
||||
|
@ -1141,7 +1145,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.
|
||||
|
|
|
@ -605,6 +605,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",
|
||||
|
|
Loading…
Reference in New Issue