New Relic Distributed Tracing and Logs in Context for Lambda Functions
This is a sample application that shows how to:
- Instrument Lambda functions written in Python, Go and NodeJS
- Propagate trace headers to enable New Relic distributed tracing
- Enable New Relic logs in context
Application Architecture
The application starts by invoking the Python function thru an AWS API Gateway. It then presents a form with a text field and a dropdown field. Upon submitting the form, the text message will be put as a record in a kinesis stream. Depending on the dropdown field selection, either the Go or NodeJS function will be triggered. Both functions are accomplishing the same things but vary slightly in implementation.

Installation
Prerequisites
- AWS account
- AWS CLI and SAM CLI are configured
- New Relic account
Deployment
Run the deploy.sh passing your New Relic account ID and AWS region
$ ./deploy.sh xxxxxxx region
This will create the following:
- Python, Go and Node Lambda functions
- Two distinct Kinesis streams mapped as an event source for the Go and Node functions, respectively.
- API Gateway endpoints to test/access the Python function
Testing
Navigate to your AWS console and find the processRecords CloudFormation stack. In the Outputs tab, click the PythonApi link. Happy testing!
License
Apache-2.0 © Jo Ann de Leon