Manually instrumenting Amazon SDK clients
Note
X-Ray SDK/Daemon Maintenance Notice – On February 25th, 2026, the Amazon X-Ray SDKs/Daemon will enter maintenance mode, where Amazon will limit X-Ray SDK and Daemon releases to address security issues only. For more information on the support timeline, see X-Ray SDK and Daemon Support timeline. We recommend to migrate to OpenTelemetry. For more information on migrating to OpenTelemetry, see Migrating from X-Ray instrumentation to OpenTelemetry instrumentation .
The X-Ray SDK for Java automatically instruments all Amazon SDK clients when you include the Amazon SDK Instrumentor submodule in your build dependencies.
You can disable automatic client instrumentation by removing the Instrumentor submodule. This enables you to instrument some clients manually while ignoring others, or use different tracing handlers on different clients.
To illustrate support for instrumenting specific Amazon SDK clients, the application passes a
tracing handler to AmazonDynamoDBClientBuilder as a request handler in the user,
game, and session model. This code change tells the SDK to instrument all calls to DynamoDB using
those clients.
Example src/main/java/scorekeep/SessionModel.java – Manual Amazon
SDK client instrumentation
import com.amazonaws.xray.AWSXRay;
import com.amazonaws.xray.handlers.TracingHandler;
public class SessionModel {
private AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard()
.withRegion(Constants.REGION)
.withRequestHandlers(new TracingHandler(AWSXRay.getGlobalRecorder()))
.build();
private DynamoDBMapper mapper = new DynamoDBMapper(client);If you remove the Amazon SDK Instrumentor submodule from project dependencies, only the manually instrumented Amazon SDK clients appear in the trace map.