Steven Staley published this guide on AWS tracing in AWS Lambda context. A serverless API on AWS in order to run in production needs a distributed tracing. Author wanted to see if he could use AWS X Ray to get everything he wanted out of a tracing solution.
The article then goes in great detail over:
- X Ray
- Internal Tracing with X Ray
- Local Development
- Express with Lambda & X Ray
… and much more. The X Ray SDK doesn’t really play nice with serverless offline. One option that at least prevents these errors from causing your lambda to fail is set up specific environment variable _AWS_XRAY_CONTEXTMISSING. This tells X Ray to log the error instead of throwing it. However, the log output is rather verbose and annoying.
This is really detailed and excellent guide for production ready monitoring and tracing fo your serverless. You will get all the code needed and resources to further reading. Well done![Read More]