Move default ratelimit to init

This commit is contained in:
Nathan Haneysmith 2016-08-30 14:33:51 -07:00 committed by Jack Zampolin
parent 5b52bd076f
commit 9aebad4a72
1 changed files with 2 additions and 9 deletions

View File

@ -120,8 +120,6 @@ func (c *CloudWatch) Description() string {
} }
func (c *CloudWatch) Gather(acc telegraf.Accumulator) error { func (c *CloudWatch) Gather(acc telegraf.Accumulator) error {
c.setDefaultValues()
if c.client == nil { if c.client == nil {
c.initializeCloudWatch() c.initializeCloudWatch()
} }
@ -199,17 +197,12 @@ func (c *CloudWatch) Gather(acc telegraf.Accumulator) error {
return errChan.Error() return errChan.Error()
} }
func (c *CloudWatch) setDefaultValues() {
if c.RateLimit == 0 {
c.RateLimit = 10
}
}
func init() { func init() {
inputs.Add("cloudwatch", func() telegraf.Input { inputs.Add("cloudwatch", func() telegraf.Input {
ttl, _ := time.ParseDuration("1hr") ttl, _ := time.ParseDuration("1hr")
return &CloudWatch{ return &CloudWatch{
CacheTTL: internal.Duration{Duration: ttl}, CacheTTL: internal.Duration{Duration: ttl},
RateLimit: 10,
} }
}) })
} }