2
votes

I'm trying to add a custom dimension to my statsd metrics published to the cloudwatch unified agent. CW docs state that append_dimensions under the metrics section only supports InstanceId, InstanceType, AutoScalingGroupName and ignores others.

CloudWatch Agent Configuration File: Metrics Secition:

Docs

append_dimensions – Optional. Adds Amazon EC2 metric dimensions to all metrics collected by the agent. The only supported key-value pairs are shown in the following list. Any other key-value pairs are ignored.

"ImageID":"${aws:ImageId}" sets the instance's AMI ID as the value of the ImageID dimension.

"InstanceId":"${aws:InstanceId}" sets the instance's instance ID as the value of the InstanceID >

dimension.

"InstanceType":"${aws:InstanceType}" sets the instance's instance type as the value of the > InstanceType dimension.

"AutoScalingGroupName":"${aws:AutoScalingGroupName}" sets the instance's Auto Scaling group name > as the value of the AutoScalingGroupName dimension.

The docs recommend adding append_dimensions directly to the section defining the metrics you wish to use a custom dimension.

Adding Custom Dimensions to Metrics Collected by the CloudWatch Agent:

Docs

To add custom dimensions such as tags to metrics collected by the agent, add the append_dimensions field to the section of the agent configuration file that lists those metrics.

So I tried adding append_dimensions to the statsd section:

"statsd": {
  "service_address": ":8125",
  "metrics_collection_interval": 10,
  "metrics_aggregation_interval": 60,
  "append_dimensions": {
    "Environment": "${APP_ENV}"
  }
}

and I get the error:

Additional property append_dimensions is not allowed

I have tried sending tags with my metrics as well and they seem to be ignored.

1

1 Answers

2
votes

The AWS Docs says "On servers running either Linux or Windows Server, the metrics section includes the following fields: ... append_dimensions" and "If you want to append dimensions to metrics with arbitrary key-value pairs, use the append_dimensions parameter in the field for that particular type of metric."

So you can only add append_dimensions in metrics section or any particular metric field.

Retrieve Custom Metrics with StatsD says "There are three optional fields that you can add to the statsd section of the agent configuration file as needed", so clearly statsd doesn't support append_dimensions.