Certopolis

AWS Certified Developer – Associate

X-Ray with OpenTelemetry and ADOT for DVA-C03

The AWS X-Ray Developer Guide says X-Ray is moving to OpenTelemetry as its primary instrumentation standard and recommends migrating from the X-Ray SDKs and daemon. OpenTelemetry spans are converted to X-Ray segments and subsegments. Span attributes become unindexed metadata unless their keys are added to the aws.xray.annotations attribute list.

What replaces the X-Ray SDK and daemon?

The X-Ray Developer Guide gives February 25, 2026 as the date the X-Ray SDKs and daemon enter maintenance mode, with releases limited to security issues. AWS recommends OpenTelemetry for instrumenting applications.

The concepts map across. A segment becomes a server span and a subsegment becomes a non-server span. The X-Ray recorder becomes a tracer provider, and the X-Ray daemon becomes the OpenTelemetry Collector. The X-Ray SDK sends segments to the daemon over UDP. OpenTelemetry span exporters use http/protobuf or grpc and send spans to a collector or the CloudWatch agent.

The AWS Distro for OpenTelemetry (ADOT) is AWS's supported distribution of the OpenTelemetry SDKs, auto-instrumentation agents and collectors. With it you instrument once and send correlated metrics and traces to CloudWatch, X-Ray and Amazon OpenSearch Service. Using X-Ray with ADOT needs two parts: an OpenTelemetry SDK enabled for X-Ray and the ADOT Collector enabled for X-Ray.

Annotations, metadata and span attributes

In X-Ray, annotations are key-value pairs that are indexed for use with filter expressions, up to 50 per trace. Metadata can hold any value, including objects and lists, but is not indexed.

OpenTelemetry has one concept, attributes. By default span attributes are converted to metadata in X-Ray. To search traces by an attribute such as tenant_id, add its key to the aws.xray.annotations attribute list so it is converted to an annotation.

How does trace context travel between services?

The X-Ray trace header is X-Amzn-Trace-Id. It carries the root trace ID, the parent segment ID and the sampling decision, for example Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8;Sampled=1. The X-Ray SDK propagates it automatically.

OpenTelemetry propagates W3C Trace Context by default. It can use one or more header formats, and AWS says to configure the X-Ray propagator to pass trace context to API Gateway endpoints and other AWS services that support X-Ray.

Amazon SQS accepts the trace header in two ways. The default HTTP header applies to all messages in a SendMessage or SendMessageBatch request. The AWSTraceHeader message system attribute carries the header with a message, works without X-Ray SDK auto-instrumentation and overrides the HTTP header when both are set. A Lambda consumer continues the trace automatically. Other consumers read AWSTraceHeader from ReceiveMessage and recover the context themselves.

How is sampling decided?

By default the X-Ray SDK records the first request each second and five percent of any additional requests. You can change the default rule and add rules based on properties of the service or request.

OpenTelemetry adds its own strategies: parent-based sampling, trace ID ratio sampling, tail sampling in the collector and custom samplers. Some OpenTelemetry SDK languages can also use X-Ray sampling rules through an X-Ray remote sampler.

Where the exam catches people

  • Believing an OpenTelemetry span attribute can be used in an X-Ray filter expression as it is: attributes become metadata, which is not indexed. List the key in aws.xray.annotations.
  • Believing the default W3C Trace Context header joins a trace through API Gateway: configure the X-Ray propagator, alone or alongside W3C.
  • Believing a custom message attribute named X-Amzn-Trace-Id carries a trace through SQS: the reserved message system attribute is AWSTraceHeader.
  • Believing the HTTP trace header can differ per message in a batch: it applies to every message in the SendMessageBatch request.
  • Believing a new service should start on the X-Ray SDK and daemon: AWS recommends OpenTelemetry, through ADOT or an OpenTelemetry SDK.

Written from these sources

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. A service is instrumented with an OpenTelemetry SDK and exports its spans to AWS X-Ray. Each request's spans carry a tenant_id attribute. A developer must be able to find every trace for a given tenant_id value by using X-Ray filter expressions, and must change only how the service records tenant_id. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Troubleshooting and Optimization building.

    Not that one: B is right. In the game your Troubleshooting and Optimization building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    X-Ray's migration guide gives the way to change that for a specific attribute: add its key to the aws.xray.annotations attribute list, and that attribute is converted to an annotation instead. Listing tenant_id there makes every trace for a tenant findable with a filter expression, and every other attribute stays metadata, visible in the trace details.

    Written from docs.aws.amazon.com/xray/latest/devguide/xray-sdk-migration.html

  2. A developer moves an Amazon ECS service from the AWS X-Ray SDK to an OpenTelemetry SDK. Before the move, each request appeared in X-Ray as one trace from the service through an Amazon API Gateway REST API, whose stage has active tracing turned on, to an AWS Lambda function. Now the service's spans and the API Gateway segments for a request appear in separate traces. Each request must again appear as one trace. Which solutions will meet these requirements? (Select TWO.)

    Right. In the game that’s Renown for your Troubleshooting and Optimization building.

    Not that one: B,D is right. In the game your Troubleshooting and Optimization building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    OpenTelemetry can use one or more header formats, so the X-Ray propagator alone works, and so does adding it alongside W3C Trace Context, which keeps the W3C header for any non-AWS service that reads it. Either way, API Gateway receives the X-Ray header and joins the service's trace.

    Written from docs.aws.amazon.com/xray/latest/devguide/xray-sdk-migration.html

  3. A producer application groups messages created by many different user requests into each SendMessageBatch call to an Amazon SQS queue, and an AWS Lambda function consumes the queue. The producer is written in a language that has no X-Ray SDK, so a developer adds tracing code by hand. In AWS X-Ray, each message's processing in the function must appear in the trace of the user request that created that message. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Troubleshooting and Optimization building.

    Not that one: C is right. In the game your Troubleshooting and Optimization building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    The AWSTraceHeader message system attribute is reserved by Amazon SQS for the X-Ray trace header, is set per message, is usable when there is no X-Ray SDK auto-instrumentation, and overrides the HTTP header when both are set. Because one batch holds messages from many requests, only the per-message system attribute links each message to its own request, and the Lambda consumer continues the trace automatically.

    Written from docs.aws.amazon.com/xray/latest/devguide/xray-services-sqs.html

Ask for something