Don't allow inputs to overwrite host tag

closes #1054

This affects tags in the following plugins:

- cassandra
- disque
- rethinkdb
This commit is contained in:
Cameron Sparr
2016-04-18 18:12:58 -06:00
parent 46aaaa9b70
commit 9aec58c6b8
7 changed files with 38 additions and 51 deletions

View File

@@ -84,17 +84,13 @@ func (ac *accumulator) AddFields(
if tags == nil {
tags = make(map[string]string)
}
// Apply plugin-wide tags if set
for k, v := range ac.inputConfig.Tags {
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
}
tags[k] = v
}
// Apply plugin-wide tags if set
for k, v := range ac.inputConfig.Tags {
tags[k] = v
}
ac.inputConfig.Filter.FilterTags(tags)