Can I change metric units on CloudWatch?

纵然是瞬间 提交于 2019-12-23 12:57:14

问题


I am sending metric data to CloudWatch, and they were sent to AWS with StandardUnit.Count unit, but I later changed them to StandardUnit.Milliseconds. On my dashboard in AWS I still see the data in Count unit.

Is it possible to force AWS to show it in Millisecs, or will it change later? Or should I rename my metrics (I would not like that option)


回答1:


You do not have to rename your metric. CloudWatch doesn't really care about your unit all that much. From CloudWatch Concepts doc:

Units help provide conceptual meaning to your data. Though CloudWatch attaches no significance to a unit internally, other applications can derive semantic information based on the unit.

Units are not tied to a metric, they are tied to each specific datapoint. In your case datapoints will have unit Count up to one point and Milliseconds from that point on. This is not a problem as long as you don't use GetMetricStatistics API with a specified unit. If you don't specify a unit, GetMetricStatistics will return data for both units, but if you set a unit, you'll only get the data for the specified unit (see the API docs for more detail).

CloudWatch Dashboards will display the last unit they see. In the example below, I was publishing the metric with unit Milliseconds up until the gap and with unit Count after the gap (opposite of your situation) and the dashboards are displaying the Count as unit:

If I change the range of the graph to exclude the datapoints with Count unit, graph displays Milliseconds as unit:



来源:https://stackoverflow.com/questions/46711700/can-i-change-metric-units-on-cloudwatch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!