DVA-C03 practice question: Custom metrics, alarms and health checks (1 of 4)
Troubleshooting and Optimization A free question from our original DVA-C03 practice exam. Try it, then open the answer to see why each option is right or wrong.
A Lambda function processes orders and must report a custom metric for each order's value, with one dimension, region.
The team does not want a PutMetricData call in every invocation, and the function's role should not need cloudwatch:PutMetricData. The per-order detail must also stay searchable in Logs Insights.
What should the developer do?
Choose one answer.
AA. Start a background thread at the end of each invocation that calls PutMetricData with the order value.
BB. Create a metric filter on the log group that counts log lines containing the word order.
CC. Write each order as a JSON log event in embedded metric format, with region as a dimension.
DD. Turn on Lambda Insights, which adds the order value to the function's built-in metrics.
Show the answer and explanation
Answer: C
A. Wrong: The thread still calls PutMetricData, so the role still needs that permission and the per-invocation API call remains.
B. Wrong: A metric filter on lines containing a word counts those lines. It does not publish each order's value as a metric with a region dimension.
C. Right: Correct. The embedded metric format puts the metric in a structured log event, and CloudWatch extracts it. The function needs logs:PutLogEvents rather than PutMetricData, and the event stays in the log for Logs Insights. Learn more: Embedding metrics within logs (opens in a new tab)
D. Wrong: Lambda Insights reports system-level metrics such as memory and CPU use. It does not turn application values, such as an order total, into custom metrics.
Explanation
The embedded metric format lets code write metrics inside structured log events, and CloudWatch Logs extracts them without a PutMetricData call. The detailed events remain searchable. Dimensions with many unique values, such as an order ID, create a separate metric for each value, so the dimension should be low-cardinality like region.
Want more on Custom metrics, alarms and health checks? The 5 full-length practice sets have 16 more Custom metrics, alarms and health checks questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →