From 7d8de4b8e116da357e31cdeaa79ed82fd210ab34 Mon Sep 17 00:00:00 2001
From: Nathan Haneysmith <nathan@chef.io>
Date: Tue, 30 Aug 2016 14:33:51 -0700
Subject: [PATCH] Move default ratelimit to init

---
 plugins/inputs/cloudwatch/cloudwatch.go | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/plugins/inputs/cloudwatch/cloudwatch.go b/plugins/inputs/cloudwatch/cloudwatch.go
index d334f82d..ebc4147d 100644
--- a/plugins/inputs/cloudwatch/cloudwatch.go
+++ b/plugins/inputs/cloudwatch/cloudwatch.go
@@ -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()
 	}
@@ -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,
 		}
 	})
 }
-- 
GitLab