DVA-C02 exam dumps

DVA-C02 practice question 375 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 375

Select 3

A developer is working on a serverless application deployed using AWS Lambda. The application processes incoming messages from an Amazon SQS queue and logs metrics for debugging and monitoring purposes. The developer needs to implement custom application-level metrics, such as the number of successfully processed messages and processing latency, and make these metrics visible in Amazon CloudWatch. Which of the following steps should the developer take to implement custom metrics?

  1. A

    Use the AWS SDK to publish custom metrics to CloudWatch using the PutMetricData API.

  2. B

    Use embedded metrics by including the metrics in JSON format within the Lambda function's logs, and enable the CloudWatch Embedded Metric Format.

  3. C

    Enable AWS X-Ray tracing for the Lambda function to automatically track custom application metrics.

  4. D

    Use the CloudWatch Agent to collect and publish metrics directly from the Lambda function.

  5. E

    Attach an IAM policy to the Lambda execution role that allows the 'cloudwatch:PutMetricData' action.

Show answer and explanation

Correct answers: A, B, E

Explanation

To implement custom metrics in a Lambda-based application, developers can either use the PutMetricData API to send metrics directly to CloudWatch or use embedded metrics by including them in logs processed by CloudWatch with the Embedded Metric Format. Additionally, the Lambda execution role must have appropriate permissions (e.g., 'cloudwatch:PutMetricData') to publish metrics to CloudWatch. AWS X-Ray and the CloudWatch Agent are not suitable for publishing custom application-level metrics in this scenario.

  • A. Correct.

    Correct. The PutMetricData API allows publishing custom metrics to CloudWatch. This is a standard method for sending application-specific metrics.

  • B. Correct.

    Correct. Embedded metrics enable you to include custom metrics within your application logs, and CloudWatch automatically extracts these metrics when the Embedded Metric Format is enabled.

  • C. Incorrect.

    Incorrect. AWS X-Ray is used for distributed tracing and debugging; it does not automatically track or publish custom application metrics to CloudWatch.

  • D. Incorrect.

    Incorrect. The CloudWatch Agent is designed for EC2 or on-premises servers, not for Lambda functions.

  • E. Correct.

    Correct. The Lambda execution role must include permissions to use the 'cloudwatch:PutMetricData' action for the function to publish metrics to CloudWatch.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam