Skip to content

Commit

Permalink
Update comments and flag name
Browse files Browse the repository at this point in the history
  • Loading branch information
david7482 committed Jul 23, 2018
1 parent 93ac576 commit 08a11aa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
17 changes: 9 additions & 8 deletions plugins/outputs/cloudwatch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ Examples include but are not limited to:

The namespace used for AWS CloudWatch metrics.

### enable_statistic_values

If you have a large amount of metrics, you should consider to send
statistic values instead of raw metrics. This would not only improve
performance but also save AWS API cost. Use `basicstats` aggregator to
calculate those required statistic fields (count, min, max, and sum).
[See Cloudwatch StatisticSet](https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatch/#StatisticSet).
This plugin would try to parse those statistic fields and send to Cloudwatch.
### write_statistics

If you have a large amount of metrics, you should consider to send statistic
values instead of raw metrics which could not only improve performance but
also save AWS API cost. If enable this flag, this plugin would parse the required
[CloudWatch statistic fields](https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatch/#StatisticSet)
(count, min, max, and sum) and send them to CloudWatch. You could use `basicstats`
aggregator to calculate those fields. If not all statistic fields are available,
all fields would still be sent as raw metrics.
18 changes: 9 additions & 9 deletions plugins/outputs/cloudwatch/cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type CloudWatch struct {
Namespace string `toml:"namespace"` // CloudWatch Metrics Namespace
svc *cloudwatch.CloudWatch

EnableStatisticValues bool `toml:"enable_statistic_values"`
WriteStatistics bool `toml:"write_statistics"`
}

type statisticSet struct {
Expand Down Expand Up @@ -61,13 +61,13 @@ var sampleConfig = `
## Namespace for the CloudWatch MetricDatums
namespace = "InfluxData/Telegraf"
## If you have a large amount of metrics, you should consider to send
## statistic values instead of raw metrics. This would not only improve
## performance but also save AWS API cost. Use basicstats aggregator to
## calculate required statistic fields (count, min, max, and sum) and
## enable this flag. This plugin would try to parse those fields and
## send statistic values to Cloudwatch.
# enable_statistic_values = false
## If you have a large amount of metrics, you should consider to send statistic
## values instead of raw metrics which could not only improve performance but
## also save AWS API cost. If enable this flag, this plugin would parse the required
## CloudWatch statistic fields (count, min, max, and sum) and send them to CloudWatch.
## You could use basicstats aggregator to calculate those fields. If not all statistic
## fields are available, all fields would still be sent as raw metrics.
# write_statistics = false
`

func (c *CloudWatch) SampleConfig() string {
Expand Down Expand Up @@ -114,7 +114,7 @@ func (c *CloudWatch) Write(metrics []telegraf.Metric) error {

var datums []*cloudwatch.MetricDatum
for _, m := range metrics {
d := BuildMetricDatum(m)
d := BuildMetricDatum(c.WriteStatistics, m)
datums = append(datums, d...)
}

Expand Down

0 comments on commit 08a11aa

Please sign in to comment.