Skip to content

Commit 08a11aa

Browse files
committed
Update comments and flag name
1 parent 93ac576 commit 08a11aa

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

plugins/outputs/cloudwatch/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ Examples include but are not limited to:
3737

3838
The namespace used for AWS CloudWatch metrics.
3939

40-
### enable_statistic_values
41-
42-
If you have a large amount of metrics, you should consider to send
43-
statistic values instead of raw metrics. This would not only improve
44-
performance but also save AWS API cost. Use `basicstats` aggregator to
45-
calculate those required statistic fields (count, min, max, and sum).
46-
[See Cloudwatch StatisticSet](https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatch/#StatisticSet).
47-
This plugin would try to parse those statistic fields and send to Cloudwatch.
40+
### write_statistics
41+
42+
If you have a large amount of metrics, you should consider to send statistic
43+
values instead of raw metrics which could not only improve performance but
44+
also save AWS API cost. If enable this flag, this plugin would parse the required
45+
[CloudWatch statistic fields](https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatch/#StatisticSet)
46+
(count, min, max, and sum) and send them to CloudWatch. You could use `basicstats`
47+
aggregator to calculate those fields. If not all statistic fields are available,
48+
all fields would still be sent as raw metrics.

plugins/outputs/cloudwatch/cloudwatch.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

3434
type 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

7373
func (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

Comments
 (0)