don't overwrite host tags in plugins

closes #1227
closes #1210
This commit is contained in:
Cameron Sparr
2016-05-19 10:01:19 +01:00
parent 35eb65460d
commit 2e68bd1412
2 changed files with 10 additions and 5 deletions

View File

@@ -84,13 +84,17 @@ func (ac *accumulator) AddFields(
if tags == nil {
tags = make(map[string]string)
}
// Apply daemon-wide tags if set
for k, v := range ac.defaultTags {
tags[k] = v
}
// Apply plugin-wide tags if set
for k, v := range ac.inputConfig.Tags {
tags[k] = v
if _, ok := tags[k]; !ok {
tags[k] = v
}
}
// Apply daemon-wide tags if set
for k, v := range ac.defaultTags {
if _, ok := tags[k]; !ok {
tags[k] = v
}
}
ac.inputConfig.Filter.FilterTags(tags)