Don't add tags with empty values to opentsdb output (#4751)

This commit is contained in:
Greg 2018-09-26 20:26:23 -06:00 committed by Daniel Nelson
parent d70c80722d
commit 2e2e998ebd
1 changed files with 4 additions and 1 deletions

View File

@ -213,7 +213,10 @@ func (o *OpenTSDB) WriteTelnet(metrics []telegraf.Metric, u *url.URL) error {
func cleanTags(tags map[string]string) map[string]string {
tagSet := make(map[string]string, len(tags))
for k, v := range tags {
tagSet[sanitize(k)] = sanitize(v)
val := sanitize(v)
if val != "" {
tagSet[sanitize(k)] = val
}
}
return tagSet
}