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)
To edit a metric policy (console) Open the MediaStore console at https://console.aws.amazon.com/mediastore/ . On the Containers page, choose the container name. In the Metric policy section, choose Edit metric policy. Make the appropriate changes, and then choose Save.
Metrics are stored separately in Regions, but you can use CloudWatch cross-Region functionality to aggregate statistics from different Regions.
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:
May be someone searching for cloudformation templates for the same.
MetricName: "Duration"
Namespace: "AWS/Lambda"
Statistic: "Average"
TreatMissingData: "notBreaching"
Period: 120
EvaluationPeriods: 1
Threshold: 5000
Unit: "Milliseconds"
ComparisonOperator: "GreaterThanThreshold"
Dimensions:
- Name: "FunctionName"
Value: !Ref LambdaAuthorizerFnName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With