DVA-C02 Question 358
Select 3You are developing a serverless application using AWS Lambda and need to implement observability to monitor performance and debug issues effectively. Which actions should you take to ensure your Lambda function is properly instrumented for observability?
- A
Use AWS X-Ray to trace requests across the application and visualize the flow of execution.
- B
Embed custom metrics using Amazon CloudWatch Logs and leverage CloudWatch Insights for querying logs.
- C
Enable VPC Flow Logs for the Lambda function to capture detailed network traffic information.
- D
Add custom annotations and metadata in the X-Ray traces to include context-specific information.
- E
Install a third-party monitoring agent on the Lambda function runtime to capture additional metrics.
Show answer and explanation
Correct answers: A, B, D
Explanation
To instrument code for observability in AWS Lambda, you should use AWS-native tools like AWS X-Ray and Amazon CloudWatch. X-Ray provides request tracing and flow visualization, while CloudWatch Logs and Insights enable custom metric embedding and querying. Additionally, adding custom annotations to X-Ray traces helps provide context for debugging. VPC Flow Logs and third-party agents are either unrelated or not applicable in this scenario.
- A. Correct.
AWS X-Ray allows you to trace requests and visualize the application's execution flow, which is essential for understanding performance and debugging issues. This is a key step in instrumenting your code for observability.
- B. Correct.
Custom metrics can be embedded using CloudWatch Logs, and CloudWatch Insights helps query and analyze these logs. This provides valuable insights into the behavior of your Lambda function.
- C. Incorrect.
VPC Flow Logs capture network traffic data, but this is unrelated to observability for application-level performance or debugging Lambda functions. This option is not relevant to the scenario.
- D. Correct.
Adding custom annotations and metadata in X-Ray traces enriches the traces with context-specific information, making it easier to debug and understand the flow of requests.
- E. Incorrect.
Lambda functions do not support the installation of third-party monitoring agents because of their serverless nature. Observability should rely on AWS-native tools like X-Ray and CloudWatch.