Log no metrics found at debug level in cloudwatch input (#6665)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package cloudwatch
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -12,7 +11,6 @@ import (
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/cloudwatch"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/filter"
|
||||
"github.com/influxdata/telegraf/internal"
|
||||
@@ -44,6 +42,8 @@ type (
|
||||
CacheTTL internal.Duration `toml:"cache_ttl"`
|
||||
RateLimit int `toml:"ratelimit"`
|
||||
|
||||
Log telegraf.Logger `toml:"-"`
|
||||
|
||||
client cloudwatchClient
|
||||
statFilter filter.Filter
|
||||
metricCache *metricCache
|
||||
@@ -197,6 +197,10 @@ func (c *CloudWatch) Gather(acc telegraf.Accumulator) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(queries) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Limit concurrency or we can easily exhaust user connection limit.
|
||||
// See cloudwatch API request limits:
|
||||
// http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_limits.html
|
||||
@@ -481,7 +485,8 @@ func (c *CloudWatch) getDataQueries(filteredMetrics []filteredMetric) ([]*cloudw
|
||||
}
|
||||
|
||||
if len(dataQueries) == 0 {
|
||||
return nil, errors.New("no metrics found to collect")
|
||||
c.Log.Debug("no metrics found to collect")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if c.metricCache == nil {
|
||||
|
||||
Reference in New Issue
Block a user