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-Idcarries a trace through SQS: the reserved message system attribute isAWSTraceHeader. - Believing the HTTP trace header can differ per message in a batch: it applies to every message in the
SendMessageBatchrequest. - Believing a new service should start on the X-Ray SDK and daemon: AWS recommends OpenTelemetry, through ADOT or an OpenTelemetry SDK.