set a default value of 10 for ratelimit
This commit is contained in:
parent
0589a1d0a5
commit
ca49babf3a
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue