Skip to content

Commit

Permalink
Move default ratelimit to init
Browse files Browse the repository at this point in the history
  • Loading branch information
tmonk42 committed Aug 30, 2016
1 parent ca49bab commit 7d8de4b
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions plugins/inputs/cloudwatch/cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ func (c *CloudWatch) Description() string {
}

func (c *CloudWatch) Gather(acc telegraf.Accumulator) error {
c.setDefaultValues()

if c.client == nil {
c.initializeCloudWatch()
}
Expand Down Expand Up @@ -199,17 +197,12 @@ func (c *CloudWatch) Gather(acc telegraf.Accumulator) error {
return errChan.Error()
}

func (c *CloudWatch) setDefaultValues() {
if c.RateLimit == 0 {
c.RateLimit = 10
}
}

func init() {
inputs.Add("cloudwatch", func() telegraf.Input {
ttl, _ := time.ParseDuration("1hr")
return &CloudWatch{
CacheTTL: internal.Duration{Duration: ttl},
CacheTTL: internal.Duration{Duration: ttl},
RateLimit: 10,
}
})
}
Expand Down

0 comments on commit 7d8de4b

Please sign in to comment.