The “serverless” movement is taking the industry by storm and now, with Datadog, you can start monitoring your serverless applications and functions on AWS Lambda.
As soon as you enable the Lambda integration, you’ll start to see your metrics in an out-of-the-box dashboard like the one above.
Monitor and alert on AWS Lambda serverless functions in minutes with Datadog.
AWS Lambda is an event-driven compute service that abstracts away the underlying infrastructure, allowing developers to focus on their code rather than the execution environment. Lambda functions can be triggered via API, by in-app actions, or by AWS events, such as a new object being added to an S3 bucket. Since its debut in 2014, Lambda adoption has flourished, with a rich ecosystem of tooling and frameworks developing around it, and adoption by large companies like Netflix and Nordstrom.
As part of AWS, Lambda integrates with several AWS services you may already be using. These services include: EC2, ELB, SES, and S3. Its affordability, reliability, convenience, and native integration with other AWS services make Lambda the go-to computation-as-a-service platform.
Monitoring Lambda function execution and performance is a bit different than monitoring a traditional application server. With no “host” in the traditional sense (and thus nowhere to run standard diagnostic and monitoring tools) monitoring Lambdas without living in the AWS management console can be challenging.
With Datadog’s integration with AWS Lambda, you can now visualize and alert on Lambda metrics and logs, and put them in context with operational data from the rest of your infrastructure. Instead of clicking through the AWS console for your function’s execution metrics, now you can see them all in one place.
Using our Lambda integration, you’ll be able to alert on and visualize metrics on your functions’ execution, including:
- execution times
- throttled functions
The integration automatically adds tags to your Lambda functions, so you can use these new dimensions to slice and dice your data any way you like. That includes tags such as:
functionname: the name of the Lambda function
region: the region in which the Lambda is “located”
- any custom tags you added to your functions
Datadog also automatically adds tags for your Lambda runtime language, allocated memory, and AWS account.
You can also collect and send custom metrics with the Datadog Lambda Layer, so you can monitor function-specific metrics alongside metrics from the rest of your infrastructure.
To start sending your own custom metrics, add the Layer ARN to the appropriate Lambda function in your AWS console:
You can find the latest Layer version on the GitHub releases page for your runtime.
Datadog offers Lambda Layers for several programming languages and runtimes, including Python, Node.js, Ruby, Go, and Java, so you can easily import the necessary Lambda methods into your existing code. Once your custom metrics are flowing into Datadog, you can track automatically calculated, real-time aggregations (average, sum, max, min, count, and percentile values).
Check out our documentation for more information about sending and tagging custom metrics with the Datadog Lambda Layer.
You can also collect traces for AWS Lambda by enabling Datadog’s AWS X-Ray integration. This allows you to visualize requests as they move across your infrastructure—from AWS Lambda functions to hosts, containers, and services.
In addition to collecting metrics and traces, you can automatically collect and forward your Lambda logs to Datadog. This enables you to quickly pivot from a Lambda metric or trace to related logs (e.g., by clicking the “Logs” tab in the trace above), so you can get a comprehensive view of Lambda activity all in the same place. Check out our documentation for more information on forwarding Lambda logs to Datadog.
If you haven’t already integrated AWS with Datadog, take a minute to do so before continuing.
Next, add the following permissions to your Datadog IAM policy to start collecting AWS Lambda metrics:
Once you’ve integrated Datadog with Amazon Web Services, you can turn on the integration right away, and add AWS Lambda to the ever-growing list of technologies you can monitor easily and collaboratively. If you’re new to Datadog, get started with a 14-day trial.