Skip to content
Snippets Groups Projects
Commit ca49babf authored by Nathan Haneysmith's avatar Nathan Haneysmith
Browse files

set a default value of 10 for ratelimit

parent 0589a1d0
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ API endpoint. In the following order the plugin will attempt to authenticate.
## Maximum requests per second. Note that the global default AWS rate limit is
## 10 reqs/sec, so if you define multiple namespaces, these should add up to a
## maximum of 10.
## maximum of 10. Optional - default value is 10.
ratelimit = 10
## Metrics to Pull (optional)
......
......@@ -99,7 +99,7 @@ func (c *CloudWatch) SampleConfig() string {
## Maximum requests per second. Note that the global default AWS rate limit is
## 10 reqs/sec, so if you define multiple namespaces, these should add up to a
## maximum of 10.
## maximum of 10. Optional - default value is 10.
ratelimit = 10
## Metrics to Pull (optional)
......@@ -120,6 +120,8 @@ func (c *CloudWatch) Description() string {
}
func (c *CloudWatch) Gather(acc telegraf.Accumulator) error {
c.setDefaultValues()
if c.client == nil {
c.initializeCloudWatch()
}
......@@ -197,6 +199,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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment