From 69afb140adef20831a54f6cf61470046fadd0ec6 Mon Sep 17 00:00:00 2001 From: n2N8Z Date: Wed, 1 Dec 2021 17:49:59 +0100 Subject: [PATCH] fix: resolve #10027 (#10112) --- plugins/inputs/cloudwatch/cloudwatch.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/inputs/cloudwatch/cloudwatch.go b/plugins/inputs/cloudwatch/cloudwatch.go index 17305f31c93a6..bf0ab65bf3b8c 100644 --- a/plugins/inputs/cloudwatch/cloudwatch.go +++ b/plugins/inputs/cloudwatch/cloudwatch.go @@ -477,7 +477,7 @@ func (c *CloudWatch) getDataQueries(filteredMetrics []filteredMetric) map[string Id: aws.String("average_" + id), Label: aws.String(snakeCase(*metric.MetricName + "_average")), MetricStat: &types.MetricStat{ - Metric: &metric, + Metric: &filtered.metrics[j], Period: aws.Int32(int32(time.Duration(c.Period).Seconds())), Stat: aws.String(StatisticAverage), }, @@ -489,7 +489,7 @@ func (c *CloudWatch) getDataQueries(filteredMetrics []filteredMetric) map[string Id: aws.String("maximum_" + id), Label: aws.String(snakeCase(*metric.MetricName + "_maximum")), MetricStat: &types.MetricStat{ - Metric: &metric, + Metric: &filtered.metrics[j], Period: aws.Int32(int32(time.Duration(c.Period).Seconds())), Stat: aws.String(StatisticMaximum), }, @@ -501,7 +501,7 @@ func (c *CloudWatch) getDataQueries(filteredMetrics []filteredMetric) map[string Id: aws.String("minimum_" + id), Label: aws.String(snakeCase(*metric.MetricName + "_minimum")), MetricStat: &types.MetricStat{ - Metric: &metric, + Metric: &filtered.metrics[j], Period: aws.Int32(int32(time.Duration(c.Period).Seconds())), Stat: aws.String(StatisticMinimum), }, @@ -513,7 +513,7 @@ func (c *CloudWatch) getDataQueries(filteredMetrics []filteredMetric) map[string Id: aws.String("sum_" + id), Label: aws.String(snakeCase(*metric.MetricName + "_sum")), MetricStat: &types.MetricStat{ - Metric: &metric, + Metric: &filtered.metrics[j], Period: aws.Int32(int32(time.Duration(c.Period).Seconds())), Stat: aws.String(StatisticSum), }, @@ -525,7 +525,7 @@ func (c *CloudWatch) getDataQueries(filteredMetrics []filteredMetric) map[string Id: aws.String("sample_count_" + id), Label: aws.String(snakeCase(*metric.MetricName + "_sample_count")), MetricStat: &types.MetricStat{ - Metric: &metric, + Metric: &filtered.metrics[j], Period: aws.Int32(int32(time.Duration(c.Period).Seconds())), Stat: aws.String(StatisticSampleCount), },