Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
opentelemetry-lambda
Create your own Lambda Layer in each OTel language using this starter code. Add the Lambda Layer to your Lamdba Function to get tracing with OpenTelemetry.
In the example code for this blog, I also added an AWS api gateway so we can trigger the Lambda using a public URL. That is out of scope for this blog, but you can visit the source code and check it out.
To receive the messages from the queue, we will use the sqs-consumer library. The service will receive messages describing newly created orders. After some processing, it will change the order status in the table to ‘completed’.
@opentelemetry/instrumentation-aws-lambda
You don’t have to create an opentelemetry configuration file such as this for each of your lambdas. In fact, you shouldn’t. In AWS, you can use Lambda Layers. You can define the OpenTelemetry tracing piece of code as a Lambda layer and use it in any Lambda you want. Furthermore, OpenTelemetry went ahead and implemented this opentelemetry-lambda layer for us. All we need to do is use it with our config.
According to the opentelemetry specification for messaging systems, When a process receives messages in a batch it is impossible for this process to determine the parent span for the span that it is currently creating.
AWS has good tools for tracing, but in this example, I will use another remote and distributed tracing platform – Aspecto.
Related posts
- Instrumenting AWS Lambda functions with OpenTelemetry SDKs
- Trace-based Testing AWS Lambda with Tracetest, ECS Fargate, and Terraform
- Serverless Adapter - Run APIs in serverless environments in clouds like AWS and Huawei
- Turbocharge your Lambda Functions with AWS Lambda Powertools for Python
- Optimizing Costs in the Cloud: Embracing a FinOps Mindset