Log no metrics found at debug level in cloudwatch input (#6665)

This commit is contained in:
Daniel Nelson 2019-11-15 18:52:55 -08:00 committed by GitHub
parent 122ec0fa39
commit 7a90ddd1b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -111,7 +111,7 @@ func (ac *accumulator) AddError(err error) {
return
}
NErrors.Incr(1)
log.Printf("D! [%s] Error in plugin: %v", ac.maker.LogName(), err)
log.Printf("E! [%s] Error in plugin: %v", ac.maker.LogName(), err)
}
func (ac *accumulator) SetPrecision(precision time.Duration) {

View File

@ -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 {