AWS X-Ray is an AWS-managed service that allows you to track incoming and outgoing requests that your Lambda functions are issuing. It collects that information in segments and uses metadata to record additional data to help you debug, analyze, and optimize your function.
Overall, X-Ray can help you identify performance bottlenecks. However, it might require additional network calls that need to be made during the function's execution, adding to user-facing latency.
To get started, enable active tracing from the Lambda function's configuration page:
The following IAM policy is required to make the Lambda function publish the trace segments to X-Ray:
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": [
"xray:PutTraceSegments",
"xray...