@@ -28,7 +28,7 @@ type CloudWatch struct {
2828 Namespace string `toml:"namespace"` // CloudWatch Metrics Namespace
2929 svc * cloudwatch.CloudWatch
3030
31- EnableStatisticValues bool `toml:"enable_statistic_values "`
31+ WriteStatistics bool `toml:"write_statistics "`
3232}
3333
3434type statisticSet struct {
@@ -61,13 +61,13 @@ var sampleConfig = `
6161 ## Namespace for the CloudWatch MetricDatums
6262 namespace = "InfluxData/Telegraf"
6363
64- ## If you have a large amount of metrics, you should consider to send
65- ## statistic values instead of raw metrics. This would not only improve
66- ## performance but also save AWS API cost. Use basicstats aggregator to
67- ## calculate required statistic fields (count, min, max, and sum) and
68- ## enable this flag. This plugin would try to parse those fields and
69- ## send statistic values to Cloudwatch.
70- # enable_statistic_values = false
64+ ## If you have a large amount of metrics, you should consider to send statistic
65+ ## values instead of raw metrics which could not only improve performance but
66+ ## also save AWS API cost. If enable this flag, this plugin would parse the required
67+ ## CloudWatch statistic fields (count, min, max, and sum) and send them to CloudWatch.
68+ ## You could use basicstats aggregator to calculate those fields. If not all statistic
69+ ## fields are available, all fields would still be sent as raw metrics.
70+ # write_statistics = false
7171`
7272
7373func (c * CloudWatch ) SampleConfig () string {
@@ -114,7 +114,7 @@ func (c *CloudWatch) Write(metrics []telegraf.Metric) error {
114114
115115 var datums []* cloudwatch.MetricDatum
116116 for _ , m := range metrics {
117- d := BuildMetricDatum (m )
117+ d := BuildMetricDatum (c . WriteStatistics , m )
118118 datums = append (datums , d ... )
119119 }
120120
0 commit comments