All the Python based lambda functions invoked by StepFunctions
(ReadDynamoDB, PriceLessThan55, PriceGreatThan55) in the application use AWS Distro for Open Telemetry (ADOT) to collect traces and send them to AWS X-Ray. Read the documentation for additional details on this topic.
The AWS Distro for OpenTelemetry Lambda (ADOT Lambda) layer for AWS Lambda provides a plug and play user experience by automatically instrumenting a Lambda function and by packaging OpenTelemetry Python together with an out-of-the-box configuration for AWS Lambda and AWS X-Ray.
Tracing using ADOT can be done by following these 3 simple steps:
AWS_LAMBDA_EXEC_WRAPPER = /opt/python/adot-instrumentto your Lambda function.
Active Tracingin your Lambda function.
./pet_stack/cdk/lib/services/stepfn.ts file contains the following CDK Typescript code. A new Lambda layer gets added created as show below:
The following function adds the ADOT Layer. The environment variable is also added, which enables tracing through ADOT.
As a result, the traces from these lambda functions are being captured in X-Ray as shown in the screenshot below.
This concludes the AWS Distro for OpenTelemetry module.