Skip to content

Commit

Permalink
Cloudwatch isSelected checks metric name
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-barrett committed Nov 7, 2016
1 parent 6f219eb commit b5babc9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/inputs/cloudwatch/cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit b5babc9

Please sign in to comment.