From b5babc9dc7914fdf66afad87e89ffefa00fe84de Mon Sep 17 00:00:00 2001 From: Leon Barrett Date: Mon, 7 Nov 2016 10:53:00 -0800 Subject: [PATCH] Cloudwatch isSelected checks metric name --- plugins/inputs/cloudwatch/cloudwatch.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/cloudwatch/cloudwatch.go b/plugins/inputs/cloudwatch/cloudwatch.go index 962496fb1384d..2ede330bdd1b7 100644 --- a/plugins/inputs/cloudwatch/cloudwatch.go +++ b/plugins/inputs/cloudwatch/cloudwatch.go @@ -149,7 +149,7 @@ func SelectMetrics(c *CloudWatch) ([]*cloudwatch.Metric, error) { } for _, name := range m.MetricNames { for _, metric := range allMetrics { - if name == *metric.MetricName && isSelected(metric, m.Dimensions) { + if isSelected(name, metric, m.Dimensions) { metrics = append(metrics, &cloudwatch.Metric{ Namespace: aws.String(c.Namespace), MetricName: aws.String(name), @@ -381,7 +381,10 @@ func hasWilcard(dimensions []*Dimension) bool { return false } -func isSelected(metric *cloudwatch.Metric, dimensions []*Dimension) bool { +func isSelected(name string, metric *cloudwatch.Metric, dimensions []*Dimension) bool { + if name != *metric.MetricName { + return false + } if len(metric.Dimensions) != len(dimensions) { return false }