Note: Some of the information on this link is outdated, we are actively working on updating the info but you may refer to the document below to see the updated info:
It has been some time since the release of AWS Lambda monitoring and I wanted to put this post together to walk you through all the steps that are required to enable New Relic on your Lambda function.
First thing first, if you have missed the announcement and you are wondering, “wait, what New Relic monitors lambda now!!!” then I encourage you to read this blog post from out PM for lambda, Andrew Tunall:
In this post, I have put together a series of videos that walks you through each step of this installation and highlights all the resources you need to get this to work. I have divided these videos into five short videos so you can only watch the ones that you are curious about. I will split these videos into three sections that align with the three steps you need to follow to enable New Relic on your function. With no further ado, let’s jump right in!!!
We are going to start this video from New Relic One homepage using https://one.newrelic.com, once you navigate to this page we will be using the steps mentioned in the GitHub repository below. Keep in mind these steps are the same as the ones mentioned in our public document:
- In this video we are going over the Installation steps:
This is the community post that I referenced during the video regarding AWS permissions:
Note: On the setup page for this step, there is a checkbox that is labeled
I will connect a new AWS account, I wanted to expand on the usage of this box:
- If Unchecked: You will be able to use the AWS accounts that you have already integrated with New Relic.
- If Checked: This will not give you a dropdown option to choose from the AWS accounts that you have previously integrated with New Relic. Therefore, you need to type the name of the new AWS account.
- This video will follow the steps to Enable Lambda Integration:
This first step is connecting your AWS account to New Relic, therefore you will be able to see your function appearing in New Relic UI; however, you will see that this function has an empty section under
Instrumented. See below screenshot:
On the other hand, you will still see the CloudWatch metrics being reported to New Relic after only completing this step. Refer to the screenshot:
Keep in mind that the section that is labeled
Troubleshoot will not have any data until you complete step two and three of this installation. If you click on those tabs you will see the message below:
For this section, we wrote a very simple Hello World lambda function in Node JS that we are going to instrument. This section is also divided into two videos:
- The third video will demonstrate how to install the New Relic agent and instrument your function:
- Now we will walk you through the AWS UI and setting up environment variables:
Note: During the video I mentioned that there are two required environment variables that you need to set for the Node JS agent; while this statement is true, to receive
Distributed Tracing and
Invocation Detail data, you need further environment variables. Please see the screenshot below which I extracted from the documentation I followed during the video:
Let me first emphasize that this step is required and if you already have one log stream for your function, please contact New Relic Support so we can explore other avenues.
- This step consists of only one video where we are going to run the script that links your Lambda function’s CloudWatch Logs stream to the New Relic log-ingestion:
Now that you are all done with these three steps, you can see that your function is shown as instrumented, see below:
Lastly, as I mentioned in the last video you can now see data under the
Troubleshoot section, see below:
While in this post we used a Node JS New Relic agent to instrument our Lambda Function, there are a lot of similarities between different language agents. Therefore, you may still find these videos helpful for other language agents.
Enabling New Relic on AWS (step 1) and the configuring your CloudWatch logs (step 3) are universal among all of the language agents that New Relic supports for Lambda; hence, you only need to use the documentation for that particular language agent to instrument your function code.
Lastly, I have also written this FAQ for Lambda that might answer some of the questions you may come across:
I hope these videos help you get the most out of New Relic monitoring for Lambda and if you have any questions, be sure to comment and we’d do our best to address them.