This repository contains source code for demonstrating the getting started experience when using native tracing through various AWS serverless technologies. It implements the same architecture in all the available Lambda runtimes, and different IaC tools to provide a getting started experience for where ever you are today.
| Node | Python | .NET | Java | Go | Rust | |
|---|---|---|---|---|---|---|
| AWS CDK | Y | Y | ||||
| AWS SAM | Y | |||||
| Terraform | Y | |||||
| Serverless Framework | Y |
Once deployed, the system demonstrates the full end to end observability Datadog provides. Including automatic trace propagation through multiple asynchronous message channels, backend services and demonstrates SpanLinks.
The application simulates Product, Inventory and Analytics services, inside an eCommerce application. The functionality is managed by three independent teams, the product service, inventory service and analytics service team. Interactions between domains runs through a shared Amazon EventBridge EventBus.
The product service is made up of 3 independent services, that interact asynchronously.
- The
ProductAPIprovides CRUD (Create, Read, Update, Delete) API provides the ability to manage product information. On all CUD requests, private events are published onto respective SNS topics for downstream processing. The API has one additional Lambda function reacting toPricingChangedevents published by theProductPricingService. - The
ProductPricingService. This service consumersProductCreatedandProductUpdatedevents published by theProductAPIand asynchronously calculates pricing discounts for the product. On calculation, it publishes aPricingChangedevent onto another SNS topic which theProductAPIthen consumers to update pricing - The
PublicEventPublisheracts as a translation layer between private and public events. It takes theProductCreated,ProductUpdatedandProductDeletedevents and translates them into the respective events for downstream processing.
The inventory service is made up of 2 independent services, that interact asynchronously.
- The
InventoryAntiCorruptionLayeracts as an anti-corruption layer. It receives requests from upstream services, ensures they are semantically correct against the expected schema and translates them for further processing inside theInventorySevice. This step also acts as a buffer, to prevent overload from upstream services. - The
StockOrderingServicetakes upstream events and starts a StepFunctions workflow to start the processing of purchasing stock for the product
The analytics service is made up of a single service that recevies all events from EventBridge and increments a metric inside Datadog depending on the type of event received. The analytics service also demonstrates the use of SpanLinks. SpanLinks are useful when two processes are related but don't have a direct parent-child relationship.
In this scenario, analytics spans would add noise to the end to end trace for the product creation and inventory ordering flow. However, causality is still useful to understand. Span Links provide a link, but still keeps independence in the traces.
The repository also includes load-test configuration using Artillery. You can use this to generate load into the product service, and view the downstream data in Datadog.
NOTE The load test runs for roughly 3 minutes, and will generate load into both your AWS and Datadog accounts. Use with caution to avoid billing. As an alternative, a Postman Collection is available that you can use to run test manually. Or you can use the integration tests documented in the respective languages folder.
To execute the loadtests, first ensure Artillery is installed. You will also need to set the API_ENDPOINT environment variable.
cd loadtest
export API_ENDPOINT=
artillery run loadtest.yml
