Courseiva
Monitoring and LoggingmediumMultiple ChoiceObjective-mapped

Using AWS X-Ray to Break Down API Latency per Endpoint in Microservices

A company is running a microservices application on Amazon ECS with AWS Fargate. The operations team needs to monitor application performance and troubleshoot slow API responses. They currently use Amazon CloudWatch Logs for container logs and have enabled Container Insights. However, they are unable to see detailed latency breakdowns per API endpoint. Which solution would provide the most granular visibility into API performance?

Quick Answer

The answer is AWS X-Ray, as it provides the most granular visibility into API latency breakdown per endpoint in microservices. Unlike CloudWatch Logs or Container Insights, which offer aggregated metrics or log-based queries, X-Ray captures end-to-end trace data as requests travel through distributed services on Amazon ECS with Fargate, revealing detailed latency contributions from downstream calls, database queries, and external HTTP requests. On the AWS Certified DevOps Engineer Professional DOP-C02 exam, this question tests your ability to distinguish between monitoring tools that show high-level health versus those that pinpoint root causes of slow responses—a common trap is choosing CloudWatch Logs Insights, which requires manual correlation and lacks automatic trace segmentation. Remember the mnemonic: X-Ray eXposes the exact path—each hop in your microservices gets a detailed latency stamp, making it the only tool that breaks down API performance endpoint by endpoint.

⚠ Common exam trap

Test-takers frequently confuse infrastructure-level metrics (CPU, memory, network) or log-based querying with the distributed tracing capability needed to break down latency per API endpoint, overlooking that only X-Ray provides end-to-end trace segments with sub-millisecond timing per service call.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use AWS X-Ray to instrument the application and collect trace data.

AWS X-Ray provides end-to-end tracing of requests as they travel through microservices, capturing detailed latency breakdowns per API endpoint, including downstream calls, database queries, and external HTTP requests. This gives the operations team the granular visibility needed to pinpoint exactly where slow responses occur, unlike aggregated metrics or log-based queries.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Enable detailed CloudWatch metrics for ECS and Fargate, including CPU and memory.

    Why it's wrong here

    CPU and memory metrics do not provide API-level latency breakdowns.

  • Enable CloudWatch Logs Insights to query API logs for slow requests.

    Why it's wrong here

    CloudWatch Logs Insights can search logs but does not provide distributed tracing or latency breakdowns per endpoint across microservices.

  • Use AWS X-Ray to instrument the application and collect trace data.

    Why this is correct

    AWS X-Ray provides end-to-end tracing with segment details, allowing you to see latency per API endpoint and downstream dependencies.

  • Deploy the AWS Distro for OpenTelemetry collector on each task to send metrics to CloudWatch.

    Why it's wrong here

    Deploying the AWS Distro for OpenTelemetry (ADOT) collector to send metrics to CloudWatch is insufficient for detailed API latency breakdowns per endpoint. CloudWatch Metrics stores time-series data, not the interconnected span data required for distributed tracing across microservices to pinpoint latency sources. This option is tempting because ADOT is the correct tool for collecting various telemetry types, including application metrics and traces. It would be appropriate for gathering custom application metrics or if the question specified sending traces to a service like AWS X-Ray for detailed analysis.

  • Set up VPC Flow Logs to analyze network latency between services.

    Why it's wrong here

    VPC Flow Logs capture network metadata, not application request latency.

About these practice questions

Courseiva writes every DOP-C02 question from scratch — 251 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

3 more ways this is tested on DOP-C02

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A company runs a microservices application on Amazon ECS with Fargate. The operations team notices that some services are experiencing intermittent high latency, but CPU and memory metrics appear normal. They need to identify the root cause. Which approach should they use?

hard
  • A.Enable detailed CloudWatch Logs and use CloudWatch Logs Insights to query logs for slow requests.
  • B.Use Amazon Managed Service for Prometheus to collect custom metrics and set up dashboards.
  • C.Set up CloudWatch Synthetics canaries to monitor the endpoints and measure response times.
  • D.Instrument the application with the AWS X-Ray SDK and use the X-Ray console to analyze traces.

Why D: AWS X-Ray provides end-to-end tracing to pinpoint latency issues in distributed applications. Option A is wrong because CloudWatch Logs Insights alone does not trace requests across services. Option B is wrong because Prometheus metrics are aggregated and may not correlate individual requests. Option C is wrong because CloudWatch Synthetics canaries test endpoints but cannot trace internal service calls.

Variation 2. A company runs a serverless application using AWS Lambda, Amazon API Gateway, and Amazon DynamoDB. The application is used by thousands of users. Recently, the operations team noticed an increase in 5xx errors from API Gateway. The team has enabled CloudWatch Logs for the Lambda functions and API Gateway. They see the errors are sporadic and not correlated with high traffic. The Lambda function's error count in CloudWatch is also increasing. The team wants to identify the specific requests that are failing and understand the error details. Which solution should the team implement?

medium
  • A.Use CloudWatch Logs Insights to query the Lambda logs for ERROR messages and correlate with API Gateway logs
  • B.Enable VPC Flow Logs for the Lambda function's VPC to capture network traffic
  • C.Enable AWS X-Ray active tracing on the Lambda functions and API Gateway to capture detailed request traces and error details
  • D.Enable AWS CloudTrail to log API Gateway API calls and analyze the logs

Why C: AWS X-Ray provides end-to-end tracing for requests through API Gateway and Lambda, capturing error details and metadata for individual requests. This allows the team to identify specific failing requests and understand error causes. Option A is wrong because CloudWatch Logs Insights can query logs, but it lacks automated tracing and correlation for distributed requests, making it less efficient. Option B is wrong because VPC Flow Logs capture network traffic metadata, not application-level errors. Option D is wrong because CloudTrail logs API calls at the AWS account level, not application request details.

Variation 3. A company runs a serverless application using AWS Lambda and Amazon API Gateway. The application processes user uploads to an S3 bucket. The operations team uses CloudWatch Logs for monitoring, but they are finding it difficult to correlate logs across multiple Lambda functions that handle different parts of the workflow. The team wants to trace requests as they flow through the application and identify bottlenecks or errors. The team has already enabled CloudWatch Logs for all Lambda functions. What should the team do to achieve end-to-end request tracing?

medium
  • A.Use CloudWatch Contributor Insights to analyze the log data and identify the top contributors to latency.
  • B.Use AWS CloudTrail to log all API calls and correlate them with CloudWatch Logs.
  • C.Create a CloudWatch ServiceLens service map to visualize the application components.
  • D.Enable AWS X-Ray on the Lambda functions and API Gateway to trace requests end-to-end.

Why D: AWS X-Ray provides end-to-end tracing and integrates with Lambda and API Gateway, enabling request tracing across the entire workflow. Option A is wrong because CloudWatch Contributor Insights analyzes top contributors to latency but does not trace requests across services. Option B is wrong because CloudTrail logs API calls, not application-level tracing, and cannot correlate requests across Lambda functions. Option C is wrong because CloudWatch ServiceLens provides service maps but relies on X-Ray for actual tracing; without X-Ray, ServiceLens cannot trace requests.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.