Fix for tags in the config not being applied to the agent.
fixes #302 closes #308
This commit is contained in:
parent
c8852339c9
commit
2007064c47
|
@ -48,6 +48,7 @@ of metrics collected and from how many plugins.
|
||||||
- [#264](https://github.com/influxdb/telegraf/issues/264): logrotate config file fixes. Thanks @linsomniac!
|
- [#264](https://github.com/influxdb/telegraf/issues/264): logrotate config file fixes. Thanks @linsomniac!
|
||||||
- [#290](https://github.com/influxdb/telegraf/issues/290): Fix some plugins sending their values as strings.
|
- [#290](https://github.com/influxdb/telegraf/issues/290): Fix some plugins sending their values as strings.
|
||||||
- [#289](https://github.com/influxdb/telegraf/issues/289): Fix accumulator panic on nil tags.
|
- [#289](https://github.com/influxdb/telegraf/issues/289): Fix accumulator panic on nil tags.
|
||||||
|
- [#302](https://github.com/influxdb/telegraf/issues/302): Fix `[tags]` getting applied, thanks @gotyaoi!
|
||||||
|
|
||||||
## v0.1.9 [2015-09-22]
|
## v0.1.9 [2015-09-22]
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import (
|
||||||
// specified
|
// specified
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// This lives outside the agent because mergeStruct doesn't need to handle maps normally.
|
// This lives outside the agent because mergeStruct doesn't need to handle maps normally.
|
||||||
// We just copy the elements manually in applyAgent.
|
// We just copy the elements manually in ApplyAgent.
|
||||||
Tags map[string]string
|
Tags map[string]string
|
||||||
|
|
||||||
agent *Agent
|
agent *Agent
|
||||||
|
@ -129,11 +129,11 @@ func (c *Config) ApplyOutput(name string, v interface{}) error {
|
||||||
// Overrides only values in the given struct that were set in the config.
|
// Overrides only values in the given struct that were set in the config.
|
||||||
func (c *Config) ApplyAgent(a *Agent) error {
|
func (c *Config) ApplyAgent(a *Agent) error {
|
||||||
if c.agent != nil {
|
if c.agent != nil {
|
||||||
return mergeStruct(a, c.agent, c.agentFieldsSet)
|
|
||||||
}
|
|
||||||
for key, value := range c.Tags {
|
for key, value := range c.Tags {
|
||||||
a.Tags[key] = value
|
a.Tags[key] = value
|
||||||
}
|
}
|
||||||
|
return mergeStruct(a, c.agent, c.agentFieldsSet)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,6 @@ func (s *MergeStructSuite) TestFullMerge() {
|
||||||
s.T().Error(err)
|
s.T().Error(err)
|
||||||
}
|
}
|
||||||
s.Equal(result, s.FullStruct, fmt.Sprintf("Full merge of %v onto FullStruct failed.", s.AnotherFullStruct))
|
s.Equal(result, s.FullStruct, fmt.Sprintf("Full merge of %v onto FullStruct failed.", s.AnotherFullStruct))
|
||||||
s.T().Log("hi")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MergeStructSuite) TestPartialMergeWithoutSlices() {
|
func (s *MergeStructSuite) TestPartialMergeWithoutSlices() {
|
||||||
|
|
Loading…
Reference in New Issue