3
votes

I have a CloudWatch dashboard with a set of widgets. All the widgets have graphs/line charts based on custom metrics. I defined these custom metrics from metric-filters being defined on the CloudWatch log group.

For every custom metric, I want to set the unit to, for example, milliseconds, seconds, hours etc. CloudWatch console somehow shows all the metric units to be counts only.

Can we not modify the CloudWatch metric unit to be different than count? If not possible from the console, is it possible through the API?

1

1 Answers

3
votes

Every datapoint has a unit and that unit is set when the datapoint is published. If unit is not set, it defaults to None.

You can't change the unit when graphing or when fetching the data via API, graphs and APIs simply return the unit that is set on datapoints. Also, CloudWatch won't scale your data based on unit. If you have a datapoint with a value of 1200 milliseconds for example and you request this metric in seconds you will get no data, CloudWatch won't scale your data and return 1.2 seconds as one might expect.

So looks like CloudWatch logs are publishing data with unit equal to Count. I couldn't find a way to have it publish data with any other unit.