Skip to content

Commit f51243f

Browse files
authored
docs: improve tracing doc for sdk instrumentation (#1687)
* improve tracing links for xray
1 parent ca01de1 commit f51243f

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/core/tracing.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,24 @@ under a subsegment, or you are doing multithreaded programming. Refer examples b
376376

377377
## Instrumenting SDK clients and HTTP calls
378378

379-
User should make sure to instrument the SDK clients explicitly based on the function dependency. Refer details on
379+
Powertools for Lambda (Java) cannot intercept SDK clients instantiation to add X-Ray instrumentation. You should make sure to instrument the SDK clients explicitly. Refer details on
380380
[how to instrument SDK client with Xray](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java.html#xray-sdk-java-awssdkclients)
381-
and [outgoing http calls](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java.html#xray-sdk-java-httpclients).
381+
and [outgoing http calls](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java.html#xray-sdk-java-httpclients). For example:
382+
383+
=== "LambdaHandler.java"
384+
385+
```java hl_lines="1 2 7"
386+
import com.amazonaws.xray.AWSXRay;
387+
import com.amazonaws.xray.handlers.TracingHandler;
388+
389+
public class LambdaHandler {
390+
private AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard()
391+
.withRegion(Regions.fromName(System.getenv("AWS_REGION")))
392+
.withRequestHandlers(new TracingHandler(AWSXRay.getGlobalRecorder()))
393+
.build();
394+
// ...
395+
}
396+
```
382397

383398
## Testing your code
384399

0 commit comments

Comments
 (0)