Course menuDVA-C03

Exams / DVA-C03 / Study guide / Tracing with X-Ray

Tracing with X-Ray: DVA-C03 study notes and practice questions

What to know about Tracing with X-Ray for the DVA-C03 exam, from the Troubleshooting and Optimization domain (22% of the exam guide), then 2 free questions to test it. Part of the DVA-C03 study guide.

Last verified against current AWS documentation ·How we write our questions

What to know for the exam

These questions ask how a request is followed across services, and which tool records each hop. Expect to choose between the X-Ray SDK, OpenTelemetry and Application Signals, and to decide what a trace will and will not show.

What X-Ray stores

  • A trace follows one request. Each service records a segment, and calls inside it are subsegments, such as a DynamoDB call or an HTTP call.
  • The service map draws services and their connections from the traces. Groups filter traces with an expression, such as only slow or faulty requests, and can drive CloudWatch metrics and alarms.
  • Annotations are indexed key-value pairs, so you can filter on them, such as a customer tier. Metadata is stored but not indexed and cannot be used in a filter.
  • Sampling rules decide which requests are recorded. A rule matches on path, method and service, has a priority, and sets a rate. Rules are checked in ascending priority number, and the first match decides. The default rule catches everything else.

Which instrumentation to use

  • OpenTelemetry through ADOT (AWS Distro for OpenTelemetry): the recommended path for new instrumentation. ADOT sends traces to X-Ray, so X-Ray stays the backend.
  • X-Ray SDKs and the X-Ray daemon: in maintenance mode. Existing code keeps working, but do not choose them for new code.
  • CloudWatch Application Signals: instruments supported workloads for you and shows service-level views such as latency and error rates against objectives.
  • Lambda active tracing: turned on in the function configuration. It samples invocations at a fixed rate that you cannot change per function, and it does not replace subsegments from your code.

What the SDK can see

The SDK records calls made through clients it patches, such as AWS SDK clients and standard HTTP libraries. A custom HTTP client that the SDK does not patch produces no subsegment, so the time looks unexplained inside the caller’s segment. Fix it by wrapping the call in a manual subsegment. Trace context crosses SQS when the producer sends it with the message and the consumer reads it, so check propagation when a downstream segment is missing.

How to choose

Scenario wording Answer
“traces missing for a Lambda function” Check active tracing and the role; Lambda’s own sampling rate is fixed
“trace one path at high rate for a few days” Sampling rule with a higher priority for that path
“filter traces by customer tier” Annotation on the segment
“new instrumentation, vendor-neutral” OpenTelemetry with ADOT
“service-level view without writing trace code” CloudWatch Application Signals
“time spent in a custom HTTP client” Manual subsegment

Common traps

  • Default sampling hides rare failures. Add a rule for the path under investigation, and remove it afterward.
  • Metadata for filtering. Metadata cannot be used in a filter expression.
  • Assuming the X-Ray SDK is the answer for new code, when the exam expects OpenTelemetry with ADOT.
  • Thinking X-Ray is retired. It is still the trace store and is in scope.

Try the 2 practice questions

A team instruments an order API with AWS X-Ray.

Each trace should record the customer's loyalty tier, and the team must find slow requests from premium customers with a filter expression. The team also wants to keep the full cart as JSON for debugging, but nobody needs to search by it.

How should each value be recorded?

Choose one answer.

  1. A. Record the loyalty tier and the cart JSON as metadata.
  2. B. Record the loyalty tier as an annotation, and the cart JSON as metadata.
  3. C. Record the loyalty tier and the cart JSON as annotations.
  4. D. Record the loyalty tier as a subsegment name, and the cart JSON as metadata.
Show the answer and explanation

Answer: B

  • A. Wrong: Metadata is not indexed, so filter expressions cannot find the traces for premium customers. Metadata is right for the cart, but not for the tier.
  • B. Right: Correct. Annotations are simple key-value pairs that X-Ray indexes for filter expressions, so the tier can be searched. Metadata holds richer values such as objects, which suits the cart, and it is not searched. Learn more: AWS X-Ray concepts (opens in a new tab)
  • C. Wrong: The tier can be searched as an annotation, but annotations hold simple key-value pairs rather than objects. A JSON cart is better kept as metadata.
  • D. Wrong: A subsegment name describes a unit of work, not a customer attribute, so it is not the way to filter traces by tier.

Explanation

X-Ray annotations are simple key-value pairs that are indexed for filter expressions, so they should hold values you want to search. Metadata can hold any type, including objects and lists, but it is not indexed and is for data stored with the trace.

Study

Question 2

Harder · choose 2 ·Link to this question (question 2)

A checkout API is an Amazon API Gateway REST API that invokes a Lambda function.

Operations want production traces with two segments per request, one for API Gateway and one for the function, so they can see where the time goes. The function's code must not change, and the team wants its execution role to stay limited to what it needs.

Which TWO actions are required? (Choose two.)

Choose two answers.

  1. A. Enable X-Ray tracing on the API Gateway stage, so the API's segment is recorded.
  2. B. Run the X-Ray daemon on an EC2 instance in the function's VPC and point the function at it.
  3. C. Turn on CloudTrail data events for the function so that its invocations are traced.
  4. D. Turn on active tracing for the function, and make sure its execution role allows X-Ray writes.
  5. E. Turn on detailed CloudWatch metrics for the API Gateway stage, so that segments appear.
Show the answer and explanation

Answers: A, D

  • A. Right: Correct. API Gateway records a segment for each request only when tracing is enabled on the stage. The setting needs no code change. Learn more: Set up AWS X-Ray with API Gateway REST APIs (opens in a new tab)
  • B. Wrong: Lambda sends trace data from its own managed environment, so the function does not need a daemon on an EC2 instance. This adds work with no effect on the segments.
  • C. Wrong: CloudTrail records API activity for auditing. It does not record X-Ray segments or show request timing.
  • D. Right: Correct. Active tracing makes Lambda send a function segment to X-Ray. The execution role must allow the X-Ray write actions, and this is set in the function's configuration, not in its code. Learn more: Visualize Lambda function invocations using AWS X-Ray (opens in a new tab)
  • E. Wrong: Detailed metrics add CloudWatch metrics for the stage's requests. They do not create X-Ray segments or join the two services' traces.

Explanation

End-to-end traces need every service in the path to record its own segment. The API Gateway stage must have X-Ray tracing on, and the Lambda function must have active tracing with an execution role that allows X-Ray writes. CloudTrail and metrics do not create trace segments.

Study

Want more on Tracing with X-Ray? The 5 full-length practice sets have 11 more Tracing with X-Ray questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets

Study Tracing with X-Ray

More Troubleshooting and Optimization topics